if (FALSE) {
#############################################################################
# EXAMPLE 1: Multiple choice data data.mc
#############################################################################
data(data.mc)
# estimate Rasch model for scored data.mc data
mod <- TAM::tam.mml( resp=data.mc$scored )
# estimate WLE
w1 <- TAM::tam.wle( mod )
# estimate plausible values
set.seed(789)
p1 <- TAM::tam.pv( mod, ntheta=500, normal.approx=TRUE )$pv
# CTT results for raw data
stat1 <- TAM::tam.ctt( resp=data.mc$raw, wlescore=w1$theta, pvscores=p1[,-1] )
stat1a <- TAM::tam.ctt2( resp=data.mc$raw, wlescore=w1$theta ) # faster
stat1b <- TAM::tam.ctt2( resp=data.mc$raw ) # only frequencies
stat1c <- TAM::tam.ctt3( resp=data.mc$raw, wlescore=w1$theta ) # faster
# plot empirical item response curves
plotctt( resp=data.mc$raw, theta=w1$theta, Ncuts=5, ask=TRUE)
# use graphics for plot
plotctt( resp=data.mc$raw, theta=w1$theta, Ncuts=5, ask=TRUE, package="graphics")
# change colors
col.list <- c( "darkred", "darkslateblue", "springgreen4", "darkorange",
"hotpink4", "navy" )
plotctt( resp=data.mc$raw, theta=w1$theta, Ncuts=5, ask=TRUE,
package="graphics", col.list=col.list )
# CTT results for scored data
stat2 <- TAM::tam.ctt( resp=data.mc$scored, wlescore=w1$theta, pvscores=p1[,-1] )
# descriptive statistics for different groups
# define group identifier
group <- c( rep(1,70), rep(2,73) )
stat3 <- TAM::tam.ctt( resp=data.mc$raw, wlescore=w1$theta, pvscores=p1[,-1], group=group)
stat3a <- TAM::tam.ctt2( resp=data.mc$raw, wlescore=w1$theta, group=group)
}
Run the code above in your browser using DataLab