## Not run:
# #############################################################################
# # EXAMPLE 1: DINA model sim.dina
# #############################################################################
#
# data(sim.dina)
# data(sim.qmatrix)
# dat <- sim.dina
#
# #****** Model 1: (Ordinary) DINA Model
# mod1 <- din( dat , q.matr = sim.qmatrix, rule = "DINA")
# # look at parameter table of the model
# mod1$partable
# # covariance matrix
# covmat1 <- vcov(mod1 )
# # extract coefficients
# coef(mod1)
# # extract standard errors
# sqrt( diag( covmat1))
# # compute confidence intervals
# confint( mod1 , level=.90 )
# # output table with standard errors
# IRT.se( mod1 , extended=TRUE )
#
# #****** Model 2: Constrained DINA Model
#
# # fix some slipping parameters
# constraint.slip <- cbind( c(2,3,5) , c(.15,.20,.25) )
# # set some skill class probabilities to zero
# zeroprob.skillclasses <- c(2,4)
# # estimate model
# mod2 <- din( dat , q.matr = sim.qmatrix, guess.equal=TRUE ,
# constraint.slip=constraint.slip, zeroprob.skillclasses=zeroprob.skillclasses)
# # parameter table
# mod2$partable
# # freely estimated coefficients
# coef(mod2)
# # covariance matrix (estimated parameters)
# vmod2a <- vcov(mod2)
# sqrt( diag( vmod2a)) # standard errors
# colnames( vmod2a )
# names( attr( vmod2a , "coef") ) # extract coefficients
#
# # covariance matrix (more parameters, extended=TRUE)
# vmod2b <- vcov(mod2 , extended=TRUE)
# sqrt( diag( vmod2b))
# attr( vmod2b , "coef")
# # attach standard errors to parameter table
# partable2 <- mod2$partable
# partable2 <- partable2[ ! duplicated( partable2$parnames ) , ]
# partable2 <- data.frame( partable2 , "se" = sqrt( diag( vmod2b)) )
# partable2
#
# # confidence interval for parameter "skill1" which is not in the model
# # cannot be calculated!
# confint(mod2 , parm= c( "skill1" , "all_guess" ) )
# # confidence interval for only some parameters
# confint(mod2 , parm=paste0("prob_skill" , 1:3 ) )
#
# # compute only information matrix
# infomod2 <- vcov(mod2 , infomat=TRUE)
# ## End(Not run)
Run the code above in your browser using DataLab