Calculate relative fit indices (-2LL, AIC, BIC, CAIC, SABIC) and absolute fit indices (\(M_2\) test) using the testfit function in the GDINA package.

fit(Y, Q, model = "GDINA")

Arguments

Y

A required N × I matrix or data.frame consisting of the responses of N individuals to I items. Missing values should be coded as NA.

Q

A required binary I × K matrix containing the attributes not required or required , coded as 0 or 1, to master the items. The ith row of the matrix is a binary indicator vector indicating which attributes are not required (coded as 0) and which attributes are required (coded as 1) to master item i.

model

Type of model to be fitted; can be "GDINA", "LCDM", "DINA", "DINO", "ACDM", "LLM", or "rRUM". Default = "GDINA".

Value

An object of class list. The list contains various fit indices:

npar

The number of parameters.

-2LL

The Deviance.

AIC

The Akaike information criterion.

BIC

The Bayesian information criterion.

CAIC

The consistent Akaike information criterion.

SABIC

The Sample size Adjusted BIC.

M2

A vector consisting of \(M_2\) statistic, degrees of freedom, significance level, and \(RMSEA_2\) (Liu, Tian, & Xin, 2016).

SRMSR

The standardized root mean squared residual (SRMSR; Ravand & Robitzsch, 2018).

References

Khaldi, R., Chiheb, R., & Afa, A.E. (2018). Feed-forward and Recurrent Neural Networks for Time Series Forecasting: Comparative Study. In: Proceedings of the International Conference on Learning and Optimization Algorithms: Theory and Applications (LOPAL 18). Association for Computing Machinery, New York, NY, USA, Article 18, 1–6. DOI: 10.1145/3230905.3230946.

Liu, Y., Tian, W., & Xin, T. (2016). An application of M2 statistic to evaluate the fit of cognitive diagnostic models. Journal of Educational and Behavioral Statistics, 41, 3–26. DOI: 10.3102/1076998615621293.

Ravand, H., & Robitzsch, A. (2018). Cognitive diagnostic model of best choice: a study of reading comprehension. Educational Psychology, 38, 1255–1277. DOI: 10.1080/01443410.2018.1489524.

Author

Haijiang Qin <Haijiang133@outlook.com>

Examples

set.seed(123)

library(Qval)

## generate Q-matrix and data to fit
K <- 5
I <- 30
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:  30 
#>  num of examinees:  500 
#>  average of P0 =  0.102 
#>  average of P1 =  0.905 
#> theta_mean =  -0.064 , theta_sd = 0.994 
#>  a =  1.5 1.5 1.5 1.5 1.5 
#>  b =  0 -0.75 -1.5 1.5 0.75 

## calculate fit indices
fit.indices <- fit(Y = example.data$dat, Q = example.Q, model = "GDINA")
#> 
Iter = 1  Max. abs. change = 0.47924  Deviance  = 15962.63                                                                                  
Iter = 2  Max. abs. change = 0.13841  Deviance  = 13443.96                                                                                  
Iter = 3  Max. abs. change = 0.07686  Deviance  = 13314.35                                                                                  
Iter = 4  Max. abs. change = 0.03944  Deviance  = 13292.46                                                                                  
Iter = 5  Max. abs. change = 0.02354  Deviance  = 13286.48                                                                                  
Iter = 6  Max. abs. change = 0.02056  Deviance  = 13283.80                                                                                  
Iter = 7  Max. abs. change = 0.01822  Deviance  = 13282.25                                                                                  
Iter = 8  Max. abs. change = 0.01478  Deviance  = 13281.32                                                                                  
Iter = 9  Max. abs. change = 0.01097  Deviance  = 13280.79                                                                                  
Iter = 10  Max. abs. change = 0.00756  Deviance  = 13280.47                                                                                  
Iter = 11  Max. abs. change = 0.00494  Deviance  = 13280.26                                                                                  
Iter = 12  Max. abs. change = 0.00311  Deviance  = 13280.13                                                                                  
Iter = 13  Max. abs. change = 0.00191  Deviance  = 13280.04                                                                                  
Iter = 14  Max. abs. change = 0.00116  Deviance  = 13279.97                                                                                  
Iter = 15  Max. abs. change = 0.00070  Deviance  = 13279.93                                                                                  
Iter = 16  Max. abs. change = 0.00048  Deviance  = 13279.89                                                                                  
Iter = 17  Max. abs. change = 0.00038  Deviance  = 13279.87                                                                                  
Iter = 18  Max. abs. change = 0.00030  Deviance  = 13279.85                                                                                  
Iter = 19  Max. abs. change = 0.00024  Deviance  = 13279.83                                                                                  
Iter = 20  Max. abs. change = 0.00019  Deviance  = 13279.82                                                                                  
Iter = 21  Max. abs. change = 0.00016  Deviance  = 13279.81                                                                                  
Iter = 22  Max. abs. change = 0.00013  Deviance  = 13279.80                                                                                  
Iter = 23  Max. abs. change = 0.00011  Deviance  = 13279.79                                                                                  
Iter = 24  Max. abs. change = 0.00009  Deviance  = 13279.79                                                                                  
print(fit.indices)
#> $npar
#> [1] 149
#> 
#> $`-2LL`
#> [1] 13279.78
#> 
#> $AIC
#> [1] 13577.78
#> 
#> $BIC
#> [1] 14205.76
#> 
#> $CAIC
#> [1] 14354.76
#> 
#> $SABIC
#> [1] 13732.82
#> 
#> $M2
#>          M2          df     p.value      RMSEA2 
#> 307.4313228 316.0000000   0.6245266   0.0000000 
#> 
#> $SRMSR
#> [1] 0.02965562
#>