Title: | Item-Wise Score-Based DIF Detection |
---|---|
Description: | Detection of item-wise Differential Item Functioning (DIF) in fitted 'mirt', 'multipleGroup' or 'bfactor' models using score-based structural change tests. Under the hood the sctest() function from the 'strucchange' package is used. |
Authors: | Dries Debeer [cre, aut] |
Maintainer: | Dries Debeer <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1 |
Built: | 2024-10-29 03:16:50 UTC |
Source: | https://github.com/ddebeer/scdiftest |
A function that executes item-wise score-based DIF tests. After fitting an
IRT model with mirt
, the fitted object can be used to
assess and test measurement invariance, using
sctest
. However, by default, all parameters of
the fitted model are tested simultaneously. This function applies the
sctest
to test for item-wise DIF, in an efficient
way.
scDIFtest( object, DIF_covariate = NULL, functional = NULL, item_selection = NULL, decorrelate = TRUE, ... )
scDIFtest( object, DIF_covariate = NULL, functional = NULL, item_selection = NULL, decorrelate = TRUE, ... )
object |
a fitted model object of class |
DIF_covariate |
a vector with the person covariate to use for the DIF-test. The covariate can be categorical, ordered categorical or numerical. |
functional |
a character specifying the functional (or test statistic) to be used. See details for more information. |
item_selection |
either |
decorrelate |
a logical. Should the process be decorrelated? |
... |
other arguments passed to the |
For more information about the functional see the documentation of
sctest.default
or
sctest.formula
. When functional = NULL
(which is the default), the functional is chosen based on the class of
DIF_covariate
. In this case, for integer
and numeric
vectors
the Double Maximum ("DM"
) is used; for ordered
vectors the
Maximum Lagrange Multiplier Test for Ordered Groups ("maxLMo"
) is
used; and for factor
, character
, and logical
vectors the
Lagrange Multiplier Test for Unordered Groups is used.
An object of class scDIFtest
scDIFtest-Methods, which is a list with three elements
A named list with a number of elements equal to the number of
the items for which DIF should be detected. Each element
contains information both about the test single_test
as well as the efpFunctional
A named list with two elements. test_info
contains
information such as used test statistic and the used covariate.
item_info
contains information about the items such as
the item types as well as the column numbers of the score matrix
that correspond to the estimated parameters of the items.
The Generalized Empirical M-Fluctuation Process (gefp
)
based on the complete model with all the estimated parameters
(see gefp
).
library(mirt) library(scDIFtest) ### data and model dat <- expand.table(LSAT7) nObs <- dim(dat)[1] mod <- mirt(dat, 1, itemtype = "2PL", constr = list(c(2, 1))) ### DIF along a metric variable ### the default test statistic is the Double Maximum (dm) metric <- rnorm(nObs) DIF_metric <- scDIFtest(mod, DIF_covariate = metric) DIF_metric plot(DIF_metric, 1) ### DIF along an ordered categorical variable ### the default test statistic is the Maximum Lagrange Multiplier Test ### for Ordered Groups (maxlmo) ordered <- ordered(sample(1:5, size = nObs, replace = TRUE)) DIF_ordered <- scDIFtest(mod, DIF_covariate = ordered) summary(DIF_ordered) ### Note that the Generalized Empirical M-Fluctuation Process (gefp) based on all ### the estimated parameters in the model is an element of the resulting ### scDIFtest object. This means that one can use this gefp to test the ### general hypothesis of measurement invariance with respect to the ### chosen covariate. strucchange::sctest(DIF_metric$gefp) strucchange::sctest(DIF_ordered$gefp)
library(mirt) library(scDIFtest) ### data and model dat <- expand.table(LSAT7) nObs <- dim(dat)[1] mod <- mirt(dat, 1, itemtype = "2PL", constr = list(c(2, 1))) ### DIF along a metric variable ### the default test statistic is the Double Maximum (dm) metric <- rnorm(nObs) DIF_metric <- scDIFtest(mod, DIF_covariate = metric) DIF_metric plot(DIF_metric, 1) ### DIF along an ordered categorical variable ### the default test statistic is the Maximum Lagrange Multiplier Test ### for Ordered Groups (maxlmo) ordered <- ordered(sample(1:5, size = nObs, replace = TRUE)) DIF_ordered <- scDIFtest(mod, DIF_covariate = ordered) summary(DIF_ordered) ### Note that the Generalized Empirical M-Fluctuation Process (gefp) based on all ### the estimated parameters in the model is an element of the resulting ### scDIFtest object. This means that one can use this gefp to test the ### general hypothesis of measurement invariance with respect to the ### chosen covariate. strucchange::sctest(DIF_metric$gefp) strucchange::sctest(DIF_ordered$gefp)
print
, summary
, and plot
methods for objects of the
scDIFtest-class
, as returned by scDIFtest
. See details
for more information about the methods.
## S3 method for class 'scDIFtest' print(x, item_selection = NULL, ...) ## S3 method for class 'scDIFtest' summary(object, method = "fdr", ...) ## S3 method for class 'scDIFtest' plot(x, item_selection = NULL, ...)
## S3 method for class 'scDIFtest' print(x, item_selection = NULL, ...) ## S3 method for class 'scDIFtest' summary(object, method = "fdr", ...) ## S3 method for class 'scDIFtest' plot(x, item_selection = NULL, ...)
x |
an object of class |
item_selection |
either |
... |
other arguments passed to the method. |
object |
an object of class |
method |
one of the strings in |
The print
method, whenitem_selection = NULL
, gives a summary
of all the tests that were executed (i.e., for all items). When specific
items are selected, the print
method is called repeatedly for each
individual sctest
corresponding with the selected items.
The summary
method computes a data frame with a row for each item
that was included in the test. The columns are:
The estimated IRT model per item
The number of estimated parameters per item
The value for the used statistic per item
The p-value per item
The corrected p-value controlling the false discovery rate
(Benjamini & Hochberg, 1995). See p.adjust
for
details.
The plot
method call the plot
method repeatedly for the
gepf
that corresponds with the executed score test for each of the
selected items. When no items are selected, the plot
method results
in an error.
Benjamini, Y., and Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society Series B, 57, 289-300.