Lagrange (i.e., score) test to test whether parameters should be freed from a more constrained baseline model.
Arguments
- mod
an estimated model
- parnum
a vector, or list of vectors, containing one or more parameter locations/sets of locations to be tested. See objects returned from
mod2values
for the locations- SE.type
type of information matrix estimator to use. See
mirt
for further details- type
type of numerical algorithm passed to
numerical_deriv
to obtain the gradient terms- ...
additional arguments to pass to
mirt
References
Chalmers, R., P. (2012). mirt: A Multidimensional Item Response Theory Package for the R Environment. Journal of Statistical Software, 48(6), 1-29. doi:10.18637/jss.v048.i06
Author
Phil Chalmers rphilip.chalmers@gmail.com
Examples
# \donttest{
dat <- expand.table(LSAT7)
mod <- mirt(dat, 1, 'Rasch')
#>
Iteration: 1, Log-Lik: -2664.942, Max-Change: 0.01075
Iteration: 2, Log-Lik: -2664.913, Max-Change: 0.00257
Iteration: 3, Log-Lik: -2664.910, Max-Change: 0.00210
Iteration: 4, Log-Lik: -2664.908, Max-Change: 0.00179
Iteration: 5, Log-Lik: -2664.906, Max-Change: 0.00156
Iteration: 6, Log-Lik: -2664.905, Max-Change: 0.00137
Iteration: 7, Log-Lik: -2664.904, Max-Change: 0.00141
Iteration: 8, Log-Lik: -2664.903, Max-Change: 0.00110
Iteration: 9, Log-Lik: -2664.903, Max-Change: 0.00095
Iteration: 10, Log-Lik: -2664.902, Max-Change: 0.00086
Iteration: 11, Log-Lik: -2664.902, Max-Change: 0.00072
Iteration: 12, Log-Lik: -2664.902, Max-Change: 0.00063
Iteration: 13, Log-Lik: -2664.902, Max-Change: 0.00065
Iteration: 14, Log-Lik: -2664.901, Max-Change: 0.00051
Iteration: 15, Log-Lik: -2664.901, Max-Change: 0.00044
Iteration: 16, Log-Lik: -2664.901, Max-Change: 0.00040
Iteration: 17, Log-Lik: -2664.901, Max-Change: 0.00034
Iteration: 18, Log-Lik: -2664.901, Max-Change: 0.00029
Iteration: 19, Log-Lik: -2664.901, Max-Change: 0.00030
Iteration: 20, Log-Lik: -2664.901, Max-Change: 0.00024
Iteration: 21, Log-Lik: -2664.901, Max-Change: 0.00020
Iteration: 22, Log-Lik: -2664.901, Max-Change: 0.00018
Iteration: 23, Log-Lik: -2664.901, Max-Change: 0.00016
Iteration: 24, Log-Lik: -2664.901, Max-Change: 0.00014
Iteration: 25, Log-Lik: -2664.901, Max-Change: 0.00014
Iteration: 26, Log-Lik: -2664.901, Max-Change: 0.00011
Iteration: 27, Log-Lik: -2664.901, Max-Change: 0.00009
(values <- mod2values(mod))
#> group item class name parnum value lbound ubound est const nconst
#> 1 all Item.1 dich a1 1 1.000 -Inf Inf FALSE none none
#> 2 all Item.1 dich d 2 1.868 -Inf Inf TRUE none none
#> 3 all Item.1 dich g 3 0.000 0 1 FALSE none none
#> 4 all Item.1 dich u 4 1.000 0 1 FALSE none none
#> 5 all Item.2 dich a1 5 1.000 -Inf Inf FALSE none none
#> 6 all Item.2 dich d 6 0.791 -Inf Inf TRUE none none
#> 7 all Item.2 dich g 7 0.000 0 1 FALSE none none
#> 8 all Item.2 dich u 8 1.000 0 1 FALSE none none
#> 9 all Item.3 dich a1 9 1.000 -Inf Inf FALSE none none
#> 10 all Item.3 dich d 10 1.461 -Inf Inf TRUE none none
#> 11 all Item.3 dich g 11 0.000 0 1 FALSE none none
#> 12 all Item.3 dich u 12 1.000 0 1 FALSE none none
#> 13 all Item.4 dich a1 13 1.000 -Inf Inf FALSE none none
#> 14 all Item.4 dich d 14 0.521 -Inf Inf TRUE none none
#> 15 all Item.4 dich g 15 0.000 0 1 FALSE none none
#> 16 all Item.4 dich u 16 1.000 0 1 FALSE none none
#> 17 all Item.5 dich a1 17 1.000 -Inf Inf FALSE none none
#> 18 all Item.5 dich d 18 1.993 -Inf Inf TRUE none none
#> 19 all Item.5 dich g 19 0.000 0 1 FALSE none none
#> 20 all Item.5 dich u 20 1.000 0 1 FALSE none none
#> 21 all GROUP GroupPars MEAN_1 21 0.000 -Inf Inf FALSE none none
#> 22 all GROUP GroupPars COV_11 22 1.022 0 Inf TRUE none none
#> prior.type prior_1 prior_2
#> 1 none NaN NaN
#> 2 none NaN NaN
#> 3 none NaN NaN
#> 4 none NaN NaN
#> 5 none NaN NaN
#> 6 none NaN NaN
#> 7 none NaN NaN
#> 8 none NaN NaN
#> 9 none NaN NaN
#> 10 none NaN NaN
#> 11 none NaN NaN
#> 12 none NaN NaN
#> 13 none NaN NaN
#> 14 none NaN NaN
#> 15 none NaN NaN
#> 16 none NaN NaN
#> 17 none NaN NaN
#> 18 none NaN NaN
#> 19 none NaN NaN
#> 20 none NaN NaN
#> 21 none NaN NaN
#> 22 none NaN NaN
# test all fixed slopes individually
parnum <- values$parnum[values$name == 'a1']
lagrange(mod, parnum)
#> X2 df p
#> 1 0.36714267 1 0.54456589
#> 5 0.04789243 1 0.82677204
#> 9 4.69717570 1 0.03021223
#> 13 1.44960175 1 0.22859187
#> 17 2.55408012 1 0.11000983
# compare to LR test for first two slopes
mod2 <- mirt(dat, 'F = 1-5
FREE = (1, a1)', 'Rasch')
#>
Iteration: 1, Log-Lik: -2664.942, Max-Change: 0.04335
Iteration: 2, Log-Lik: -2664.771, Max-Change: 0.02847
Iteration: 3, Log-Lik: -2664.709, Max-Change: 0.01913
Iteration: 4, Log-Lik: -2664.664, Max-Change: 0.00679
Iteration: 5, Log-Lik: -2664.658, Max-Change: 0.00513
Iteration: 6, Log-Lik: -2664.654, Max-Change: 0.00402
Iteration: 7, Log-Lik: -2664.649, Max-Change: 0.00253
Iteration: 8, Log-Lik: -2664.646, Max-Change: 0.00209
Iteration: 9, Log-Lik: -2664.644, Max-Change: 0.00183
Iteration: 10, Log-Lik: -2664.642, Max-Change: 0.00189
Iteration: 11, Log-Lik: -2664.640, Max-Change: 0.00156
Iteration: 12, Log-Lik: -2664.639, Max-Change: 0.00137
Iteration: 13, Log-Lik: -2664.638, Max-Change: 0.00151
Iteration: 14, Log-Lik: -2664.637, Max-Change: 0.00121
Iteration: 15, Log-Lik: -2664.636, Max-Change: 0.00106
Iteration: 16, Log-Lik: -2664.635, Max-Change: 0.00108
Iteration: 17, Log-Lik: -2664.635, Max-Change: 0.00089
Iteration: 18, Log-Lik: -2664.634, Max-Change: 0.00078
Iteration: 19, Log-Lik: -2664.634, Max-Change: 0.00092
Iteration: 20, Log-Lik: -2664.634, Max-Change: 0.00072
Iteration: 21, Log-Lik: -2664.633, Max-Change: 0.00062
Iteration: 22, Log-Lik: -2664.633, Max-Change: 0.00059
Iteration: 23, Log-Lik: -2664.633, Max-Change: 0.00051
Iteration: 24, Log-Lik: -2664.633, Max-Change: 0.00045
Iteration: 25, Log-Lik: -2664.633, Max-Change: 0.00054
Iteration: 26, Log-Lik: -2664.633, Max-Change: 0.00043
Iteration: 27, Log-Lik: -2664.632, Max-Change: 0.00036
Iteration: 28, Log-Lik: -2664.632, Max-Change: 0.00034
Iteration: 29, Log-Lik: -2664.632, Max-Change: 0.00030
Iteration: 30, Log-Lik: -2664.632, Max-Change: 0.00027
Iteration: 31, Log-Lik: -2664.632, Max-Change: 0.00031
Iteration: 32, Log-Lik: -2664.632, Max-Change: 0.00024
Iteration: 33, Log-Lik: -2664.632, Max-Change: 0.00021
Iteration: 34, Log-Lik: -2664.632, Max-Change: 0.00020
Iteration: 35, Log-Lik: -2664.632, Max-Change: 0.00017
Iteration: 36, Log-Lik: -2664.632, Max-Change: 0.00016
Iteration: 37, Log-Lik: -2664.632, Max-Change: 0.00018
Iteration: 38, Log-Lik: -2664.632, Max-Change: 0.00014
Iteration: 39, Log-Lik: -2664.632, Max-Change: 0.00013
Iteration: 40, Log-Lik: -2664.632, Max-Change: 0.00012
Iteration: 41, Log-Lik: -2664.632, Max-Change: 0.00010
coef(mod2, simplify=TRUE)$items
#> a1 d g u
#> Item.1 1.157956 1.9393358 0 1
#> Item.2 1.000000 0.7850452 0 1
#> Item.3 1.000000 1.4501952 0 1
#> Item.4 1.000000 0.5175858 0 1
#> Item.5 1.000000 1.9787464 0 1
anova(mod, mod2)
#> AIC SABIC HQ BIC logLik X2 df p
#> mod 5341.802 5352.192 5352.994 5371.248 -2664.901
#> mod2 5343.264 5355.386 5356.321 5377.618 -2664.632 0.538 1 0.463
mod2 <- mirt(dat, 'F = 1-5
FREE = (2, a1)', 'Rasch')
#>
Iteration: 1, Log-Lik: -2664.942, Max-Change: 0.01075
Iteration: 2, Log-Lik: -2664.908, Max-Change: 0.00510
Iteration: 3, Log-Lik: -2664.901, Max-Change: 0.00420
Iteration: 4, Log-Lik: -2664.893, Max-Change: 0.00288
Iteration: 5, Log-Lik: -2664.888, Max-Change: 0.00257
Iteration: 6, Log-Lik: -2664.885, Max-Change: 0.00237
Iteration: 7, Log-Lik: -2664.881, Max-Change: 0.00302
Iteration: 8, Log-Lik: -2664.877, Max-Change: 0.00240
Iteration: 9, Log-Lik: -2664.874, Max-Change: 0.00206
Iteration: 10, Log-Lik: -2664.872, Max-Change: 0.00196
Iteration: 11, Log-Lik: -2664.871, Max-Change: 0.00169
Iteration: 12, Log-Lik: -2664.869, Max-Change: 0.00152
Iteration: 13, Log-Lik: -2664.868, Max-Change: 0.00183
Iteration: 14, Log-Lik: -2664.866, Max-Change: 0.00145
Iteration: 15, Log-Lik: -2664.865, Max-Change: 0.00126
Iteration: 16, Log-Lik: -2664.865, Max-Change: 0.00122
Iteration: 17, Log-Lik: -2664.864, Max-Change: 0.00104
Iteration: 18, Log-Lik: -2664.863, Max-Change: 0.00094
Iteration: 19, Log-Lik: -2664.863, Max-Change: 0.00111
Iteration: 20, Log-Lik: -2664.862, Max-Change: 0.00088
Iteration: 21, Log-Lik: -2664.862, Max-Change: 0.00076
Iteration: 22, Log-Lik: -2664.862, Max-Change: 0.00075
Iteration: 23, Log-Lik: -2664.862, Max-Change: 0.00064
Iteration: 24, Log-Lik: -2664.861, Max-Change: 0.00057
Iteration: 25, Log-Lik: -2664.861, Max-Change: 0.00068
Iteration: 26, Log-Lik: -2664.861, Max-Change: 0.00054
Iteration: 27, Log-Lik: -2664.861, Max-Change: 0.00047
Iteration: 28, Log-Lik: -2664.861, Max-Change: 0.00045
Iteration: 29, Log-Lik: -2664.861, Max-Change: 0.00039
Iteration: 30, Log-Lik: -2664.861, Max-Change: 0.00033
Iteration: 31, Log-Lik: -2664.861, Max-Change: 0.00040
Iteration: 32, Log-Lik: -2664.860, Max-Change: 0.00033
Iteration: 33, Log-Lik: -2664.860, Max-Change: 0.00028
Iteration: 34, Log-Lik: -2664.860, Max-Change: 0.00028
Iteration: 35, Log-Lik: -2664.860, Max-Change: 0.00024
Iteration: 36, Log-Lik: -2664.860, Max-Change: 0.00020
Iteration: 37, Log-Lik: -2664.860, Max-Change: 0.00024
Iteration: 38, Log-Lik: -2664.860, Max-Change: 0.00020
Iteration: 39, Log-Lik: -2664.860, Max-Change: 0.00017
Iteration: 40, Log-Lik: -2664.860, Max-Change: 0.00017
Iteration: 41, Log-Lik: -2664.860, Max-Change: 0.00014
Iteration: 42, Log-Lik: -2664.860, Max-Change: 0.00012
Iteration: 43, Log-Lik: -2664.860, Max-Change: 0.00014
Iteration: 44, Log-Lik: -2664.860, Max-Change: 0.00012
Iteration: 45, Log-Lik: -2664.860, Max-Change: 0.00010
Iteration: 46, Log-Lik: -2664.860, Max-Change: 0.00010
Iteration: 47, Log-Lik: -2664.860, Max-Change: 0.00009
coef(mod2, simplify=TRUE)$items
#> a1 d g u
#> Item.1 1.0000000 1.8746626 0 1
#> Item.2 0.9464702 0.7810629 0 1
#> Item.3 1.0000000 1.4661198 0 1
#> Item.4 1.0000000 0.5234068 0 1
#> Item.5 1.0000000 1.9997347 0 1
anova(mod, mod2)
#> AIC SABIC HQ BIC logLik X2 df p
#> mod 5341.802 5352.192 5352.994 5371.248 -2664.901
#> mod2 5343.720 5355.842 5356.777 5378.075 -2664.860 0.081 1 0.775
mod2 <- mirt(dat, 'F = 1-5
FREE = (3, a1)', 'Rasch')
#>
Iteration: 1, Log-Lik: -2664.942, Max-Change: 0.13976
Iteration: 2, Log-Lik: -2663.229, Max-Change: 0.10017
Iteration: 3, Log-Lik: -2662.419, Max-Change: 0.07424
Iteration: 4, Log-Lik: -2661.536, Max-Change: 0.02296
Iteration: 5, Log-Lik: -2661.413, Max-Change: 0.02104
Iteration: 6, Log-Lik: -2661.310, Max-Change: 0.01937
Iteration: 7, Log-Lik: -2661.177, Max-Change: 0.01502
Iteration: 8, Log-Lik: -2661.062, Max-Change: 0.01151
Iteration: 9, Log-Lik: -2660.992, Max-Change: 0.00965
Iteration: 10, Log-Lik: -2660.933, Max-Change: 0.00906
Iteration: 11, Log-Lik: -2660.886, Max-Change: 0.00765
Iteration: 12, Log-Lik: -2660.848, Max-Change: 0.00751
Iteration: 13, Log-Lik: -2660.809, Max-Change: 0.00845
Iteration: 14, Log-Lik: -2660.767, Max-Change: 0.00653
Iteration: 15, Log-Lik: -2660.741, Max-Change: 0.00555
Iteration: 16, Log-Lik: -2660.717, Max-Change: 0.00545
Iteration: 17, Log-Lik: -2660.699, Max-Change: 0.00460
Iteration: 18, Log-Lik: -2660.684, Max-Change: 0.00499
Iteration: 19, Log-Lik: -2660.668, Max-Change: 0.00514
Iteration: 20, Log-Lik: -2660.651, Max-Change: 0.00401
Iteration: 21, Log-Lik: -2660.640, Max-Change: 0.00344
Iteration: 22, Log-Lik: -2660.630, Max-Change: 0.00341
Iteration: 23, Log-Lik: -2660.623, Max-Change: 0.00294
Iteration: 24, Log-Lik: -2660.616, Max-Change: 0.00332
Iteration: 25, Log-Lik: -2660.610, Max-Change: 0.00326
Iteration: 26, Log-Lik: -2660.602, Max-Change: 0.00255
Iteration: 27, Log-Lik: -2660.598, Max-Change: 0.00220
Iteration: 28, Log-Lik: -2660.594, Max-Change: 0.00220
Iteration: 29, Log-Lik: -2660.590, Max-Change: 0.00195
Iteration: 30, Log-Lik: -2660.588, Max-Change: 0.00222
Iteration: 31, Log-Lik: -2660.585, Max-Change: 0.00210
Iteration: 32, Log-Lik: -2660.582, Max-Change: 0.00166
Iteration: 33, Log-Lik: -2660.580, Max-Change: 0.00143
Iteration: 34, Log-Lik: -2660.578, Max-Change: 0.00144
Iteration: 35, Log-Lik: -2660.576, Max-Change: 0.00133
Iteration: 36, Log-Lik: -2660.575, Max-Change: 0.00151
Iteration: 37, Log-Lik: -2660.574, Max-Change: 0.00138
Iteration: 38, Log-Lik: -2660.573, Max-Change: 0.00110
Iteration: 39, Log-Lik: -2660.572, Max-Change: 0.00094
Iteration: 40, Log-Lik: -2660.571, Max-Change: 0.00094
Iteration: 41, Log-Lik: -2660.570, Max-Change: 0.00093
Iteration: 42, Log-Lik: -2660.570, Max-Change: 0.00100
Iteration: 43, Log-Lik: -2660.569, Max-Change: 0.00093
Iteration: 44, Log-Lik: -2660.568, Max-Change: 0.00073
Iteration: 45, Log-Lik: -2660.568, Max-Change: 0.00063
Iteration: 46, Log-Lik: -2660.568, Max-Change: 0.00065
Iteration: 47, Log-Lik: -2660.567, Max-Change: 0.00062
Iteration: 48, Log-Lik: -2660.567, Max-Change: 0.00067
Iteration: 49, Log-Lik: -2660.567, Max-Change: 0.00064
Iteration: 50, Log-Lik: -2660.567, Max-Change: 0.00049
Iteration: 51, Log-Lik: -2660.566, Max-Change: 0.00043
Iteration: 52, Log-Lik: -2660.566, Max-Change: 0.00043
Iteration: 53, Log-Lik: -2660.566, Max-Change: 0.00041
Iteration: 54, Log-Lik: -2660.566, Max-Change: 0.00045
Iteration: 55, Log-Lik: -2660.566, Max-Change: 0.00042
Iteration: 56, Log-Lik: -2660.566, Max-Change: 0.00033
Iteration: 57, Log-Lik: -2660.566, Max-Change: 0.00029
Iteration: 58, Log-Lik: -2660.566, Max-Change: 0.00029
Iteration: 59, Log-Lik: -2660.566, Max-Change: 0.00027
Iteration: 60, Log-Lik: -2660.566, Max-Change: 0.00030
Iteration: 61, Log-Lik: -2660.565, Max-Change: 0.00028
Iteration: 62, Log-Lik: -2660.565, Max-Change: 0.00022
Iteration: 63, Log-Lik: -2660.565, Max-Change: 0.00019
Iteration: 64, Log-Lik: -2660.565, Max-Change: 0.00020
Iteration: 65, Log-Lik: -2660.565, Max-Change: 0.00019
Iteration: 66, Log-Lik: -2660.565, Max-Change: 0.00020
Iteration: 67, Log-Lik: -2660.565, Max-Change: 0.00019
Iteration: 68, Log-Lik: -2660.565, Max-Change: 0.00015
Iteration: 69, Log-Lik: -2660.565, Max-Change: 0.00013
Iteration: 70, Log-Lik: -2660.565, Max-Change: 0.00013
Iteration: 71, Log-Lik: -2660.565, Max-Change: 0.00013
Iteration: 72, Log-Lik: -2660.565, Max-Change: 0.00013
Iteration: 73, Log-Lik: -2660.565, Max-Change: 0.00013
Iteration: 74, Log-Lik: -2660.565, Max-Change: 0.00009
coef(mod2, simplify=TRUE)$items
#> a1 d g u
#> Item.1 1.000000 1.8101732 0 1
#> Item.2 1.000000 0.7649559 0 1
#> Item.3 1.848252 1.7774916 0 1
#> Item.4 1.000000 0.5042538 0 1
#> Item.5 1.000000 1.9316244 0 1
anova(mod, mod2)
#> AIC SABIC HQ BIC logLik X2 df p
#> mod 5341.802 5352.192 5352.994 5371.248 -2664.901
#> mod2 5335.130 5347.252 5348.187 5369.485 -2660.565 8.671 1 0.003
# test slopes first two slopes and last three slopes jointly
lagrange(mod, list(parnum[1:2], parnum[3:5]))
#> X2 df p
#> 1.5 0.4591775 2 0.79486042
#> 9.13.17 9.1527189 3 0.02732783
# test all 5 slopes and first + last jointly
lagrange(mod, list(parnum[1:5], parnum[c(1, 5)]))
#> X2 df p
#> 1.5.9.13.17 9.861713 5 0.07924974
#> 1.17 2.898233 2 0.23477762
# }