| GPCMlasso | R Documentation |
Fits generalized partial credit models and related ordinal item response models with optional explanatory variables. The function can be used for differential item functioning (DIF) detection and for explanatory item response modelling with global and item-specific covariate effects.
GPCMlasso(
formula,
data,
DSF = FALSE,
model = c("PCM", "RSM", "GPCM", "GRSM", "RM", "2PL"),
control = ctrl_GPCMlasso(),
cv = FALSE,
main.effects = TRUE
)
formula |
Formula specifying the item responses and optional covariates.
Item responses must be supplied on the left-hand side using |
data |
Data frame containing the ordinal item response data and all covariates. |
DSF |
Logical. Should differential step functioning (DSF) be considered?
If |
model |
Character string specifying the underlying item response model.
Available options are |
control |
Control object specifying algorithmic and numerical
optimization options, usually created by |
cv |
Logical. Should cross-validation be performed? Cross-validation can be used for tuning parameter selection. |
main.effects |
Logical. Should global covariate effects be included for
models with covariates? Additional item-specific effects can be enabled via
|
A joint parametric model is set up based on an item response model chosen by the user. Several covariates can be considered simultaneously. For DIF models, item-specific covariate effects are introduced and selected by a lasso-type penalty. For explanatory GPCM-X models, global covariate effects and item-specific deviations can be included, and fusion penalties can be used to cluster item-specific effects referring to the same covariate.
An object of class "GPCMlasso", a list containing:
coefficients |
Matrix of estimated parameters, one row per tuning parameter value. |
logLik |
Vector of log-likelihood values, one per tuning parameter. |
cv_error |
Vector of cross-validation errors. Only relevant if
|
call |
The matched function call. |
model |
The selected item response model. |
data |
The data used for model fitting. |
control |
The control list used for model fitting. |
DSF |
Logical value indicating whether DSF was used. |
formula |
The model formula. |
item.names |
Item names. |
Y |
Matrix containing the item responses. |
design_list |
List of design matrices and auxiliary objects used internally. |
AIC |
Vector of AIC values, one per tuning parameter. |
BIC |
Vector of BIC values, one per tuning parameter. |
cAIC |
Vector of corrected AIC values, one per tuning parameter. |
df |
Vector of degrees of freedom, one per tuning parameter. |
coef.rescal |
Matrix of parameters rescaled to their original scales. |
main.effects |
Logical value indicating whether global covariate effects were included. |
scale_cols |
Internal indicator specifying which design columns are multiplied by item discrimination parameters. |
Gunther Schauberger
gunther.schauberger@tum.de
Schauberger, G. and Mair, P. (2020). A regularization approach for the detection of differential item functioning in generalized partial credit models. Behavior Research Methods, 52, 279–294. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3758/s13428-019-01224-2")}
GPCMlasso-package,
ctrl_GPCMlasso,
plot.GPCMlasso,
predict.GPCMlasso,
trait.posterior
data(tenseness_small)
## Response formula with five ordinal items
form_items <- as.formula(
paste(
"cbind(",
paste(colnames(tenseness_small)[1:5], collapse = ","),
") ~ 0"
)
)
## Formula including covariates
form_cov <- as.formula(
paste(
"cbind(",
paste(colnames(tenseness_small)[1:5], collapse = ","),
") ~ Gender + Age"
)
)
## Not run:
## ------------------------------------------------------------
## Example 1: Classical DIF analysis as in Schauberger and Mair
## ------------------------------------------------------------
##
## A GPCM is fitted with item-specific covariate effects.
## Selected non-zero item-specific effects indicate DIF.
fit_dif <- GPCMlasso(
formula = form_cov,
data = tenseness_small,
model = "GPCM",
control = ctrl_GPCMlasso(
cores = 1,
l.lambda = 10,
trace = FALSE
)
)
fit_dif
summary(fit_dif)
## Plot DIF paths for selected item panels
plot(
fit_dif,
type = "DIF",
panels = 1:2,
panels_per_page = 2,
columns = 2,
ask_new = FALSE
)
## Predicted category probabilities and posterior trait estimates
pred_dif <- predict(fit_dif, type = "response")
theta_dif <- trait.posterior(fit_dif, cores = 1)
## ------------------------------------------------------------
## Example 2: Explanatory GPCM-X with global, item-specific,
## and fused covariate effects
## ------------------------------------------------------------
##
## This model includes global covariate effects and item-specific
## deviations from these global effects. The fusion penalty encourages
## clusters of items with equal covariate effects.
##
## Since information criteria are not uniquely defined for the fusion
## model, cross-validation is used for tuning parameter selection.
set.seed(1860)
fit_fusion <- GPCMlasso(
formula = form_cov,
data = tenseness_small,
model = "GPCM",
main.effects = TRUE,
cv = TRUE,
control = ctrl_GPCMlasso(
cores = 1,
l.lambda = 10,
folds = 2,
penalize.main.effects = TRUE,
include.item.effects = TRUE,
fuse.per.variable = TRUE,
scale.covariate.effects = FALSE,
trace = FALSE
)
)
fit_fusion
## Summary on the interpretable response-effect scale
summary(
fit_fusion,
effect.scale = "effect"
)
## Available variable panels
fit_fusion$design_list$x.names
## Plot covariate effect paths for all available covariate panels
plot(
fit_fusion,
type = "Variable",
panels = fit_fusion$design_list$x.names,
panels_per_page = 2,
columns = 2,
variable.scale = "effect",
select = "cv",
ask_new = FALSE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.