View source: R/resp_groupwise.R
resp_groupwise | R Documentation |
Creates group-wise item response dataset.
resp_groupwise(resp, group, items_group)
resp |
Dataset with item responses |
group |
Vector of group identifiers |
items_group |
List containing vectors of groups for each item which should be made group-specific |
Dataset
## Not run:
#############################################################################
# EXAMPLE 1: Toy dataset
#############################################################################
library(CDM)
library(TAM)
data(data.ex11, package="TAM")
dat <- data.ex11
dat[ dat==9 ] <- 0
resp <- dat[,-1]
# group labels
booklets <- sort( unique(paste(dat$booklet)))
#- fit initial model
mod0 <- TAM::tam.mml( resp, group=dat$booklet)
summary(mod0)
# fit statistics
fmod <- IRT.RMSD(mod)
stat <- abs(fmod$MD[,-1])
stat[ is.na( fmod$RMSD[,2:4] ) ] <- NA
thresh <- .01
round(stat,3)
# define list define groups for group-specific items
items_group <- apply( stat, 1, FUN=function(ll){
v1 <- booklets[ which( ll > thresh ) ]
v1[ ! is.na(v1) ] } )
#- create extended response dataset
dat2 <- sirt::resp_groupwise(resp=resp, group=paste(dat$booklet), items_group=items_group)
colSums( ! is.na(dat2) )
#- fit model for extended response dataset
mod2 <- TAM::tam.mml( dat2, group=dat$booklet)
summary(mod2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.