With Diagnostic Classification Models
W. Jake Thompson, Ph.D.
All materials are available on the workshop website:
For help installing RStan, CmdStanR, or configuring the toolchain, see the prework page (https://learn.r-dcm.org/materials/prework).




| songwriting | production | vocals | |
|---|---|---|---|
| songwriting | production | vocals | |
|---|---|---|---|
| songwriting | production | vocals | |
|---|---|---|---|

Success depends on:
When the goal is to place individuals on a scale
DCMs do not distinguish within classes
| songwriting | production | vocals | |
|---|---|---|---|

library(dcmdata)
ecpe_data
#> # A tibble: 2,922 × 29
#> resp_id E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11
#> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1 1 1 1 1 0 1 1 1 1 1 1 1
#> 2 2 1 1 1 1 1 1 1 1 1 1 1
#> 3 3 1 1 1 1 1 1 0 1 1 1 1
#> 4 4 1 1 1 1 1 1 1 1 1 1 1
#> 5 5 1 1 1 1 1 1 1 1 1 1 1
#> 6 6 1 1 1 1 1 1 1 1 1 1 1
#> 7 7 1 1 1 1 1 1 1 1 1 1 1
#> 8 8 0 1 1 1 1 1 0 1 1 1 0
#> 9 9 1 1 1 1 1 1 1 1 1 1 1
#> 10 10 1 1 1 1 0 0 1 1 1 1 1
#> # ℹ 2,912 more rows
#> # ℹ 17 more variables: E12 <int>, E13 <int>, E14 <int>, E15 <int>, E16 <int>,
#> # E17 <int>, E18 <int>, E19 <int>, E20 <int>, E21 <int>, E22 <int>,
#> # E23 <int>, E24 <int>, E25 <int>, E26 <int>, E27 <int>, E28 <int>Open exercises.Rmd
Run the setup chunk
Explore the ROAR-PA data and Q-matrix
roarpa_data
#> # A tibble: 222 × 58
#> id fsm_01 fsm_04 fsm_05 fsm_06 fsm_07 fsm_08 fsm_10 fsm_11 fsm_12 fsm_14
#> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1 161 0 1 1 1 1 0 0 1 1 1
#> 2 226 0 1 0 1 0 0 1 0 1 0
#> 3 103 0 1 0 1 0 0 0 0 0 0
#> 4 7 1 1 0 0 1 0 0 0 1 1
#> 5 185 1 1 1 1 1 1 1 1 1 1
#> 6 36 1 1 1 1 1 1 1 1 1 1
#> 7 206 1 1 1 1 1 1 1 1 1 1
#> 8 115 1 1 1 1 1 1 1 1 1 1
#> 9 106 1 1 1 1 1 1 1 1 1 1
#> 10 205 1 1 1 1 0 0 1 1 1 1
#> # ℹ 212 more rows
#> # ℹ 47 more variables: fsm_15 <int>, fsm_16 <int>, fsm_17 <int>, fsm_18 <int>,
#> # fsm_21 <int>, fsm_22 <int>, fsm_23 <int>, fsm_24 <int>, fsm_25 <int>,
#> # lsm_01 <int>, lsm_02 <int>, lsm_04 <int>, lsm_05 <int>, lsm_06 <int>,
#> # lsm_07 <int>, lsm_08 <int>, lsm_10 <int>, lsm_11 <int>, lsm_13 <int>,
#> # lsm_15 <int>, lsm_16 <int>, lsm_17 <int>, lsm_18 <int>, lsm_19 <int>,
#> # lsm_20 <int>, lsm_21 <int>, lsm_22 <int>, lsm_24 <int>, del_01 <int>, …fsm)lsm)del)Specify a DCM with dcm_specify()
Create a model specification for the ROAR-PA data
Use lcdm() for the measurement model and unconstrained() for the structural model
Estimate a DCM with dcm_estimate()
dcm_estimate() optionsmethod: How to estimate the model
...: Additional arguments that are passed to, depending on the method and backend19891213measr_extract(ecpe_lcdm, "strc_param")
#> # A tibble: 8 × 5
#> class morphosyntactic cohesive lexical estimate
#> <chr> <int> <int> <int> <rvar[1d]>
#> 1 [0,0,0] 0 0 0 0.291 ± 0.00588
#> 2 [1,0,0] 1 0 0 0.018 ± 0.00198
#> 3 [0,1,0] 0 1 0 0.020 ± 0.00117
#> 4 [0,0,1] 0 0 1 0.133 ± 0.00517
#> 5 [1,1,0] 1 1 0 0.015 ± 0.00253
#> 6 [1,0,1] 1 0 1 0.020 ± 0.00097
#> 7 [0,1,1] 0 1 1 0.154 ± 0.00909
#> 8 [1,1,1] 1 1 1 0.350 ± 0.00487measr_extract(ecpe_lcdm, "attribute_prob")
#> # A tibble: 2,922 × 4
#> resp_id morphosyntactic cohesive lexical
#> <chr> <dbl> <dbl> <dbl>
#> 1 1 0.997 0.951 1.000
#> 2 2 0.995 0.866 1.000
#> 3 3 0.976 0.987 1.000
#> 4 4 0.998 0.990 1.000
#> 5 5 0.990 0.979 0.944
#> 6 6 0.993 0.989 1.000
#> 7 7 0.993 0.989 1.000
#> 8 8 0.00208 0.403 0.973
#> 9 9 0.953 0.984 0.998
#> 10 10 0.701 0.0932 0.0847
#> # ℹ 2,912 more rowsWhat proportion of respondents have mastered both first and last sound matching in the ROAR-PA data?
What is the probability that respondent 153 has mastered deletion?
measr_extract(roarpa_lcdm, "strc_param")
#> # A tibble: 8 × 5
#> class lsm del fsm estimate
#> <chr> <int> <int> <int> <rvar[1d]>
#> 1 [0,0,0] 0 0 0 0.158 ± 0.0269
#> 2 [1,0,0] 1 0 0 0.011 ± 0.0083
#> 3 [0,1,0] 0 1 0 0.047 ± 0.0169
#> 4 [0,0,1] 0 0 1 0.059 ± 0.0198
#> 5 [1,1,0] 1 1 0 0.037 ± 0.0151
#> 6 [1,0,1] 1 0 1 0.042 ± 0.0162
#> 7 [0,1,1] 0 1 1 0.099 ± 0.0228
#> 8 [1,1,1] 1 1 1 0.546 ± 0.0400
measr_extract(roarpa_lcdm, "strc_param") |>
filter(fsm == 1, lsm == 1) |>
summarize(estimate = rvar_sum(estimate))
#> # A tibble: 1 × 1
#> estimate
#> <rvar[1d]>
#> 1 0.59 ± 0.039We value your feedback! To answer a short survey about and provide feedback on the {measr} package, please follow this link to a Qualtrics survey.
ATLAS at the University of Kansas is conducting research to better understand the software development process for {measr}. Individuals who have used the {measr} package and are at least 18 years of age are invited to complete a 5-minute survey on their experiences. For questions, please contact Jake Thompson at wjakethompson@ku.edu.
The research reported here was supported by the Institute of Education Sciences, U.S. Department of Education, through Grants R305D210045 and R305D240032 to the University of Kansas Center for Research, Inc., ATLAS. The opinions expressed are those of the authors and do not represent the views of the the Institute or the U.S. Department of Education.
