Diagnostic classification models (DCMs) are a class of psychometric models that estimate respondent abilities as a profile of proficiency on a pre-defined set of skills, or attributes. Despite the utility of DCMs for providing fine-grained and actionable feedback with shorter assessments, they have are not widely used in applied settings, in part due to a lack of user-friendly software. Using R and Stan, measr (said: “measure”) simplifies the process of estimating and evaluating DCMs. Users can specify different DCM subtypes, define prior distributions, and estimate the model using the rstan or cmdstanr interface to Stan. You can then easily examine model parameters, calculate model fit metrics, compare competing models, and evaluate the reliability of the attributes.

You can install the released version of measr from CRAN with:

To install the development version of measr from GitHub use:

Because measr is based on Stan, a C++ compiler is required. For Windows, the Rtools program comes with a C++ compiler. On Mac, it’s recommended that you install Xcode. For additional instructions and help setting up the compilers, see the RStan installation help page.

We can estimate a DCM using `measr_dcm()`

. This function only requires a data set of item responses and a Q-matrix defining which attributes are measured by each item. We also identify any respondent or item identifier columns. Other arguments can be specified to customize the type of model to estimates (see `?measr_dcm()`

).

To demonstrate measr’s functionality, example data sets are included. Here we use the Examination of Certificate of Proficiency in English (ECPE; Templin & Hoffman, 2013) data (see `?ecpe`

for details). Note that by default, measr uses a full Markov chain Monte Carlo (MCMC) estimation with Stan, which can be time and computationally intensive. For a quicker estimation, we can use Stan’s optimizer instead of MCMC by adding `method = "optim"`

to the function call. However, please not that some functionality will be lost when using the optimizer (e.g., the calculation of relative fit criteria requires the use of MCMC).

```
library(measr)
model <- measr_dcm(data = ecpe_data, resp_id = "resp_id",
qmatrix = ecpe_qmatrix, item_id = "item_id")
```

Once a model has been estimated, we can then add and evaluate model fit. This can done through absolute model fit, relative model fit (information criteria), or reliability indices. Model parameters, respondent classifications, and results of the model fit analyses can then be extracted using `measr_extract()`

.

```
model <- add_fit(model, method = "m2")
model <- add_criterion(model, criterion = "loo")
model <- add_reliability(model)
measr_extract(model, "m2")
#> # A tibble: 1 × 3
#> m2 df pval
#> <dbl> <int> <dbl>
#> 1 506. 325 4.37e-10
```

Contributions are welcome. To ensure a smooth process, please review the Contributing Guide. Please note that the measr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.