Skip to content

One booklet PC items

tmatta edited this page Oct 17, 2017 · 3 revisions

We examined item parameter recovery under the following conditions: 1 (IRT model) x 3 (IRT R packages) x 3 (sample sizes) x 4 (test lengths) x 1 (test booklet)


  • One IRT model was included: partial credit (PC) model
    • Item parameters were randomly generated
    • The bounds of the item difficulty parameter, b, are constrained to b_bounds = (-2, 2) where -2 is the lowest generating value and 2 is the highest generating value
  • Three IRT R packages were evaluated: TAM (version 2.4-9), mirt (version 1.25), and ltm (version, 1.0-0)
  • Three sample sizes were used: 500, 1000, and 5000
    • Simulated samples were based on one ability level from distribution N(0, 1)
  • Four test lengths were used: 40, 60, 80, and 100
  • A single booklet was used.

  • One hundred replications were used for each condition for the calibration

  • Summary of item parameter recovery:
    • TAM, mirt, and ltm demonstrated a similar level of accuracy
    • b1-parameter recovered well, with correlation ranging from 0.983 to 0.998, with bias ranging from -0.066 to 0.010, and with RMSE ranging from 0.041 to 0.197
    • b2-parameter recovered well, with correlation ranging from 0.985 to 0.999, with bias ranging from -0.049 to 0.021, and with RMSE ranging from 0.041 to 0.194
    • For b1- and b2-parameters, sample sizes of 5000 consistently produced the most accurate results
    • For b1- and b2-parameters, four levels of test lengths performed very similarly

 

# Load libraries
if(!require(lsasim)){  
  install.packages("lsasim")
  library(lsasim) #version 1.0.1
}

if(!require(mirt)){  
  install.packages("mirt")
  library(mirt) #version 1.25
}

if(!require(TAM)){
  install.packages("TAM")
  library(TAM) #version 2.4-9
}

if(!require(ltm)){
  install.packages("ltm")
  library(ltm) #version 1.0-0
}
# Set up conditions
N.cond <- c(500, 1000, 5000) #number of sample sizes
I.cond <- c(40, 60, 80, 100) #number of items 
K.cond  <- 1                 #number of booklets  

# Set up number of replications
reps <- 100

# Create space for outputs
results <- NULL
#==============================================================================#
# START SIMULATION
#==============================================================================#

for (N in N.cond) { #sample size
  
  for (I in I.cond) { #number of items
    
    # generate item parameters for a PC model
    set.seed(4366) # fix item parameters across replications
    item_pool <- lsasim::item_gen(n_1pl = I, 
                                  thresholds = 2, 
                                  b_bounds = c(-2, 2))
    
    for (K in K.cond) { #number of booklets
      
      for (r in 1:reps) { #replication
        
        #------------------------------------------------------------------------------#
        # Data simulation
        #------------------------------------------------------------------------------#
        
        set.seed(8088*(r+4))
        
        # generate thetas
        theta <- rnorm(N, mean=0, sd=1)
        
        # assign items to block
        block_bk1 <- lsasim::block_design(n_blocks = K, 
                                          item_parameters = item_pool)
        
        #assign block to booklet
        book_bk1 <- lsasim::booklet_design(item_block_assignment = 
                                             block_bk1$block_assignment,
                                           book_design = matrix(K))
        #assign booklet to subjects
        book_samp <- lsasim::booklet_sample(n_subj = N, 
                                            book_item_design = book_bk1, 
                                            book_prob = NULL)
        
        # generate item responses
        cog <- lsasim::response_gen(subject = book_samp$subject, 
                                    item = book_samp$item, 
                                    theta = theta, 
                                    b_par = item_pool$b,
                                    d_par = list(item_pool$d1,
                                                 item_pool$d2))
        
        # extract item responses (excluding "subject" column)
        resp <- cog[, c(1:I)]
        
        #------------------------------------------------------------------------------#
        # Item calibration
        #------------------------------------------------------------------------------#
        
        # fit PC model using mirt package
        mirt.mod <- NULL
        mirt.mod <- mirt::mirt(resp, 1, itemtype = 'Rasch', verbose = F, 
                               technical = list( NCYCLES = 500))

        # fit PC model using TAM package
        tam.mod <- NULL
        tam.mod <- TAM::tam.mml(resp, irtmodel = "PCM2", control = list(maxiter = 200))
        
        # fit PC model using ltm package
        ltm.mod <- NULL
        ltm.mod <- ltm::gpcm(resp, constraint = "rasch", IRT.param=T, 
                             control = list(iter.qN = 1000))
        
        #------------------------------------------------------------------------------#
        # Item parameter extraction
        #------------------------------------------------------------------------------#
        
        # extract b1, b2 in mirt package
        mirt_b1 <- coef(mirt.mod, IRTpars = TRUE, simplify=TRUE)$items[,"b1"]
        mirt_b2 <- coef(mirt.mod, IRTpars = TRUE, simplify=TRUE)$items[,"b2"]
        
        # convert TAM output into PCM parametrization
        tam_b1 <- tam.mod$item$AXsi_.Cat1
        tam_b2 <- (tam.mod$item$AXsi_.Cat2) - (tam.mod$item$AXsi_.Cat1)

        # extract Catgr.1 and Catgr.2 in ltm package
        ltm_b1 <- (data.frame(coef(ltm.mod)))$Catgr.1
        ltm_b2 <- (data.frame(coef(ltm.mod)))$Catgr.2
        
        #------------------------------------------------------------------------------#
        # Item parameter recovery
        #------------------------------------------------------------------------------#
        
        # summarize results
        itempars <- data.frame(matrix(c(N, I, K, r), nrow=1))
        colnames(itempars) <- c("N", "I", "K", "rep")
        
        # retrieve generated item parameters        
        genPC.b1 <- item_pool$b + item_pool$d1
        genPC.b2 <- item_pool$b + item_pool$d2
        
        # calculate corr, bias, RMSE for item parameters in mirt pacakge
        itempars$corr_mirt_b1 <- cor( genPC.b1, mirt_b1)
        itempars$bias_mirt_b1 <- mean( mirt_b1 - genPC.b1 )
        itempars$RMSE_mirt_b1 <- sqrt(mean( ( mirt_b1 - genPC.b1 )^2 )) 
        
        itempars$corr_mirt_b2 <- cor( genPC.b2, mirt_b2)
        itempars$bias_mirt_b2 <- mean( mirt_b2 - genPC.b2 )
        itempars$RMSE_mirt_b2 <- sqrt(mean( ( mirt_b2 - genPC.b2 )^2 )) 
        
        # calculate corr, bias, RMSE for item parameters in TAM pacakge
        itempars$corr_tam_b1 <- cor( genPC.b1, tam_b1)
        itempars$bias_tam_b1 <- mean( tam_b1 - genPC.b1 )
        itempars$RMSE_tam_b1 <- sqrt(mean( ( tam_b1 - genPC.b1 )^2 )) 
        
        itempars$corr_tam_b2 <- cor( genPC.b2, tam_b2)
        itempars$bias_tam_b2 <- mean( tam_b2 - genPC.b2 )
        itempars$RMSE_tam_b2 <- sqrt(mean( ( tam_b2 - genPC.b2 )^2 )) 
        
        # calculate corr, bias, RMSE for item parameters in ltm pacakge
        itempars$corr_ltm_b1 <- cor( genPC.b1, ltm_b1)
        itempars$bias_ltm_b1 <- mean( ltm_b1 - genPC.b1 )
        itempars$RMSE_ltm_b1 <- sqrt(mean( ( ltm_b1 - genPC.b1 )^2 )) 
        
        itempars$corr_ltm_b2 <- cor( genPC.b2, ltm_b2)
        itempars$bias_ltm_b2 <- mean( ltm_b2 - genPC.b2 )
        itempars$RMSE_ltm_b2 <- sqrt(mean( ( ltm_b2 - genPC.b2 )^2 )) 
        
        # combine results
        results <- rbind(results, itempars)
        
      }
    }
  }
}

 

  • Correlation, bias, and RMSE for item parameter recovery in mirt package

 

mirt_recovery <- aggregate(cbind(corr_mirt_b1, bias_mirt_b1, RMSE_mirt_b1,
                                 corr_mirt_b2, bias_mirt_b2, RMSE_mirt_b2) ~ N + I, 
                            data=results, mean, na.rm=TRUE)
names(mirt_recovery) <- c("Sample Size", "Test Length", 
                         "corr_b1", "bias_b1", "RMSE_b1", 
                         "corr_b2", "bias_b2", "RMSE_b2")
round(mirt_recovery, 3)
##    Sample Size Test Length corr_b1 bias_b1 RMSE_b1 corr_b2 bias_b2 RMSE_b2
## 1          500          40   0.984  -0.009   0.130   0.987   0.003   0.129
## 2         1000          40   0.992  -0.007   0.092   0.994  -0.008   0.089
## 3         5000          40   0.998  -0.002   0.041   0.999  -0.003   0.041
## 4          500          60   0.984  -0.007   0.131   0.985  -0.002   0.133
## 5         1000          60   0.992  -0.007   0.093   0.992  -0.007   0.093
## 6         5000          60   0.998  -0.002   0.041   0.998  -0.002   0.042
## 7          500          80   0.984  -0.006   0.129   0.985  -0.002   0.134
## 8         1000          80   0.992  -0.006   0.092   0.993  -0.006   0.092
## 9         5000          80   0.998  -0.003   0.041   0.998  -0.002   0.042
## 10         500         100   0.983  -0.004   0.132   0.986  -0.004   0.132
## 11        1000         100   0.991  -0.007   0.093   0.993  -0.005   0.095
## 12        5000         100   0.998  -0.003   0.042   0.999  -0.003   0.042

 

  • Correlation, bias, and RMSE for item parameter recovery in TAM package

 

tam_recovery <- aggregate(cbind(corr_tam_b1, bias_tam_b1, RMSE_tam_b1,
                                corr_tam_b2, bias_tam_b2, RMSE_tam_b2) ~ N + I, 
                           data=results, mean, na.rm=TRUE)
names(tam_recovery) <- c("Sample Size", "Test Length", 
                         "corr_b1", "bias_b1", "RMSE_b1", 
                         "corr_b2", "bias_b2", "RMSE_b2")
round(tam_recovery, 3)
##    Sample Size Test Length corr_b1 bias_b1 RMSE_b1 corr_b2 bias_b2 RMSE_b2
## 1          500          40   0.984  -0.003   0.134   0.987   0.010   0.132
## 2         1000          40   0.992  -0.009   0.095   0.994  -0.009   0.092
## 3         5000          40   0.998  -0.003   0.043   0.999  -0.002   0.042
## 4          500          60   0.984  -0.015   0.149   0.985  -0.005   0.148
## 5         1000          60   0.992  -0.003   0.110   0.992   0.002   0.108
## 6         5000          60   0.998  -0.002   0.046   0.998   0.003   0.047
## 7          500          80   0.984  -0.019   0.160   0.985  -0.006   0.165
## 8         1000          80   0.992  -0.016   0.127   0.993  -0.008   0.128
## 9         5000          80   0.998  -0.004   0.059   0.998   0.006   0.058
## 10         500         100   0.983   0.010   0.171   0.986   0.021   0.172
## 11        1000         100   0.991  -0.020   0.130   0.993  -0.008   0.127
## 12        5000         100   0.998  -0.009   0.068   0.999   0.003   0.067

 

  • Correlation, bias, and RMSE for item parameter recovery in ltm package

 

ltm_recovery <- aggregate(cbind(corr_ltm_b1, bias_ltm_b1, RMSE_ltm_b1,
                                corr_ltm_b2, bias_ltm_b2, RMSE_ltm_b2) ~ N + I, 
                          data=results, mean, na.rm=TRUE)
names(ltm_recovery) <- c("Sample Size", "Test Length", 
                         "corr_b1", "bias_b1", "RMSE_b1", 
                         "corr_b2", "bias_b2", "RMSE_b2")
round(ltm_recovery, 3)
##    Sample Size Test Length corr_b1 bias_b1 RMSE_b1 corr_b2 bias_b2 RMSE_b2
## 1          500          40   0.984  -0.006   0.144   0.987   0.009   0.141
## 2         1000          40   0.992  -0.011   0.099   0.994  -0.008   0.096
## 3         5000          40   0.998  -0.004   0.045   0.999  -0.001   0.045
## 4          500          60   0.984  -0.040   0.162   0.985  -0.027   0.160
## 5         1000          60   0.992  -0.001   0.118   0.992   0.008   0.119
## 6         5000          60   0.998  -0.004   0.052   0.998   0.006   0.053
## 7          500          80   0.984  -0.053   0.173   0.985  -0.037   0.175
## 8         1000          80   0.992  -0.034   0.141   0.993  -0.021   0.139
## 9         5000          80   0.998  -0.006   0.070   0.998   0.010   0.070
## 10         500         100   0.983  -0.066   0.197   0.986  -0.049   0.194
## 11        1000         100   0.991  -0.047   0.146   0.993  -0.028   0.142
## 12        5000         100   0.998  -0.009   0.074   0.999   0.009   0.075