measr_dcm {measr} | R Documentation |
Fit Bayesian diagnostic classification models
Description
Estimate diagnostic classification models (DCMs; also known as cognitive diagnostic models) using 'Stan'. Models can be estimated using Stan's optimizer, or full Markov chain Monte Carlo (MCMC).
Usage
measr_dcm(
data,
missing = NA,
qmatrix,
resp_id = NULL,
item_id = NULL,
type = c("lcdm", "dina", "dino", "crum"),
max_interaction = Inf,
attribute_structure = c("unconstrained", "independent"),
method = c("mcmc", "optim"),
prior = NULL,
backend = getOption("measr.backend", "rstan"),
file = NULL,
file_refit = getOption("measr.file_refit", "never"),
...
)
Arguments
data |
Response data. A data frame with 1 row per respondent and 1 column per item. |
missing |
An R expression specifying how missing data in |
qmatrix |
The Q-matrix. A data frame with 1 row per item and 1 column per attribute. All cells should be either 0 (item does not measure the attribute) or 1 (item does measure the attribute). |
resp_id |
Optional. Variable name of a column in |
item_id |
Optional. Variable name of a column in |
type |
Type of DCM to estimate. Must be one of lcdm, dina, dino, or crum. |
max_interaction |
If |
attribute_structure |
Structural model specification. Must be one of
unconstrained, or independent.
|
method |
Estimation method. Options are |
prior |
A measrprior object. If |
backend |
Character string naming the package to use as the backend for
fitting the Stan model. Options are |
file |
Either |
file_refit |
Controls when a saved model is refit. Options are
|
... |
Additional arguments passed to Stan.
|
Value
A measrfit object.
Examples
rstn_mdm_lcdm <- measr_dcm(
data = mdm_data, missing = NA, qmatrix = mdm_qmatrix,
resp_id = "respondent", item_id = "item", type = "lcdm",
method = "optim", seed = 63277, backend = "rstan"
)