Lagrange (i.e., score) test to test whether parameters should be freed from a more constrained baseline model.

lagrange(mod, parnum, SE.type = "Oakes", type = "Richardson", ...)

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

See also

Author

Phil Chalmers rphilip.chalmers@gmail.com

Examples


# \donttest{
dat <- expand.table(LSAT7)
mod <- mirt(dat, 1, 'Rasch')
(values <- mod2values(mod))
#>    group   item     class   name parnum     value lbound ubound   est
#> 1    all Item.1      dich     a1      1 1.0000000   -Inf    Inf FALSE
#> 2    all Item.1      dich      d      2 1.8680718   -Inf    Inf  TRUE
#> 3    all Item.1      dich      g      3 0.0000000  0e+00      1 FALSE
#> 4    all Item.1      dich      u      4 1.0000000  0e+00      1 FALSE
#> 5    all Item.2      dich     a1      5 1.0000000   -Inf    Inf FALSE
#> 6    all Item.2      dich      d      6 0.7909134   -Inf    Inf  TRUE
#> 7    all Item.2      dich      g      7 0.0000000  0e+00      1 FALSE
#> 8    all Item.2      dich      u      8 1.0000000  0e+00      1 FALSE
#> 9    all Item.3      dich     a1      9 1.0000000   -Inf    Inf FALSE
#> 10   all Item.3      dich      d     10 1.4608233   -Inf    Inf  TRUE
#> 11   all Item.3      dich      g     11 0.0000000  0e+00      1 FALSE
#> 12   all Item.3      dich      u     12 1.0000000  0e+00      1 FALSE
#> 13   all Item.4      dich     a1     13 1.0000000   -Inf    Inf FALSE
#> 14   all Item.4      dich      d     14 0.5214399   -Inf    Inf  TRUE
#> 15   all Item.4      dich      g     15 0.0000000  0e+00      1 FALSE
#> 16   all Item.4      dich      u     16 1.0000000  0e+00      1 FALSE
#> 17   all Item.5      dich     a1     17 1.0000000   -Inf    Inf FALSE
#> 18   all Item.5      dich      d     18 1.9927710   -Inf    Inf  TRUE
#> 19   all Item.5      dich      g     19 0.0000000  0e+00      1 FALSE
#> 20   all Item.5      dich      u     20 1.0000000  0e+00      1 FALSE
#> 21   all  GROUP GroupPars MEAN_1     21 0.0000000   -Inf    Inf FALSE
#> 22   all  GROUP GroupPars COV_11     22 1.0219437  1e-04    Inf  TRUE
#>    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.36714266  1 0.54456590
#> 5  0.04789243  1 0.82677204
#> 9  4.69717572  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')
coef(mod2, simplify=TRUE)$items
#>              a1         d g u
#> Item.1 1.158017 1.9393429 0 1
#> Item.2 1.000000 0.7850362 0 1
#> Item.3 1.000000 1.4501782 0 1
#> Item.4 1.000000 0.5175801 0 1
#> Item.5 1.000000 1.9787221 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')
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')
coef(mod2, simplify=TRUE)$items
#>              a1         d g u
#> Item.1 1.000000 1.8101786 0 1
#> Item.2 1.000000 0.7649578 0 1
#> Item.3 1.848191 1.7774734 0 1
#> Item.4 1.000000 0.5042544 0 1
#> Item.5 1.000000 1.9316302 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.1527190  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

# }