Learn R Programming

guess (version 0.7.0)

lca_difficulty: Estimate LCA model with a bounded guessing-probability link

Description

Fits an LCA model where item difficulty is parameterized using an unbounded real-valued parameter instead of raw gamma (guessing probability). This is a reparameterized LCA, not an item-response model: it contains no person ability parameter.

Usage

lca_difficulty(
  transmatrix = NULL,
  base_rate = 0.25,
  nodk_priors = c(0.35, 0.3, 0.35, 0),
  dk_priors = c(0.25, 0.15, 0.1, 0.2, 0.1, 0.1, 0.1, 0)
)

Value

A guess_fit object with additional components:

params

Parameter matrix with "difficulty" row instead of "gamma"

gamma

Derived gamma values from difficulty (added for convenience)

learning

Learning estimates (gk or gk + kd)

Arguments

transmatrix

Transition matrix returned from multi_transmat

base_rate

Numeric. Minimum guessing probability (random chance). Default 0.25 (1/4 for 4-choice items). This is the floor for gamma when difficulty -> +Inf.

nodk_priors

Optional. Vector of length 4. Starting values for (gg, gk, kk, difficulty). First 3 must sum to 1.

dk_priors

Optional. Vector of length 8. Starting values for DK model. First 7 must sum to 1.

Details

Difficulty-Parameterized LCA Estimation

The relationship between difficulty (d) and gamma is: $$\gamma = base\_rate + (1 - base\_rate) \cdot logistic(-d)$$

Where logistic(x) = 1/(1+exp(-x)). This means:

  • d = 0: gamma = base_rate + 0.5*(1-base_rate) (middle difficulty)

  • d -> +Inf: gamma -> base_rate (hard item, random guessing)

  • d -> -Inf: gamma -> 1 (easy item, always correct even when guessing)

Examples

Run this code
# Simulate data with known difficulty
sim <- simulate_lca(n = 500, n_items = 3, difficulty = c(1, 0, -1), seed = 123)
transmatrix <- multi_transmat(sim$pre, sim$post)

# Fit with the difficulty-link parameterization
fit <- lca_difficulty(transmatrix)
fit$params["difficulty", ] # Should recover approximately c(1, 0, -1)
fit$gamma # Derived gamma values

Run the code above in your browser using DataLab