R Under development (unstable) (2024-01-31 r85845 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ################################################################ > # Example 1 # > # The GDI method to validate Q-matrix # > ################################################################ > set.seed(123) > > library(Qval) Qval R Package (version 0.1.2; 2024-02-01) > > ## generate Q-matrix and data > K <- 4 > I <- 20 > example.Q <- sim.Q(K, I) > IQ <- list( + P0 = runif(I, 0.0, 0.2), + P1 = runif(I, 0.8, 1.0) + ) > example.data <- sim.data(Q = example.Q, N = 500, IQ = IQ, model = "GDINA", distribute = "horder") distribute = horder model = GDINA number of attributes: 4 number of items: 20 num of examinees: 500 average of P0 = 0.085 average of P1 = 0.898 theta_mean = -0.06 , theta_sd = 0.996 a = 1.5 1.5 1.5 1.5 b = 0.5 1.5 -1.5 -0.5 > > ## simulate random mis-specifications > example.MQ <- sim.MQ(example.Q, 0.1) rate of mis-specifications 0.1 rate of over-specifications = 0.01 rate of under-specifications = 0.09 > > ## using MMLE/EM to fit CDM model first > example.CDM.obj <- CDM(example.data$dat, example.MQ) Iter = 1 Max. abs. change = 0.48443 Deviance = 11093.48 Iter = 2 Max. abs. change = 0.13558 Deviance = 9693.66 Iter = 3 Max. abs. change = 0.08718 Deviance = 9644.69 Iter = 4 Max. abs. change = 0.04002 Deviance = 9631.28 Iter = 5 Max. abs. change = 0.03262 Deviance = 9624.26 Iter = 6 Max. abs. change = 0.02697 Deviance = 9619.79 Iter = 7 Max. abs. change = 0.02181 Deviance = 9616.73 Iter = 8 Max. abs. change = 0.01687 Deviance = 9614.64 Iter = 9 Max. abs. change = 0.01236 Deviance = 9613.25 Iter = 10 Max. abs. change = 0.00698 Deviance = 9612.39 Iter = 11 Max. abs. change = 0.00503 Deviance = 9611.89 Iter = 12 Max. abs. change = 0.00372 Deviance = 9611.64 Iter = 13 Max. abs. change = 0.00271 Deviance = 9611.51 Iter = 14 Max. abs. change = 0.00196 Deviance = 9611.45 Iter = 15 Max. abs. change = 0.00142 Deviance = 9611.42 Iter = 16 Max. abs. change = 0.00102 Deviance = 9611.40 Iter = 17 Max. abs. change = 0.00087 Deviance = 9611.39 Iter = 18 Max. abs. change = 0.00054 Deviance = 9611.38 Iter = 19 Max. abs. change = 0.00038 Deviance = 9611.38 Iter = 20 Max. abs. change = 0.00027 Deviance = 9611.38 Iter = 21 Max. abs. change = 0.00020 Deviance = 9611.38 Iter = 22 Max. abs. change = 0.00014 Deviance = 9611.38 Iter = 23 Max. abs. change = 0.00010 Deviance = 9611.38 Iter = 24 Max. abs. change = 0.00008 Deviance = 9611.38 > > ## using the fitted CDM.obj to avoid extra parameter estimation. > Q.GDI.obj <- validation(example.data$dat, example.MQ, example.CDM.obj, method = "GDI") GDI method with PAA in test level iteration ... Iter=1/1, 6 items have changed, delta PVAF=0.82173 > > > ## also can validate the Q-matrix directly > Q.GDI.obj <- validation(example.data$dat, example.MQ) GDI method with PAA in test level iteration ... Iter=1/1, 6 items have changed, delta PVAF=0.82173 > > ## item level iteration > Q.GDI.obj <- validation(example.data$dat, example.MQ, method = "GDI", iter.level = "item", maxitr = 150) GDI method with PAA in item level iteration ... Iter=1/150, 1 items have changed, delta PVAF=0.82173 Iter=2/150, 1 items have changed, delta PVAF=0.52167 > > ## search method > Q.GDI.obj <- validation(example.data$dat, example.MQ, method = "GDI", search.method = "ESA") GDI method with ESA in test level iteration ... Iter=1/1, 6 items have changed, delta PVAF=0.82184 > > ## cut-off point > Q.GDI.obj <- validation(example.data$dat, example.MQ, method = "GDI", eps = 0.90) GDI method with PAA in test level iteration ... Iter=1/1, 6 items have changed, delta PVAF=0.82122 > > ## check QRR > print(getQRR(example.Q, Q.GDI.obj$Q.sug)) [1] 0.925 > > proc.time() user system elapsed 15.62 0.56 16.15