R version 4.4.0 beta (2024-04-12 r86413 ucrt) -- "Puppy Cup" 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.6; 2024-04-14) > > ## generate Q-matrix and data > K <- 5 > 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: 5 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 1.5 b = 0 1.5 0.75 -1.5 -0.75 > > ## 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.37783 Deviance = 12040.337 Iter = 2 Max. abs. change = 0.20636 Deviance = 10202.389 Iter = 3 Max. abs. change = 0.06815 Deviance = 10032.282 Iter = 4 Max. abs. change = 0.02053 Deviance = 9999.089 Iter = 5 Max. abs. change = 0.02421 Deviance = 9988.692 Iter = 6 Max. abs. change = 0.02554 Deviance = 9983.338 Iter = 7 Max. abs. change = 0.02513 Deviance = 9979.807 Iter = 8 Max. abs. change = 0.02353 Deviance = 9977.140 Iter = 9 Max. abs. change = 0.02123 Deviance = 9974.912 Iter = 10 Max. abs. change = 0.01857 Deviance = 9972.874 Iter = 11 Max. abs. change = 0.01584 Deviance = 9970.840 Iter = 12 Max. abs. change = 0.01328 Deviance = 9968.645 Iter = 13 Max. abs. change = 0.01213 Deviance = 9966.168 Iter = 14 Max. abs. change = 0.01156 Deviance = 9963.416 Iter = 15 Max. abs. change = 0.01339 Deviance = 9960.595 Iter = 16 Max. abs. change = 0.01508 Deviance = 9957.987 Iter = 17 Max. abs. change = 0.01551 Deviance = 9955.740 Iter = 18 Max. abs. change = 0.01436 Deviance = 9953.856 Iter = 19 Max. abs. change = 0.01166 Deviance = 9952.311 Iter = 20 Max. abs. change = 0.00813 Deviance = 9951.116 Iter = 21 Max. abs. change = 0.00498 Deviance = 9950.268 Iter = 22 Max. abs. change = 0.00286 Deviance = 9949.707 Iter = 23 Max. abs. change = 0.00166 Deviance = 9949.343 Iter = 24 Max. abs. change = 0.00108 Deviance = 9949.106 Iter = 25 Max. abs. change = 0.00080 Deviance = 9948.949 Iter = 26 Max. abs. change = 0.00068 Deviance = 9948.843 Iter = 27 Max. abs. change = 0.00057 Deviance = 9948.771 Iter = 28 Max. abs. change = 0.00049 Deviance = 9948.721 Iter = 29 Max. abs. change = 0.00041 Deviance = 9948.686 Iter = 30 Max. abs. change = 0.00035 Deviance = 9948.661 Iter = 31 Max. abs. change = 0.00030 Deviance = 9948.643 Iter = 32 Max. abs. change = 0.00025 Deviance = 9948.630 Iter = 33 Max. abs. change = 0.00022 Deviance = 9948.620 Iter = 34 Max. abs. change = 0.00018 Deviance = 9948.612 Iter = 35 Max. abs. change = 0.00016 Deviance = 9948.606 Iter = 36 Max. abs. change = 0.00014 Deviance = 9948.602 Iter = 37 Max. abs. change = 0.00012 Deviance = 9948.598 Iter = 38 Max. abs. change = 0.00010 Deviance = 9948.595 Iter = 39 Max. abs. change = 0.00009 Deviance = 9948.593 > > ## 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, 10 items have changed, delta PVAF=2.22736 > > > ## 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, 10 items have changed, delta PVAF=2.22736 > > ## 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=2.22736 Iter=2/150, 1 items have changed, delta PVAF=1.48042 Iter=3/150, 1 items have changed, delta PVAF=0.87168 Iter=4/150, 1 items have changed, delta PVAF=0.28015 Iter=5/150, 1 items have changed, delta PVAF=0.18579 Iter=6/150, 1 items have changed, delta PVAF=0.34609 Iter=7/150, 1 items have changed, delta PVAF=0.03373 > > ## 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, 11 items have changed, delta PVAF=2.30401 > > ## 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, 7 items have changed, delta PVAF=2.07527 > > ## check QRR > print(getQRR(example.Q, Q.GDI.obj$Q.sug)) [1] 0.93 > > > proc.time() user system elapsed 8.51 0.26 8.76