difNLR {difNLR} | R Documentation |
DIF detection using non-linear regression method.
Description
Performs DIF detection procedure for dichotomous data based on non-linear regression model (generalized logistic regression) and either likelihood-ratio test, F-test, or Wald's test of a submodel.
Usage
difNLR(
Data, group, focal.name, model, constraints, type = "all", method = "nls",
match = "zscore", anchor = NULL, purify = FALSE, nrIter = 10, test = "LR",
alpha = 0.05, p.adjust.method = "none", start, initboot = TRUE, nrBo = 20,
sandwich = FALSE
)
Arguments
Data |
data.frame or matrix: dataset which rows represent scored
examinee answers ( |
group |
numeric or character: a dichotomous vector of the same length as
|
focal.name |
numeric or character: indicates the level of |
model |
character: generalized logistic regression model to be fitted. See Details. |
constraints |
character: which parameters should be the same for both
groups. Possible values are any combinations of parameters |
type |
character: type of DIF to be tested. Possible values are
|
method |
character: method used to estimate parameters. The options
are |
match |
numeric or character: matching criterion to be used as an
estimate of trait. Can be either |
anchor |
numeric or character: specification of DIF free items. Either
|
purify |
logical: should the item purification be applied? (default is
|
nrIter |
numeric: the maximal number of iterations in the item purification (default is 10). |
test |
character: test to be performed for DIF detection. Can be either
|
alpha |
numeric: significance level (default is 0.05). |
p.adjust.method |
character: method for multiple comparison correction.
Possible values are |
start |
numeric: initial values for estimation of parameters. If not
specified, starting values are calculated with
|
initboot |
logical: in case of convergence issues, should be starting
values re-calculated based on bootstrapped samples? (default is
|
nrBo |
numeric: the maximal number of iterations for calculation of starting values using bootstrapped samples (default is 20). |
sandwich |
logical: should be sandwich estimator used for covariance
matrix of parameters when using |
Details
DIF detection procedure based on non-linear regression is the extension of the logistic regression procedure (Swaminathan & Rogers, 1990) accounting for possible guessing and/or inattention when responding (Drabinova & Martinkova, 2017; Hladka & Martinkova, 2020).
The unconstrained form of 4PL generalized logistic regression model for
probability of correct answer (i.e., y = 1
) is
P(y = 1) = (c +
cDif * g) + (d + dDif * g - c - cDif * g) / (1 + exp(-(a + aDif * g) * (x - b
- bDif * g))),
where x
is by default standardized total score (also
called Z-score) and g
is a group membership. Parameters a
,
b
, c
, and d
are discrimination, difficulty, guessing, and
inattention. Terms aDif
, bDif
, cDif
, and dDif
then
represent differences between two groups (reference and focal) in relevant
parameters.
This 4PL model can be further constrained by model
and
constraints
arguments. The arguments model
and
constraints
can be also combined. Both arguments can be specified as a
single value (for all items) or as an item-specific vector (where each
element correspond to one item).
The model
argument offers several predefined models. The options are as follows:
Rasch
for 1PL model with discrimination parameter fixed on value 1 for both groups,
1PL
for 1PL model with discrimination parameter fixed for both groups,
2PL
for logistic regression model,
3PLcg
for 3PL model with fixed guessing for both groups,
3PLdg
for 3PL model with fixed inattention for both groups,
3PLc
(alternatively also 3PL
) for 3PL regression model with guessing parameter,
3PLd
for 3PL model with inattention parameter,
4PLcgdg
for 4PL model with fixed guessing and inattention parameter for both groups,
4PLcgd
(alternatively also 4PLd
) for 4PL model with fixed guessing for both groups,
4PLcdg
(alternatively also 4PLc
) for 4PL model with fixed inattention for both groups,
or 4PL
for 4PL model.
The model
can be specified in more detail with constraints
argument which specifies what parameters should be fixed for both groups. For
example, choice "ad"
means that discrimination (parameter "a"
)
and inattention (parameter "d"
) are fixed for both groups and other
parameters ("b"
and "c"
) are not. The NA
value for
constraints
means no constraints.
Missing values are allowed but discarded for item estimation. They must be
coded as NA
for both, Data
and group
arguments.
In case that model considers difference in guessing or inattention parameter, the different parameterization is used and parameters with standard errors are re-calculated by delta method. However, covariance matrices stick with alternative parameterization.
Value
The difNLR()
function returns an object of class "difNLR"
. The
output including values of the test statistics, p-values, and items detected
as function differently is displayed by the print()
method.
Object of class "difNLR"
is a list with the following components:
Sval
the values of the test statistics.
nlrPAR
the estimates of final model.
nlrSE
the standard errors of estimates of final model.
parM0
the estimates of null model.
seM0
the standard errors of estimates of null model.
covM0
the covariance matrices of estimates of null model.
llM0
log-likelihood of null model.
parM1
the estimates of alternative model.
seM1
the standard errors of estimates of alternative model.
covM1
the covariance matrices of estimates of alternative model.
llM1
log-likelihood of alternative model.
DIFitems
either the column identifiers of the items which were detected as DIF, or
"No DIF item detected"
in case no item was detected as function differently.model
fitted model.
constraints
constraints for the
model
.type
character: type of DIF that was tested. If parameters were specified, the value is
"other"
.types
character: the parameters (specified by user,
type
has value"other"
) which were tested for difference.p.adjust.method
character: method for multiple comparison correction which was applied.
pval
the p-values of the test.
adj.pval
the adjusted p-values of the test using
p.adjust.method
.df
the degress of freedom of the test.
test
used test.
purification
purify
value.nrPur
number of iterations in item purification process. Returned only if
purify
isTRUE
.difPur
a binary matrix with one row per iteration of item purification and one column per item.
"1"
in i-th row and j-th column means that j-th item was identified as DIF in i-th iteration. Returned only ifpurify
isTRUE
.conv.puri
logical: indicating whether item purification process converged before the maximal number
nrIter
of iterations. Returned only ifpurify
isTRUE
.method
used estimation method.
conv.fail
numeric: number of convergence issues.
conv.fail.which
the identifiers of the items which did not converge.
alpha
numeric: significance level.
Data
the data matrix.
group
the vector of group membership.
group.names
names of groups.
match
matching criterion.
For an object of class "difNLR"
several methods are available (e.g.,
methods(class = "difNLR")
).
Author(s)
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
hladka@cs.cas.cz
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
martinkova@cs.cas.cz
Karel Zvara
Faculty of Mathematics and Physics, Charles University
References
Drabinova, A. & Martinkova, P. (2017). Detection of differential item functioning with nonlinear regression: A non-IRT approach accounting for guessing. Journal of Educational Measurement, 54(4), 498–517, doi:10.1111/jedm.12158.
Hladka, A. (2021). Statistical models for detection of differential item functioning. Dissertation thesis. Faculty of Mathematics and Physics, Charles University.
Hladka, A. & Martinkova, P. (2020). difNLR: Generalized logistic regression models for DIF and DDF detection. The R Journal, 12(1), 300–323, doi:10.32614/RJ-2020-014.
Swaminathan, H. & Rogers, H. J. (1990). Detecting differential item functioning using logistic regression procedures. Journal of Educational Measurement, 27(4), 361–370, doi:10.1111/j.1745-3984.1990.tb00754.x
See Also
plot.difNLR
for graphical representation of item characteristic curves and DIF statistics.
coef.difNLR
for extraction of item parameters with their standard errors.
predict.difNLR
for prediction.
fitted.difNLR
and residuals.difNLR
for extraction of fitted
values and residuals.
logLik.difNLR
, AIC.difNLR
, BIC.difNLR
for extraction of log-likelihood and information criteria.
p.adjust
for multiple comparison corrections.
nls
for nonlinear least squares estimation.
startNLR
for calculation of initial values of fitting algorithms in difNLR()
.
Examples
# loading data
data(GMAT)
Data <- GMAT[, 1:20] # items
group <- GMAT[, "group"] # group membership variable
# testing both DIF effects using likelihood-ratio test and
# 3PL model with fixed guessing for groups
(x <- difNLR(Data, group, focal.name = 1, model = "3PLcg"))
## Not run:
# graphical devices
plot(x, item = x$DIFitems)
plot(x, item = "Item1")
plot(x, item = 1, group.names = c("Group 1", "Group 2"))
plot(x, plot.type = "stat")
# coefficients
coef(x)
coef(x, SE = TRUE)
coef(x, SE = TRUE, simplify = TRUE)
# fitted values
fitted(x)
fitted(x, item = 1)
# residuals
residuals(x)
residuals(x, item = 1)
# predicted values
predict(x)
predict(x, item = 1)
# predicted values for new subjects
predict(x, item = 1, match = 0, group = 0)
predict(x, item = 1, match = 0, group = 1)
# AIC, BIC, log-likelihood
AIC(x)
BIC(x)
logLik(x)
# AIC, BIC, log-likelihood for the first item
AIC(x, item = 1)
BIC(x, item = 1)
logLik(x, item = 1)
# testing both DIF effects using Wald test and
# 3PL model with fixed guessing for groups
difNLR(Data, group, focal.name = 1, model = "3PLcg", test = "W")
# testing both DIF effects using F test and
# 3PL model with fixed guessing for groups
difNLR(Data, group, focal.name = 1, model = "3PLcg", test = "F")
# testing both DIF effects using
# 3PL model with fixed guessing for groups and sandwich estimator
# of the covariance matrices
difNLR(Data, group, focal.name = 1, model = "3PLcg", sandwich = TRUE)
# testing both DIF effects using LR test,
# 3PL model with fixed guessing for groups
# and Benjamini-Hochberg correction
difNLR(Data, group, focal.name = 1, model = "3PLcg", p.adjust.method = "BH")
# testing both DIF effects using LR test,
# 3PL model with fixed guessing for groups
# and item purification
difNLR(Data, group, focal.name = 1, model = "3PLcg", purify = TRUE)
# testing both DIF effects using 3PL model with fixed guessing for groups
# and total score as matching criterion
difNLR(Data, group, focal.name = 1, model = "3PLcg", match = "score")
# testing uniform DIF effects using 4PL model with the same
# guessing and inattention
difNLR(Data, group, focal.name = 1, model = "4PLcgdg", type = "udif")
# testing non-uniform DIF effects using 2PL model
difNLR(Data, group, focal.name = 1, model = "2PL", type = "nudif")
# testing difference in parameter b using 4PL model with fixed
# a and c parameters
difNLR(Data, group, focal.name = 1, model = "4PL", constraints = "ac", type = "b")
# testing both DIF effects using LR test,
# 3PL model with fixed guessing for groups
# using maximum likelihood estimation method with L-BFGS-B algorithm
difNLR(Data, group, focal.name = 1, model = "3PLcg", method = "likelihood")
# testing both DIF effects using LR test and 2PL model
# using maximum likelihood estimation method with iteratively reweighted least squares algorithm
difNLR(Data, group, focal.name = 1, model = "2PL", method = "irls")
## End(Not run)