Skip to contents

The eirm function estimates explanatory item response models with item-related and person-related covariates. The function requires the data to be in a long format where items are nested within persons. If item responses are polytomous, then the data has to be reformatted using the polyreformat function.

Usage

eirm(
  formula,
  data,
  engine = "lme4",
  na.action = "na.omit",
  weights = NULL,
  mustart = NULL,
  etastart = NULL,
  cov.prior = "wishart",
  fixef.prior = NULL,
  control = glmerControl(optimizer = "optimx", calc.derivs = FALSE, optCtrl =
    list(method = "nlminb", starttests = FALSE, kkt = FALSE))
)

Arguments

formula

A regression-like formula that defines item responses as a dependent variable and explanatory predictors as independent predictors. For example, "response ~ -1 + predictor1 + predictor2". Use -1 in the formula to avoid the estimation of an intercept parameter.

data

A data frame in a long format where there are multiple rows for each person (i.e., nested data). The data should involve a variable that represents item responses, a variable that represents persons, and additional predictors to be used for 'explaining' item responses.

engine

Estimation engine with the options of either "lme4" (default) or "blme".

na.action

How missing data should be handled (default: "na.omit").

weights

Weights to be used in the estimation.

mustart, etastart

Model specification arguments for glmer. See glmer for details. Not used when engine = "lme4".

cov.prior

A BLME prior or list of priors with the options of "wishart" (default), "invwishart", "gamma", "invgamma", or NULL to impose a prior over the covariance of the random effects. Not used when engine = "lme4".

fixef.prior

A BLME prior of family "normal", "t", "horseshoe", or NULL (default) to impose a prior over the fixed effects. Not used when engine = "lme4".

control

Control settings for the glmer function in lme4. Note that the optimx package is used by default to speed up the estimation. For higher accuracy in the results, the default lme4 optimizers can be used.

Value

An eirm-class list that includes the EIRM formula used for the estimation, estimated parameters in the model, ability estimates for persons and other random effects (if any), and the complete set of results returned from the glmer function. These results can be used for further analysis and graphics based on lme4.

Examples

# \donttest{
data("VerbAgg")
mod0 <- eirm(formula = "r2 ~ -1 + situ + btype + (1|id)", data = VerbAgg)
print(mod0) # To get easiness parameters
#> EIRM formula: "r2 ~ -1 + situ + btype + (1|id)" 
#> 
#> Number of persons: 316 
#> 
#> Number of observations: 7584 
#> 
#> Number of predictors: 4 
#> 
#> Parameter Estimates:
#> 
#>              Easiness       S.E.    z-value       p-value
#> situother   1.3757776 0.09409460  14.621217  2.056918e-48
#> situself    0.3711422 0.09134751   4.062971  4.845215e-05
#> btypescold -1.0310191 0.06714884 -15.354234  3.318058e-53
#> btypeshout -1.9956435 0.07178245 -27.801272 4.186816e-170
#> 
#> Note: The estimated parameters above represent 'easiness'.
#> Use difficulty = TRUE to get difficulty parameters.
print(mod0, difficulty = TRUE) # To get difficulty parameters
#> EIRM formula: "r2 ~ -1 + situ + btype + (1|id)" 
#> 
#> Number of persons: 316 
#> 
#> Number of observations: 7584 
#> 
#> Number of predictors: 4 
#> 
#> Parameter Estimates:
#> 
#>            Difficulty       S.E.    z-value       p-value
#> situother  -1.3757776 0.09409460  14.621217  2.056918e-48
#> situself   -0.3711422 0.09134751   4.062971  4.845215e-05
#> btypescold  1.0310191 0.06714884 -15.354234  3.318058e-53
#> btypeshout  1.9956435 0.07178245 -27.801272 4.186816e-170
#> 
#> Note: The estimated parameters above represent 'difficulty'.
plot(mod0)

mod1 <- eirm(formula = "r2 ~ -1 + situ + btype + mode + (1|id)", data = VerbAgg)
print(mod1) # To get easiness parameters
#> EIRM formula: "r2 ~ -1 + situ + btype + mode + (1|id)" 
#> 
#> Number of persons: 316 
#> 
#> Number of observations: 7584 
#> 
#> Number of predictors: 5 
#> 
#> Parameter Estimates:
#> 
#>              Easiness       S.E.   z-value       p-value
#> situother   1.7437027 0.10145090  17.18765  3.285796e-66
#> situself    0.7158127 0.09775376   7.32261  2.431943e-13
#> btypescold -1.0551642 0.06803581 -15.50895  3.017583e-54
#> btypeshout -2.0421978 0.07292877 -28.00263 1.509082e-172
#> modedo     -0.6715770 0.05621055 -11.94753  6.688613e-33
#> 
#> Note: The estimated parameters above represent 'easiness'.
#> Use difficulty = TRUE to get difficulty parameters.
print(mod1, difficulty = TRUE) # To get difficulty parameters
#> EIRM formula: "r2 ~ -1 + situ + btype + mode + (1|id)" 
#> 
#> Number of persons: 316 
#> 
#> Number of observations: 7584 
#> 
#> Number of predictors: 5 
#> 
#> Parameter Estimates:
#> 
#>            Difficulty       S.E.   z-value       p-value
#> situother  -1.7437027 0.10145090  17.18765  3.285796e-66
#> situself   -0.7158127 0.09775376   7.32261  2.431943e-13
#> btypescold  1.0551642 0.06803581 -15.50895  3.017583e-54
#> btypeshout  2.0421978 0.07292877 -28.00263 1.509082e-172
#> modedo      0.6715770 0.05621055 -11.94753  6.688613e-33
#> 
#> Note: The estimated parameters above represent 'difficulty'.
plot(mod1)

# }