knitr::opts_chunk$set(echo = TRUE)
library(GDINA)


# A simulated data in GDINA package
dat <- sim10GDINA$simdat
Q <- sim10GDINA$simQ

# Fit LCDM model - see Example 13a in GDINA help page also
est <- GDINA(dat = dat, Q = Q, model = "logitGDINA")

#####################################
#
#      Summary Information
# 
#####################################


# print estimation information
est

# summary information
summary(est)

AIC(est) #AIC
BIC(est) #BIC
logLik(est) #log-likelihood value
deviance(est) # deviance: -2 log-likelihood
npar(est) # number of parameters
nobs(est) # number of observations

# discrimination indices
extract(est, "discrim")

#####################################
#
#      structural parameters
# 
#####################################
coef(est) # item probabilities of success for each reduced latent class
coef(est, withSE = TRUE) # item probabilities of success & standard errors
coef(est, what = "delta") # delta parameters
coef(est, what = "delta", withSE = TRUE) # delta parameters
coef(est, what = "gs") # guessing and slip parameters
coef(est, what = "gs", withSE = TRUE) # guessing and slip parameters & standard errors
# Estimated proportions of latent classes
coef(est,"lambda")
# success probabilities for each latent class
coef(est,"LCprob")

#####################################
#
#      person parameters
# 
#####################################
head(personparm(est)) # EAP estimates of attribute profiles
head(personparm(est, what = "MAP")) # MAP estimates of attribute profiles
head(personparm(est, what = "MLE")) # MLE estimates of attribute profiles

#####################################
#
#           Plots
# 
#####################################

#plot item response functions for item 10
plot(est, item = 10)
plot(est, item = 10, withSE = TRUE) # with error bars
#plot mastery probability for individuals 1, 20 and 50
plot(est, what = "mp", person = c(1, 20, 50))

#####################################
#
#      Advanced elements
# 
#####################################

head(indlogLik(est)) # individual log-likelihood
head(indlogPost(est)) # individual log-posterior
extract(est,"designmatrix") #design matrix
extract(est,"linkfunc") #link functions

sessionInfo()


Wenchao-Ma/GDINA documentation built on Nov. 13, 2022, 5:35 a.m.