# 1 Introduction

This package provides a collection of functions to simulate data, estimate item parameters and calculation of likelihood ratio test in multistage designs. In multistage tests, different groups of items (module) are presented to test persons depending on their response behavior to previous item groups. Multistage testing is thus a simple form of adaptive testing. If data are collected on the basis of such a multistage design and the items are estimated using the Conditional Maximum Likelihood (CML) method, Glas (1988) has shown, that the item parameters are biased. While Eggen & Verhelst (2011) propose to avoid the bias using the marginal maximum likelihood (MML) method, Zwitser & Maris (2015) showed in their work, that taking the applied multistage design in consideration and including it in the estimation of the item parameters, the estimation of item parameters is not biased using the CML method. Their proposed solution is implemented in our package. In this package, the approach of Zwitser & Maris (2015) is implemented. It was ensured that the necessary specification of the multistage design is as simple as possible and will be described in detail below. For the multistage design, the elementary symmetric function has to be calculated several times, so that this is as efficient as possible, the relevant functions have been written in Rcpp (Eddelbuettel & Balamuta, 2017). In addition to estimating the item parameters for multistage designs, it is also possible to estimate the item parameters for conventional designs. In order to further increase the efficiency, the algorithm of Verhelst, Glas, & Van der Sluis (1984) was used for the elementary symmetry function.

The package is well tested, but errors can still be exist. If you find a bug, please report it to us (with an working example) preferred via github: issues

# 2 Package

Below are a few sample applications of our package, which should provide information for the start:

## 2.1 Rasch model without multistage design

For the estimation of item parameters of a simple 1-PL model, the function tmt_rm must be called. Here only the data set has to be passed (as matrix or data.frame) to estimate item parameters. Additional arguments allow to turn off the estimates of the standard errors (for example, for time reasons) or to switch from “nlminb” to “optim” (as in the example below). Per default the items are normalized to sum = 0 as recommended by Glas (2016).

   # simulate some data
dat <- tmt:::sim.rm(theta = 100,b = 10,seed = 1111)

# estimate item parameters
dat.rm <- tmt_rm(dat = dat, optimization = "optim")

# print summary
summary(dat.rm)
#>
#> Call:
#>   tmt_rm(dat = dat, optimization = "optim")
#>
#>
#> Results of Rasch model (nmst) estimation:
#>
#> Difficulty parameters:
#>             est.b_i01 est.b_i02 est.b_i03 est.b_i04  est.b_i05  est.b_i06
#> Estimate   -0.5437771 0.8132317 0.1538596 0.2977015 -0.4505778 -2.9776628
#> Std. Error  0.2096111 0.2261376 0.2101320 0.2122690  0.2087596  0.3658512
#>            est.b_i07 est.b_i08 est.b_i09 est.b_i10
#> Estimate   0.2014556 0.6506915 0.9856119 0.8694659
#> Std. Error 0.2107592 0.2206768 0.2330845 0.2282708
#>
#> CLL: -373.6552
#> Number of iterations: 46
#> Number of parameters: 10

## 2.2 Rasch model with simple multistage design

In order to estimate the item parameters in a multistage design, the corresponding design must first be specified. For the multistage design, it is necessary that each module is defined, as exemplified below with M1, M2, etc. The name of the module is arbitrary. The name of the module follows with “=~” the vector with the items of the respective path. If all modules have been defined, the start module(s) must be defined. The starting module(s) is/are described with a name and the sign “==” (double equal sign) followed by the particular module. Each path has a name followed by the “:=” character in the starting module and all other modules in that path. Each module must be followed in parentheses by the minimum (first number) and maximum (second number) of solved items in the respective module.

Keeping the syntax is very important, otherwise the design can not be translated.

component syntax example
module =~ M1 =~ c(i1, i2, i3, i4, i5)
starting module == Start == M2
path := p1 := Start(minSolved,maxSolved)
stages + p1 := Start(minSolved,maxSolved) + M1(minSolved, maxSolved)

To estimate the item parameters the function tmt_rm must be called with the additional information of the multistage design. Additional arguments allow to turn off the estimates of the standard errors (for example, for time reasons) or to switch from “nlminb” to “optim” (as in the example below).

  # Example for multistage-design
mstdesign <- "
M1 =~ c(i1, i2, i3, i4, i5)
M2 =~ c(i6, i7, i8, i9, i10)
M3 =~ c(i11, i12, i13, i14, i15)

# define starting Block
Start == M2

# define path
p1 := Start(0,2) + M1(0,5)
p2 := Start(3,5) + M3(0,5)
"
# generate item parameters with corresponding names to the multistage design
items <- seq(-1,1, length.out = 15)
names(items) <- paste0("i",1:length(items))

# generate random data under given multistage design
dat <- tmt_sim(mstdesign = mstdesign,
items = items,
persons = 500,
mean = 0,
sd = 1)
# estimate the item parameters under the given multistage-design
dat.rm <- tmt_rm(dat = dat,
mstdesign = mstdesign,
optimization = "optim")

# print summary of item parameters
summary(dat.rm)
#>
#> Call:
#>   tmt_rm(dat = dat, mstdesign = mstdesign, optimization = "optim")
#>
#>
#> Results of Rasch model (mst) estimation:
#>
#> Difficulty parameters:
#>              est.b_i1   est.b_i2   est.b_i3   est.b_i4   est.b_i5   est.b_i6
#> Estimate   -0.7211684 -0.8292145 -0.7750037 -0.5428493 -0.4548954 -0.3668290
#> Std. Error  0.1467064  0.1469657  0.1468081  0.1467566  0.1469998  0.1029584
#>               est.b_i7   est.b_i8  est.b_i9 est.b_i10 est.b_i11 est.b_i12
#> Estimate   -0.08228339 -0.2054576 0.1535489 0.2491042 0.5489391 0.7174808
#> Std. Error  0.10244709  0.1025473 0.1027568 0.1030808 0.1499833 0.1504586
#>            est.b_i13 est.b_i14 est.b_i15
#> Estimate   0.5849513 0.7748798 0.9487972
#> Std. Error 0.1500235 0.1507871 0.1523017
#>
#> CLL: -2029.587
#> Number of iterations: 71
#> Number of parameters: 15

## 2.3 Rasch model with cumulative multistage design

In order to estimate the item parameters in a cumulative multistage design, the corresponding design must first be specified. For the multistage design, it is necessary that each module is defined, as exemplified below with M1, M2, etc. The name of the module is arbitrary. The name of the module follows with “=~” the vector with the items of the respective module. If all modules have been defined, the start module(s) must be defined. The starting module(s) is/are described with a name and the sign “==” (double equal sign) followed by the particular module. Finally, all pathes must be defined. Each path has a name followed by the “:=” character in the starting module and all other modules (stages) in the path. Each module must be followed in parentheses by the minimum (first number) and maximum (second number) of solved items at that stage. For a cumulative design, the number of minimum and maximum solved items from the previous + the current module must be specified at the current stage. For this purpose the specifing character becomes “+=” instead of “+”.

Keeping the syntax is very important, otherwise the design can not be translated.

component syntax example
module =~ M1 =~ c(i1, i2, i3, i4, i5)
starting module == Start == M2
path := p1 := Start(minSolved,maxSolved)
stages += p1 := Start(minSolved,maxSolved) += M1(minSolved, maxSolved)

To estimate the item parameters the function tmt_rm must be called with the additional information of the multistage design. Additional arguments allow to turn off the estimates of the standard errors (for example, for time reasons) or to switch from “nlminb” to “optim” (as in the example below).

  # Example for multistage-design
mstdesign <- "
M1  =~ paste0('i',21:30)
M2  =~ paste0('i',11:20)
M3  =~ paste0('i', 1:10)
M4  =~ paste0('i',31:40)
M5  =~ paste0('i',41:50)
M6  =~ paste0('i',51:60)

# define starting module
Start == M1

# define path
p1 := Start(0, 5) += M2( 0,10) += M3
p2 := Start(0, 5) += M2(11,15) += M4
p3 := Start(6,10) += M5( 6,15) += M4
p4 := Start(6,10) += M5(16,20) += M6
"
# generate item parameters with corresponding names to the multistage design
items <- seq(-1,1, length.out = 60)
names(items) <- paste0("i",1:length(items))

# generate random data under given multistage design
dat <- tmt_sim(mstdesign = mstdesign,
items = items,
persons = 1000,
mean = 0,
sd = 1)
# estimate the item parameters under the given multistage-design
dat.rm <- tmt_rm(dat = dat,
mstdesign = mstdesign,
optimization = "optim")

# print summary of item parameters
summary(dat.rm)
#>
#> Call:
#>   tmt_rm(dat = dat, mstdesign = mstdesign, optimization = "optim")
#>
#>
#> Results of Rasch model (mst) estimation:
#>
#> Difficulty parameters:
#>              est.b_i1   est.b_i2   est.b_i3   est.b_i4   est.b_i5   est.b_i6
#> Estimate   -1.2371687 -1.0650658 -0.8956495 -0.8109949 -0.8533330 -0.7580146
#> Std. Error  0.1100552  0.1092988  0.1091039  0.1092102  0.1091401  0.1093458
#>              est.b_i7  est.b_i8   est.b_i9  est.b_i10   est.b_i11   est.b_i12
#> Estimate   -0.8744929 -0.800405 -0.8321676 -0.5978576 -0.80556575 -0.64512532
#> Std. Error  0.1091177  0.109233  0.1091709  0.1100810  0.09746611  0.09743877
#>              est.b_i13   est.b_i14   est.b_i15   est.b_i16   est.b_i17
#> Estimate   -0.67048688 -0.75487791 -0.73800272 -0.46645462 -0.67048688
#> Std. Error  0.09741548  0.09741266  0.09740405  0.09789812  0.09741548
#>              est.b_i18   est.b_i19   est.b_i20   est.b_i21   est.b_i22
#> Estimate   -0.35484252 -0.57729174 -0.35484252 -0.42262119 -0.37752956
#> Std. Error  0.09844992  0.09755214  0.09844992  0.07528458  0.07512673
#>              est.b_i23   est.b_i24   est.b_i25   est.b_i26   est.b_i27
#> Estimate   -0.12384780 -0.20394979 -0.21727018 -0.25789323 0.004941979
#> Std. Error  0.07458298  0.07469226  0.07471598  0.07479813 0.074526532
#>             est.b_i28   est.b_i29   est.b_i30  est.b_i31 est.b_i32 est.b_i33
#> Estimate   -0.1439947 -0.10403689 -0.02536380 0.03541727 0.1941080 0.3788681
#> Std. Error  0.0746051  0.07456475  0.07452662 0.10255673 0.1018821 0.1016895
#>              est.b_i34 est.b_i35 est.b_i36 est.b_i37 est.b_i38 est.b_i39
#> Estimate   0.007116666 0.0917222 0.2773546 0.0917222 0.1104104 0.2496392
#> Std. Error 0.102726865 0.1022632 0.1017166 0.1022632 0.1021790 0.1017574
#>            est.b_i40 est.b_i41 est.b_i42 est.b_i43 est.b_i44 est.b_i45
#> Estimate   0.4712902 0.3004338 0.2706109 0.3399495 0.3300946 0.4085624
#> Std. Error 0.1018316 0.1032061 0.1034314 0.1029312 0.1029973 0.1025171
#>            est.b_i46 est.b_i47 est.b_i48 est.b_i49 est.b_i50 est.b_i51
#> Estimate   0.5057481 0.5347682 0.6312053 0.6793178 0.6889364  1.012010
#> Std. Error 0.1020666 0.1019627 0.1017180 0.1016534 0.1016451  0.214401
#>            est.b_i52 est.b_i53 est.b_i54 est.b_i55 est.b_i56 est.b_i57
#> Estimate   0.9300068 1.0922957 0.6293717 0.7635015 1.2092202  1.012010
#> Std. Error 0.2164162 0.2126634 0.2259486 0.2212714 0.2105435  0.214401
#>            est.b_i58 est.b_i59 est.b_i60
#> Estimate   1.1706361 1.2856759 0.9326878
#> Std. Error 0.2111896 0.2094178 0.2163464
#>
#> CLL: -15780.04
#> Number of iterations: 134
#> Number of parameters: 60

## 2.4 Likelihood-ratio Test

The likelihood ratio test of Andersen (Andersen, 1973) is also implemented. The estimated item parameters either from an simple 1-PL model or from a 1-PL model with multistage design could be passed to the function tmt_lrtest. This function is also a generic function (like tmt_rm), which calls the specific function for data with/without multistage design. For the application on very large data sets it is possible to parallelize the tmt_lrtest function. For this purpose only the amount of cores has to be passed as additional argument (it is recommended to use three cores, if possible).

    # simulate some data
dat_nmst <- tmt:::sim.rm(theta = 100,b = 10,seed = 1111)

# estimate item parameters
dat_nmst_rm <- tmt_rm(dat = dat_nmst, optimization = "optim")

# calculate likelihood ratio-test
dat_lrt_nmst <- tmt_lrtest(dat_nmst_rm, optimization = "optim")

# print summary
summary(dat_lrt_nmst)
#>
#> Likelihood ratio test (Andersen):
#>
#> Value (Chi^2):  6.722
#> df (Chi^2):  9
#> p-value:  0.666
    # example of multistage-design
mstdesign <- "
M1 =~ c(i1, i2, i3, i4, i5)
M2 =~ c(i6, i7, i8, i9, i10)
M3 =~ c(i11, i12, i13, i14, i15)

# define starting Block
Start == M2

# define path
p1 := Start(0,2) + M1(0,5)
p2 := Start(3,5) + M3(0,5)
"
# generate item parameters with corresponding names to the multistage design
items <- seq(-1,1, length.out = 15)
names(items) <- paste0("i",1:length(items))

# generate random data under given multistage design
set.seed(1111)
dat_mst <- tmt_sim(mstdesign = mstdesign,
items = items,
persons = 500,
mean = 0,
sd = 1)

# estimate the item parameters under the given multistage-design
dat_mst_rm <- tmt_rm(dat = dat_mst,
mstdesign = mstdesign,
optimization = "optim")

# calculate likelihood ratio-test
dat_lrt_mst <- tmt_lrtest(dat_mst_rm, optimization = "optim")

# print summary
summary(dat_lrt_mst)
#>
#> Likelihood ratio test (Andersen) for multistage designs:
#>
#> Value (Chi^2):  13.723
#> df (Chi^2):  14
#> p-value:  0.471

## 2.5 Graphical model check

For a graphical comparison of estimated item parameters for each sub group, we provide a so-called graphical model check. Several options are available for further specification of the plot (internally the package ggplot2 is used)

    # example of multistage-design
items <- seq(-1,1,length.out = 30)
names(items) <- paste0("i",1:30)
persons = 100
mean = 0
sd = 1
dat <- tmt:::sim.rm(theta = persons, b = items, 1111)

dat.rm <- tmt_rm(dat, optimization = "optim")
dat.lrt <- tmt_lrtest(dat.rm, split = "median", optimization = "optim")

info <- rep(c("group_a","group_b"),each = 15)
names(info) <- paste0("i",1:30)

drop <- c("i1","i18","i20","i10")

tmt_gmc(object = dat.lrt,
ellipse = TRUE,
info = info,
drop = drop,
title = "graphical model check",
alpha = 0.05,
legendtitle = "split criteria")

# References

Andersen, E. B. (1973). A goodness of fit test for the Rasch model. Psychometrika, 38(1), 123–140. doi:10.1007/BF02291180

Eddelbuettel, D., & Balamuta, J. J. (2017). Extending extitR with extitC++: A Brief Introduction to extitRcpp. PeerJ Preprints, 5, e3188v1. doi:10.7287/peerj.preprints.3188v1

Eggen, T., & Verhelst, N. D. (2011). Item Calibration in Incomplete Testing Designs. Psicologica: International Journal of Methodology and Experimental Psychology, 32(1), 107–132.

Glas, C. (1988). The Rasch model and multistage testing. Journal of Educational Statistics, 13(1), 45–52. doi:10.3102/10769986013001045

Glas, C. A. W. (2016). Maximum-likelihood estimation. In W. van der Linden (Ed.), Handbook of item response theory: Volume two: Statistical tools (pp. 197–236). New York, NY: CRC Pres. doi:10.1007/978-1-4612-4230-7_5

Verhelst, N., Glas, C., & Van der Sluis, A. (1984). Estimation problems in the rasch model: The basic symmetric functions. Computational Statistics Quarterly, 1(3), 245–262.

Zwitser, R. J., & Maris, G. (2015). Conditional statistical inference with multistage testing designs. Psychometrika, 80(1), 65–84. doi:10.1007/s11336-013-9369-6