Title: | DIF and DDF Detection by Non-Linear Regression Models |
---|---|
Description: | Detection of differential item functioning (DIF) among dichotomously scored items and differential distractor functioning (DDF) among unscored items with non-linear regression procedures based on generalized logistic regression models (Hladka & Martinkova, 2020, <doi:10.32614/RJ-2020-014>). |
Authors: | Adela Hladka [aut, cre], Patricia Martinkova [aut], Karel Zvara [ctb] |
Maintainer: | Adela Hladka <[email protected]> |
License: | GPL-3 |
Version: | 1.5.1-2 |
Built: | 2025-03-05 10:26:04 UTC |
Source: | https://github.com/adelahladka/difnlr |
The difNLR package provides methods for detecting differential item functioning (DIF) using non-linear regression models. Both uniform and non-uniform DIF effects can be detected when considering a single focal group. Additionally, the method allows for testing differences in guessing or inattention parameters between the reference and focal group. DIF detection is performed using either a likelihood-ratio test, an F-test, or Wald's test of a submodel. The software offers a variety of algorithms for estimating item parameters.
Furthermore, the difNLR package includes methods for detecting differential distractor functioning (DDF) using multinomial log-linear regression model. It also introduces DIF detection approaches for ordinal data via adjacent category logit and cumulative logit regression models.
Package: difNLR
Type: Package
Version: 1.5.1-2
Date: 2025-03-05
Depends: R (>= 4.0.0)
Imports: calculus, ggplot2 (>= 3.4.0), msm, nnet, plyr, stats, VGAM
Suggests: ShinyItemAnalysis, testthat (>= 3.0.0)
License: GPL-3
BugReports: https://github.com/adelahladka/difNLR/issues
Encoding: UTF-8
This package was supported by grant funded by Czech Science foundation under number GJ15-15856Y.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Agresti, A. (2010). Analysis of ordinal categorical data. Second edition. John Wiley & Sons.
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.
Hladka, A., Martinkova, P., & Brabec, M. (2024). New iterative algorithms for estimation of item functioning. Journal of Educational and Behavioral Statistics. Online first, doi:10.3102/10769986241312354.
Kingston, N., Leary, L., & Wightman, L. (1985). An exploratory study of the applicability of item response theory methods to the Graduate Management Admission Test. ETS Research Report Series, 1985(2): 1–64.
Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking equity: Why differential item functioning analysis should be a routine part of developing conceptual assessments. CBE–Life Sciences Education, 16(2), rm2, doi:10.1187/cbe.16-10-0307.
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
Vlckova, K. (2014). Test and item fairness. Master's thesis. Faculty of Mathematics and Physics, Charles University.
Useful links:
Report bugs at https://github.com/adelahladka/difNLR/issues
"ddfMLR"
class.S3 method for extracting estimated model coefficients
from an object of "ddfMLR"
class.
## S3 method for class 'ddfMLR' coef(object, SE = FALSE, simplify = FALSE, IRTpars = TRUE, CI = 0.95, ...)
## S3 method for class 'ddfMLR' coef(object, SE = FALSE, simplify = FALSE, IRTpars = TRUE, CI = 0.95, ...)
object |
an object of |
SE |
logical: should the standard errors of estimated
parameters be also returned? (default is |
simplify |
logical: should the estimated parameters be
simplified to a matrix? (default is |
IRTpars |
logical: should the estimated parameters be returned
in IRT parameterization? (default is |
CI |
numeric: level of confidence interval for parameters,
default is |
... |
other generic parameters for |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
ddfMLR
for DDF detection among nominal data. coef
for generic function extracting model coefficients.
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # estimated parameters coef(x) # includes standard errors coef(x, SE = TRUE) # includes standard errors and simplifies to matrix coef(x, SE = TRUE, simplify = TRUE) # intercept-slope parameterization coef(x, IRTpars = FALSE) # intercept-slope parameterization, simplifies to matrix, turn off confidence intervals coef(x, IRTpars = FALSE, simplify = TRUE, CI = 0) ## End(Not run)
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # estimated parameters coef(x) # includes standard errors coef(x, SE = TRUE) # includes standard errors and simplifies to matrix coef(x, SE = TRUE, simplify = TRUE) # intercept-slope parameterization coef(x, IRTpars = FALSE) # intercept-slope parameterization, simplifies to matrix, turn off confidence intervals coef(x, IRTpars = FALSE, simplify = TRUE, CI = 0) ## End(Not run)
"difNLR"
class.S3 method for extracting the item parameter estimates from an object of the "difNLR"
class.
## S3 method for class 'difNLR' coef( object, item = "all", SE = FALSE, simplify = FALSE, IRTpars = TRUE, CI = 0.95, ... )
## S3 method for class 'difNLR' coef( object, item = "all", SE = FALSE, simplify = FALSE, IRTpars = TRUE, CI = 0.95, ... )
object |
an object of the |
item |
numeric or character: either character |
SE |
logical: should the standard errors of the estimated item parameters
be also returned? (the default is |
simplify |
logical: should the estimated item parameters be simplified to a
matrix? (the default is |
IRTpars |
logical: should the estimated item parameters be returned in he
IRT parameterization? (the default is |
CI |
numeric: a significance level for confidence intervals (CIs) of item
parameter estimates (the default is |
... |
other generic parameters for the |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Karel Zvara
Faculty of Mathematics and Physics, Charles University
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. & 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.
difNLR
for DIF detection among binary data using the generalized logistic regression model. coef
for a generic function for extracting parameter estimates.
## Not run: # 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")) # estimated parameters coef(x) # includes standard errors coef(x, SE = TRUE) # includes standard errors and simplifies to matrix coef(x, SE = TRUE, simplify = TRUE) # intercept-slope parameterization coef(x, IRTpars = FALSE) # intercept-slope parameterization, simplifies to matrix, turn off confidence intervals coef(x, IRTpars = FALSE, simplify = TRUE, CI = 0) # for DIF items only coef(x, item = x$DIFitems, IRTpars = FALSE, simplify = TRUE, CI = 0) ## End(Not run)
## Not run: # 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")) # estimated parameters coef(x) # includes standard errors coef(x, SE = TRUE) # includes standard errors and simplifies to matrix coef(x, SE = TRUE, simplify = TRUE) # intercept-slope parameterization coef(x, IRTpars = FALSE) # intercept-slope parameterization, simplifies to matrix, turn off confidence intervals coef(x, IRTpars = FALSE, simplify = TRUE, CI = 0) # for DIF items only coef(x, item = x$DIFitems, IRTpars = FALSE, simplify = TRUE, CI = 0) ## End(Not run)
"difORD"
class.S3 method for extracting estimated model coefficients
from an object of "difORD"
class.
## S3 method for class 'difORD' coef(object, SE = FALSE, simplify = FALSE, IRTpars = TRUE, CI = 0.95, ...)
## S3 method for class 'difORD' coef(object, SE = FALSE, simplify = FALSE, IRTpars = TRUE, CI = 0.95, ...)
object |
an object of |
SE |
logical: should the standard errors of estimated
parameters be also returned? (default is |
simplify |
logical: should the estimated parameters be
simplified to a matrix? (default is |
IRTpars |
logical: should the estimated parameters be returned
in IRT parameterization? (default is |
CI |
numeric: level of confidence interval for parameters,
default is |
... |
other generic parameters for |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
difORD
for DIF detection among ordinal data. coef
for generic function extracting model coefficients.
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # estimated parameters coef(x) # includes standard errors coef(x, SE = TRUE) # includes standard errors and simplifies to matrix coef(x, SE = TRUE, simplify = TRUE) # intercept-slope parameterization coef(x, IRTpars = FALSE) # intercept-slope parameterization, simplifies to matrix, turn off confidence intervals coef(x, IRTpars = FALSE, simplify = TRUE, CI = 0) ## End(Not run)
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # estimated parameters coef(x) # includes standard errors coef(x, SE = TRUE) # includes standard errors and simplifies to matrix coef(x, SE = TRUE, simplify = TRUE) # intercept-slope parameterization coef(x, IRTpars = FALSE) # intercept-slope parameterization, simplifies to matrix, turn off confidence intervals coef(x, IRTpars = FALSE, simplify = TRUE, CI = 0) ## End(Not run)
Performs DDF detection procedure for nominal data based on multinomial log-linear regression model and likelihood ratio test of a submodel.
ddfMLR(Data, group, focal.name, key, type = "both", match = "zscore", anchor = NULL, purify = FALSE, nrIter = 10, p.adjust.method = "none", alpha = 0.05, parametrization)
ddfMLR(Data, group, focal.name, key, type = "both", match = "zscore", anchor = NULL, purify = FALSE, nrIter = 10, p.adjust.method = "none", alpha = 0.05, parametrization)
Data |
data.frame or matrix: dataset which rows represent
unscored examinee answers (nominal) and columns correspond to the
items. In addition, |
group |
numeric or character: a dichotomous vector of the same
length as |
focal.name |
numeric or character: indicates the level of
|
key |
character: the answer key. Each element corresponds to the correct answer of one item. |
type |
character: type of DDF to be tested. Either
|
match |
numeric or character: matching criterion to be used as
an estimate of trait. Can be either |
anchor |
numeric or character: specification of DDF 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). |
p.adjust.method |
character: method for multiple comparison
correction. Possible values are |
alpha |
numeric: significance level (default is 0.05). |
parametrization |
deprecated. Use
|
Performs DDF detection procedure for nominal data based on
multinomial log-linear regression model and likelihood ratio test
of submodel. Probability of selection the -th category
(distractor) is
where is by default standardized total score (also called
Z-score) and
is a group membership. Parameters
and
are discrimination and difficulty for the
-th
category. Terms
and
then represent
differences between two groups (reference and focal) in relevant
parameters. Probability of correct answer (specified in argument
key
) is
Parameters are estimated via neural networks. For more details see
multinom
.
Missing values are allowed but discarded for item estimation. They
must be coded as NA
for both, Data
and group
arguments.
The ddfMLR()
function returns an object of class
"ddfMLR"
. The output including values of the test
statistics, p-values, and items marked as DDF is displayed by the
print()
method.
A list of class "ddfMLR"
with the following arguments:
Sval
the values of likelihood ratio test statistics.
mlrPAR
the estimates of final model.
mlrSE
standard errors of the estimates of final model.
parM0
the estimates of null model.
parM1
the estimates of alternative model.
llM0
log-likelihood of null model.
llM1
log-likelihood of alternative model.
AIC0
AIC of null model.
AIC1
AIC of alternative model.
BIC0
BIC of null model.
BIC1
BIC of alternative model.
DDFitems
either the column identifiers of the items which were detected as DDF, or
"No DDF item detected"
in case no item was detected as DDF.
type
character: type of DDF that was tested.
purification
purify
value.
nrPur
number of iterations in item purification process. Returned only if purify
is TRUE
.
ddfPur
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 DDF in i-th iteration. Returned only
if purify
is TRUE
.
conv.puri
logical indicating whether item purification process converged before the maximal number
nrIter
of iterations. Returned only if purify
is TRUE
.
p.adjust.method
character: method for multiple comparison correction which was applied.
pval
the p-values by likelihood ratio test.
adj.pval
the adjusted p-values by likelihood ratio test using p.adjust.method
.
df
the degress of freedom of likelihood ratio test.
alpha
numeric: significance level.
Data
the data matrix.
group
the vector of group membership.
group.names
levels of grouping variable.
key
key of correct answers.
match
matching criterion.
For an object of class "ddfMLR"
several methods are available (e.g. methods(class = "ddfMLR")
).
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Agresti, A. (2010). Analysis of ordinal categorical data. Second edition. John Wiley & Sons.
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.
plot.ddfMLR
for graphical representation of item characteristic curves. coef.ddfMLR
for extraction of item parameters with their standard errors. logLik.ddfMLR
, AIC.ddfMLR
, BIC.ddfMLR
for extraction of log-likelihood and information criteria.
p.adjust
for multiple comparison corrections. multinom
for estimation function using neural networks.
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # graphical devices plot(x, item = "Item1", group.names = c("Group 1", "Group 2")) plot(x, item = x$DDFitems) plot(x, item = 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) # estimated parameters coef(x) coef(x, SE = TRUE) coef(x, SE = TRUE, simplify = TRUE) # testing both DDF effects with Benjamini-Hochberg adjustment method ddfMLR(Data, group, focal.name = 1, key, p.adjust.method = "BH") # testing both DDF effects with item purification ddfMLR(Data, group, focal.name = 1, key, purify = TRUE) # testing uniform DDF effects ddfMLR(Data, group, focal.name = 1, key, type = "udif") # testing non-uniform DDF effects ddfMLR(Data, group, focal.name = 1, key, type = "nudif") # testing both DDF effects with total score as matching criterion ddfMLR(Data, group, focal.name = 1, key, match = "score") ## End(Not run)
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # graphical devices plot(x, item = "Item1", group.names = c("Group 1", "Group 2")) plot(x, item = x$DDFitems) plot(x, item = 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) # estimated parameters coef(x) coef(x, SE = TRUE) coef(x, SE = TRUE, simplify = TRUE) # testing both DDF effects with Benjamini-Hochberg adjustment method ddfMLR(Data, group, focal.name = 1, key, p.adjust.method = "BH") # testing both DDF effects with item purification ddfMLR(Data, group, focal.name = 1, key, purify = TRUE) # testing uniform DDF effects ddfMLR(Data, group, focal.name = 1, key, type = "udif") # testing non-uniform DDF effects ddfMLR(Data, group, focal.name = 1, key, type = "nudif") # testing both DDF effects with total score as matching criterion ddfMLR(Data, group, focal.name = 1, key, match = "score") ## End(Not run)
Performs DIF detection procedure in 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.
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)
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)
Data |
data.frame or matrix: dataset in which rows represent scored
examinee answers ( |
group |
numeric or character: a binary vector of the same length as
|
focal.name |
numeric or character: indicates the level of the |
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: an estimation method to be applied. The options are
|
match |
character or numeric: matching criterion to be used as
an estimate of the trait. It can be either |
anchor |
character or numeric: specification of DIF free items. Either
|
purify |
logical: should the item purification be applied? (the default is
|
nrIter |
numeric: the maximal number of iterations in the item purification (the default is 10). |
test |
character: a statistical test to be performed for DIF detection.
Can be either |
alpha |
numeric: a significance level (the default is 0.05). |
p.adjust.method |
character: a method for a multiple comparison
correction. Possible values are |
start |
numeric: initial values for the estimation of item parameters. If
not specified, starting values are calculated with the
|
initboot |
logical: in the case of convergence issues, should starting
values be re-calculated based on bootstrapped samples? (the default is
|
nrBo |
numeric: the maximal number of iterations for the calculation of starting values using bootstrapped samples (the default is 20). |
sandwich |
logical: should the sandwich estimator be applied for
computation of the covariance matrix of item parameters when using
|
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 the 4PL generalized logistic regression model for
probability of correct answer (i.e., ) using IRT
parameterization is
where is the matching criterion (e.g., standardized total score)
and
is a group membership variable for respondent
.
Parameters
,
,
, and
are
discrimination, difficulty, guessing, and inattention for the reference group
for item
. Terms
and
then
represent differences between the focal and reference groups in
discrimination and difficulty for item
. Terms
, and
are guessing and inattention parameters for the focal group for
item
. In the case that there is no assumed difference between the
reference and focal group in the guessing or inattention parameters, the
terms
and
are used.
Alternatively, intercept-slope parameterization may be applied:
where parameters are
intercept, effect of the matching criterion, effect of the group membership,
and their mutual interaction, respectively.
The model
and constraints
arguments can further constrain the
4PL model. The arguments model
and constraints
can also be
combined. Both arguments can be specified as a single value (for all items)
or as an item-specific vector (where each element corresponds 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 set the same 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 underlying generalized logistic regression model can be further specified in
more detail with the constraints
argument which specifies what parameters
should be fixed for both groups. For example, a choice "ad"
means that
discrimination (parameter "a"
) and inattention (parameter "d"
) are
fixed (and estimated 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 an item estimation. They must be
coded as NA
for both, the Data
and group
arguments.
The function uses intercept-slope parameterization for the estimation via the
estimNLR
function. Item parameters are then
re-calculated into the IRT parameterization using the delta method.
The function offers either the non-linear least squares estimation via the
nls
function (Drabinova & Martinkova, 2017; Hladka &
Martinkova, 2020), the maximum likelihood method with the "L-BFGS-B"
algorithm with constraints via the optim
function (Hladka &
Martinkova, 2020), the maximum likelihood method with the EM algorithm (Hladka,
Martinkova, & Brabec, 2024), the maximum likelihood method with the algorithm
based on parametric link function (PLF, the default option; Hladka, Martinkova,
& Brabec, 2024), or the maximum likelihood method with the iteratively
reweighted least squares algorithm via the glm
function.
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 item parameter estimates of the final model.
nlrSE
the standard errors of the item parameter estimates of the final model.
parM0
the item parameter estimates of the null (smaller) model.
seM0
the standard errors of item parameter estimates of the null (smaller) model.
covM0
the covariance matrices of the item parameter estimates of the null (smaller) model.
llM0
the log-likelihood values of the null (smaller) model.
parM1
the item parameter estimates of the alternative (larger) model.
seM1
the standard errors of the item parameter estimates of the alternative (larger) model.
covM1
the covariance matrices of the item parameter estimates of alternative (larger) model.
llM1
the log-likelihood values of the alternative (larger) model.
DIFitems
either the column identifiers of the items which were detected as DIF, or "No DIF item detected"
in the 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 a combination of the item parameters was 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: a method for the multiple comparison correction which was applied.
pval
the p-values by the test
.
adjusted.pval
adjusted p-values by the p.adjust.method
.
df
the degrees of freedom of the test
.
test
used test.
purification
purify
value.
nrPur
number of iterations in item purification process. Returned only if purify
is TRUE
.
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 if purify
is TRUE
.
conv.puri
logical: indicating whether item purification process converged before the maximal number nrIter
of iterations. Returned only if purify
is TRUE
.
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.
Several methods are available for an object of the "difNLR"
class (e.g.,
methods(class = "difNLR")
).
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Karel Zvara
Faculty of Mathematics and Physics, Charles University
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.
Hladka, A., Martinkova, P., & Brabec, M. (2024). New iterative algorithms for estimation of item functioning. Journal of Educational and Behavioral Statistics. Online first, doi:10.3102/10769986241312354.
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
plot.difNLR
for a graphical representation of item characteristic curves and DIF statistics. coef.difNLR
for an extraction of item parameters with their standard errors in various parameterizations. predict.difNLR
for prediction. fitted.difNLR
and residuals.difNLR
for an extraction of fitted
values and residuals. logLik.difNLR
, AIC.difNLR
, BIC.difNLR
for an extraction of log-likelihood values and information criteria.
p.adjust
for multiple comparison corrections. nls
for a nonlinear least squares estimation. startNLR
for a calculation of initial values of fitting algorithms in difNLR()
.
# 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) coef(x, item = 1, CI = 0) # 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 = c(0, 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 with # the L-BFGS-B algorithm, the EM algorithm, and the PLF algorithm difNLR(Data, group, focal.name = 1, model = "3PLcg", method = "mle") difNLR(Data, group, focal.name = 1, model = "3PLcg", method = "em") difNLR(Data, group, focal.name = 1, model = "3PLcg", method = "plf") # testing both DIF effects using LR test and 2PL model # using maximum likelihood estimation with iteratively reweighted least squares algorithm difNLR(Data, group, focal.name = 1, model = "2PL", method = "irls") ## End(Not run)
# 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) coef(x, item = 1, CI = 0) # 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 = c(0, 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 with # the L-BFGS-B algorithm, the EM algorithm, and the PLF algorithm difNLR(Data, group, focal.name = 1, model = "3PLcg", method = "mle") difNLR(Data, group, focal.name = 1, model = "3PLcg", method = "em") difNLR(Data, group, focal.name = 1, model = "3PLcg", method = "plf") # testing both DIF effects using LR test and 2PL model # using maximum likelihood estimation with iteratively reweighted least squares algorithm difNLR(Data, group, focal.name = 1, model = "2PL", method = "irls") ## End(Not run)
Performs DIF detection procedure for ordinal data based either on adjacent category logit model or on cumulative logit model and likelihood ratio test of a submodel.
difORD(Data, group, focal.name, model = "adjacent", type = "both", match = "zscore", anchor = NULL, purify = FALSE, nrIter = 10, p.adjust.method = "none", alpha = 0.05, parametrization)
difORD(Data, group, focal.name, model = "adjacent", type = "both", match = "zscore", anchor = NULL, purify = FALSE, nrIter = 10, p.adjust.method = "none", alpha = 0.05, parametrization)
Data |
data.frame or matrix: dataset which rows represent
ordinally scored examinee answers and columns correspond to the
items. In addition, |
group |
numeric or character: a dichotomous vector of the same
length as |
focal.name |
numeric or character: indicates the level of
|
model |
character: logistic regression model for ordinal data
(either |
type |
character: type of DIF to be tested. Either
|
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). |
p.adjust.method |
character: method for multiple comparison
correction. Possible values are |
alpha |
numeric: significance level (default is 0.05). |
parametrization |
deprecated. Use
|
Calculates DIF likelihood ratio statistics based either on adjacent category logit model or on cumulative logit model for ordinal data.
Using adjacent category logit model, logarithm of ratio of probabilities of two adjacent categories is
where is by default standardized total score (also called
Z-score) and
is a group membership.
Using cumulative logit model, probability of gaining at least
points is given by 2PL model, i.e.,
The category probability (i.e., probability of gaining exactly
points) is then
.
Both models are estimated by iteratively reweighted least squares.
For more details see vglm
.
Missing values are allowed but discarded for item estimation. They
must be coded as NA
for both, Data
and group
parameters.
The difORD()
function returns an object of class
"difORD"
. The output including values of the test
statistics, p-values, and items marked as DIF is displayed by the
print()
method.
A list of class "difORD"
with the following arguments:
Sval
the values of likelihood ratio test statistics.
ordPAR
the estimates of the final model.
ordSE
standard errors of the estimates of the final model.
parM0
the estimates of null model.
parM1
the estimates of alternative model.
llM0
log-likelihood of null model.
llM1
log-likelihood of alternative model.
AICM0
AIC of null model.
AICM1
AIC of alternative model.
BICM0
BIC of null model.
BICM1
BIC 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 DIF.
model
model used for DIF detection.
type
character: type of DIF that was tested.
purification
purify
value.
nrPur
number of iterations in item purification process. Returned only if purify
is TRUE
.
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
if purify
is TRUE
.
conv.puri
logical indicating whether item purification process converged before the maximal number
nrIter
of iterations. Returned only if purify
is TRUE
.
p.adjust.method
character: method for multiple comparison correction which was applied.
pval
the p-values by likelihood ratio test.
adj.pval
the adjusted p-values by likelihood ratio test using p.adjust.method
.
df
the degress of freedom of likelihood ratio test.
alpha
numeric: significance level.
Data
the data matrix.
group
the vector of group membership.
group.names
levels of grouping variable.
match
matching criterion.
For an object of class "difORD"
several methods are available (e.g., methods(class = "difORD")
).
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Agresti, A. (2010). Analysis of ordinal categorical data. Second edition. John Wiley & Sons.
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.
plot.difORD
for graphical representation of item characteristic curves. coef.difORD
for extraction of item parameters with their standard errors. predict.difORD
for calculation of predicted values. logLik.difORD
, AIC.difORD
, BIC.difORD
for extraction of log-likelihood and information criteria.
p.adjust
for multiple comparison corrections. vglm
for estimation function using iteratively reweighted least squares.
# loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) ## Not run: # graphical devices plot(x, item = 6) plot(x, item = "R6") plot(x, item = "R6", group.names = c("Males", "Females")) # estimated parameters coef(x) coef(x, SE = TRUE) # with SE coef(x, SE = TRUE, simplify = TRUE) # with SE, simplified # 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 with Benjamini-Hochberg adjustment method difORD(Data, group, focal.name = 1, model = "adjacent", p.adjust.method = "BH") # testing both DIF effects with item purification difORD(Data, group, focal.name = 1, model = "adjacent", purify = TRUE) # testing uniform DIF effects difORD(Data, group, focal.name = 1, model = "adjacent", type = "udif") # testing non-uniform DIF effects difORD(Data, group, focal.name = 1, model = "adjacent", type = "nudif") # testing both DIF effects with total score as matching criterion difORD(Data, group, focal.name = 1, model = "adjacent", match = "score") testing both DIF effects with cumulative logit model (x <- difORD(Data, group, focal.name = 1, model = "cumulative")) # graphical devices plot(x, item = 7, plot.type = "cumulative") plot(x, item = 7, plot.type = "category") # estimated parameters coef(x, simplify = TRUE) ## End(Not run)
# loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) ## Not run: # graphical devices plot(x, item = 6) plot(x, item = "R6") plot(x, item = "R6", group.names = c("Males", "Females")) # estimated parameters coef(x) coef(x, SE = TRUE) # with SE coef(x, SE = TRUE, simplify = TRUE) # with SE, simplified # 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 with Benjamini-Hochberg adjustment method difORD(Data, group, focal.name = 1, model = "adjacent", p.adjust.method = "BH") # testing both DIF effects with item purification difORD(Data, group, focal.name = 1, model = "adjacent", purify = TRUE) # testing uniform DIF effects difORD(Data, group, focal.name = 1, model = "adjacent", type = "udif") # testing non-uniform DIF effects difORD(Data, group, focal.name = 1, model = "adjacent", type = "nudif") # testing both DIF effects with total score as matching criterion difORD(Data, group, focal.name = 1, model = "adjacent", match = "score") testing both DIF effects with cumulative logit model (x <- difORD(Data, group, focal.name = 1, model = "cumulative")) # graphical devices plot(x, item = 7, plot.type = "cumulative") plot(x, item = 7, plot.type = "category") # estimated parameters coef(x, simplify = TRUE) ## End(Not run)
Estimates parameters of non-linear regression models for DIF detection using either non-linear least squares or maximum likelihood method with various algorithms.
estimNLR(y, match, group, formula, method, lower, upper, start) ## S3 method for class 'estimNLR' logLik(object, ...) ## S3 method for class 'estimNLR' coef(object, ...) ## S3 method for class 'estimNLR' fitted(object, ...) ## S3 method for class 'estimNLR' residuals(object, ...) ## S3 method for class 'estimNLR' print(x, ...) ## S3 method for class 'estimNLR' vcov(object, sandwich = FALSE, ...)
estimNLR(y, match, group, formula, method, lower, upper, start) ## S3 method for class 'estimNLR' logLik(object, ...) ## S3 method for class 'estimNLR' coef(object, ...) ## S3 method for class 'estimNLR' fitted(object, ...) ## S3 method for class 'estimNLR' residuals(object, ...) ## S3 method for class 'estimNLR' print(x, ...) ## S3 method for class 'estimNLR' vcov(object, sandwich = FALSE, ...)
y |
numeric: a binary vector of responses ( |
match |
numeric: a numeric vector describing the matching criterion. |
group |
numeric: a binary vector of a group membership ( |
formula |
formula: specification of the model. It can be obtained by the
|
method |
character: an estimation method to be applied. The options are
|
lower |
numeric: lower bounds for item parameters of the model specified
in the |
upper |
numeric: upper bounds for item parameters of the model specified
in the |
start |
numeric: initial values of item parameters. They can be obtained
by the |
object |
an object of the |
... |
other generic parameters for S3 methods. |
x |
an object of the |
sandwich |
logical: should the sandwich estimator be applied for
computation of the covariance matrix of item parameters when using
|
The function offers either the non-linear least squares estimation via the
nls
function (Drabinova & Martinkova, 2017; Hladka &
Martinkova, 2020), the maximum likelihood method with the "L-BFGS-B"
algorithm with constraints via the optim
function (Hladka &
Martinkova, 2020), the maximum likelihood method with the EM algorithm (Hladka,
Martinkova, & Brabec, 2024), the maximum likelihood method with the algorithm
based on parametric link function (PLF; Hladka, Martinkova, & Brabec, 2024), or
the maximum likelihood method with the iteratively reweighted least squares
algorithm via the glm
function.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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. & 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.
Hladka, A. (2021). Statistical models for detection of differential item functioning. Dissertation thesis. Faculty of Mathematics and Physics, Charles University.
Hladka, A., Martinkova, P., & Brabec, M. (2024). New iterative algorithms for estimation of item functioning. Journal of Educational and Behavioral Statistics. Online first, doi:10.3102/10769986241312354.
# loading data data(GMAT) y <- GMAT[, 1] # item 1 match <- scale(rowSums(GMAT[, 1:20])) # standardized total score group <- GMAT[, "group"] # group membership variable # formula for 3PL model with the same guessing for both groups, # IRT parameterization M <- formulaNLR(model = "3PLcg", type = "both", parameterization = "irt") # starting values for 3PL model with the same guessing for item 1 start <- startNLR(GMAT[, 1:20], group, model = "3PLcg", parameterization = "irt") start <- start[[1]][M$M1$parameters] # nonlinear least squares (fit_nls <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "nls", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_nls) logLik(fit_nls) vcov(fit_nls) vcov(fit_nls, sandwich = TRUE) fitted(fit_nls) residuals(fit_nls) # maximum likelihood method (fit_mle <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "mle", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_mle) logLik(fit_mle) vcov(fit_mle) fitted(fit_mle) residuals(fit_mle) # formula for 3PL model with the same guessing for both groups # intercept-slope parameterization M <- formulaNLR(model = "3PLcg", type = "both", parameterization = "is") # starting values for 3PL model with the same guessing for item 1, start <- startNLR(GMAT[, 1:20], group, model = "3PLcg", parameterization = "is") start <- start[[1]][M$M1$parameters] # EM algorithm (fit_em <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "em", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_em) logLik(fit_em) vcov(fit_em) fitted(fit_em) residuals(fit_em) # PLF algorithm (fit_plf <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "plf", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_plf) logLik(fit_plf) vcov(fit_plf) fitted(fit_plf) residuals(fit_plf) # iteratively reweighted least squares for 2PL model M <- formulaNLR(model = "2PL", parameterization = "logistic") (fit_irls <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "irls" )) coef(fit_irls) logLik(fit_irls) vcov(fit_irls) fitted(fit_irls) residuals(fit_irls)
# loading data data(GMAT) y <- GMAT[, 1] # item 1 match <- scale(rowSums(GMAT[, 1:20])) # standardized total score group <- GMAT[, "group"] # group membership variable # formula for 3PL model with the same guessing for both groups, # IRT parameterization M <- formulaNLR(model = "3PLcg", type = "both", parameterization = "irt") # starting values for 3PL model with the same guessing for item 1 start <- startNLR(GMAT[, 1:20], group, model = "3PLcg", parameterization = "irt") start <- start[[1]][M$M1$parameters] # nonlinear least squares (fit_nls <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "nls", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_nls) logLik(fit_nls) vcov(fit_nls) vcov(fit_nls, sandwich = TRUE) fitted(fit_nls) residuals(fit_nls) # maximum likelihood method (fit_mle <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "mle", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_mle) logLik(fit_mle) vcov(fit_mle) fitted(fit_mle) residuals(fit_mle) # formula for 3PL model with the same guessing for both groups # intercept-slope parameterization M <- formulaNLR(model = "3PLcg", type = "both", parameterization = "is") # starting values for 3PL model with the same guessing for item 1, start <- startNLR(GMAT[, 1:20], group, model = "3PLcg", parameterization = "is") start <- start[[1]][M$M1$parameters] # EM algorithm (fit_em <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "em", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_em) logLik(fit_em) vcov(fit_em) fitted(fit_em) residuals(fit_em) # PLF algorithm (fit_plf <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "plf", lower = M$M1$lower, upper = M$M1$upper, start = start )) coef(fit_plf) logLik(fit_plf) vcov(fit_plf) fitted(fit_plf) residuals(fit_plf) # iteratively reweighted least squares for 2PL model M <- formulaNLR(model = "2PL", parameterization = "logistic") (fit_irls <- estimNLR( y = y, match = match, group = group, formula = M$M1$formula, method = "irls" )) coef(fit_irls) logLik(fit_irls) vcov(fit_irls) fitted(fit_irls) residuals(fit_irls)
"difNLR"
class.S3 methods for extracting fitted values and residuals for an object of the
"difNLR"
class.
## S3 method for class 'difNLR' fitted(object, item = "all", ...) ## S3 method for class 'difNLR' residuals(object, item = "all", ...)
## S3 method for class 'difNLR' fitted(object, item = "all", ...) ## S3 method for class 'difNLR' residuals(object, item = "all", ...)
object |
an object of the |
item |
numeric or character: either character |
... |
other generic parameters for S3 methods. |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Karel Zvara
Faculty of Mathematics and Physics, Charles University
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. & 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.
difNLR
for DIF detection among binary data using the generalized logistic regression model. fitted
for a generic function extracting fitted values. residuals
for a generic function extracting residuals.
## Not run: # 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")) # fitted values fitted(x) fitted(x, item = 1) fitted(x, item = x$DIFitems) # residuals residuals(x) residuals(x, item = 1) residuals(x, item = x$DIFitems) ## End(Not run)
## Not run: # 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")) # fitted values fitted(x) fitted(x, item = 1) fitted(x, item = x$DIFitems) # residuals residuals(x) residuals(x, item = 1) residuals(x, item = x$DIFitems) ## End(Not run)
The function returns the formula of the non-linear regression DIF model based on model specification and DIF type to be tested.
formulaNLR(model, constraints = NULL, type = "all", parameterization = "irt", outcome)
formulaNLR(model, constraints = NULL, type = "all", parameterization = "irt", outcome)
model |
character: generalized logistic regression model for which starting values should be estimated. 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
|
parameterization |
character: parameterization of regression
coefficients. Possible options are |
outcome |
character: name of outcome to be printed in formula. If not
specified |
The unconstrained form of the 4PL generalized logistic regression model for
probability of correct answer (i.e., ) using IRT parameterization
is
where is the matching criterion (e.g., standardized total score) and
is a group membership variable for respondent
.
Parameters
,
,
, and
are discrimination, difficulty, guessing, and inattention for the reference
group for item
. Terms
and
then represent differences between the focal and reference groups in
discrimination and difficulty for item
. Terms
, and
are guessing and inattention parameters for the focal group for
item
. In the case that there is no assumed difference between the
reference and focal group in the guessing or inattention parameters, the terms
and
are used.
Alternatively, intercept-slope parameterization may be applied:
where parameters are
intercept, effect of the matching criterion, effect of the group membership,
and their mutual interaction, respectively.
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 set the same 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.
Three possible parameterizations can be specified in the
"parameterization"
argument: "irt"
returns the IRT parameters
of the reference group and differences in these parameters between the
reference and focal group. Parameters of asymptotes are printed separately
for the reference and focal groups. "is"
returns intercept-slope
parameterization. Parameters of asymptotes are again printed separately for
the reference and focal groups. "logistic"
returns parameters in
logistic regression parameterization as in the glm
function, and it is available only for the 2PL model.
A list of two models. Each includes a formula, parameters to be estimated, and their lower and upper constraints.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
# 3PL model with the same guessing parameter for both groups # to test both types of DIF formulaNLR(model = "3PLcg", type = "both") formulaNLR(model = "3PLcg", type = "both", parameterization = "is") # 4PL model with the same guessing and inattention parameters # to test uniform DIF formulaNLR(model = "4PLcgdg", type = "udif") formulaNLR(model = "4PLcgdg", type = "udif", parameterization = "is") # 2PL model to test non-uniform DIF formulaNLR(model = "2PL", type = "nudif") formulaNLR(model = "2PL", type = "nudif", parameterization = "is") formulaNLR(model = "2PL", type = "nudif", parameterization = "logistic") # 4PL model to test all possible DIF formulaNLR(model = "4PL", type = "all", parameterization = "irt") formulaNLR(model = "4PL", type = "all", parameterization = "is") # 4PL model with fixed a and c parameters # to test difference in b formulaNLR(model = "4PL", constraints = "ac", type = "b") formulaNLR(model = "4PL", constraints = "ac", type = "b", parameterization = "is")
# 3PL model with the same guessing parameter for both groups # to test both types of DIF formulaNLR(model = "3PLcg", type = "both") formulaNLR(model = "3PLcg", type = "both", parameterization = "is") # 4PL model with the same guessing and inattention parameters # to test uniform DIF formulaNLR(model = "4PLcgdg", type = "udif") formulaNLR(model = "4PLcgdg", type = "udif", parameterization = "is") # 2PL model to test non-uniform DIF formulaNLR(model = "2PL", type = "nudif") formulaNLR(model = "2PL", type = "nudif", parameterization = "is") formulaNLR(model = "2PL", type = "nudif", parameterization = "logistic") # 4PL model to test all possible DIF formulaNLR(model = "4PL", type = "all", parameterization = "irt") formulaNLR(model = "4PL", type = "all", parameterization = "is") # 4PL model with fixed a and c parameters # to test difference in b formulaNLR(model = "4PL", constraints = "ac", type = "b") formulaNLR(model = "4PL", constraints = "ac", type = "b", parameterization = "is")
Generates dichotomous, nominal, and ordinal data based on generalized logistic regression models for DIF and DDF detection.
genNLR(N = 1000, ratio = 1, itemtype = "dich", a, b, c, d, mu = 0, sigma = 1)
genNLR(N = 1000, ratio = 1, itemtype = "dich", a, b, c, d, mu = 0, sigma = 1)
N |
numeric: number of rows representing respondents. (default is 1000). |
ratio |
numeric: ratio of respondents number in reference and focal group. |
itemtype |
character: type of items to be generated. Options are |
a |
numeric: matrix representing discriminations with m rows (where m is number of items). Needs to be provided. See Details. |
b |
numeric: numeric: matrix representing difficulties with m rows (where m is number of items). Needs to be provided. See Details. |
c |
numeric: matrix representing guessings (lower asymptotes) with m rows
(where m is number of items). Default is |
d |
numeric: matrix representing inattentions (upper asymptotes) with m rows
(where m is number of items). Default is |
mu |
numeric: a mean vector of the underlying distribution. The first value corresponds to reference group, the second to focal group. Default is 0 value for both groups. |
sigma |
numeric: a standard deviation vector of the underlying distribution. The first value corresponds to reference group, the second to focal group. Default is 1 value for both groups. |
The a
, b
, c
and d
are numeric matrices with m rows (where m is number of items)
representing parameters of regression models for DIF and DDF detection.
For option itemtype = "dich"
, matrices should have two columns. The first column represents
parameters of the reference group and the second of the focal group. In case that only one column is
provided, parameters are set to be the same for both groups.
For options itemtype = "nominal"
and itemtype = "ordinal"
, matrices c
and d
are ignored. Matrices a
and b
contain parameters for distractors. For example, when
item with 4 different choices is supposed to be generated, user provide matrices with 6 columns.
First 3 columns correspond to distractors parameters for reference group and last three columns
for focal group. The number of choices can differ for items. Matrices a
and b
need to consist of as many columns as is the maximum number of distractors. Items with less
choices can contain NAs.
A data.frame
containing N
rows representing respondents and m + 1
columns representing
m
items. The last column is group membership variable with coding "0"
for reference group and
"1"
for focal group.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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.
# seed set.seed(123) # generating parameters for dichotomous data with DIF, 5 items a <- matrix(runif(10, 0.8, 2), ncol = 2) b <- matrix(runif(10, -2, 2), ncol = 2) c <- matrix(runif(10, 0, 0.25), ncol = 2) d <- matrix(runif(10, 0.8, 1), ncol = 2) # generating dichotomous data set with 300 observations (150 each group) genNLR(N = 300, a = a, b = b, c = c, d = d) # generating dichotomous data set with 300 observations (150 each group) # and different mean and standard deviation for underlying distribution genNLR(N = 300, a = a, b = b, c = c, d = d, mu = c(1, 0), sigma = c(1, 2)) # generating dichotomous data set with 300 observations (250 reference group, 50 focal) genNLR(N = 300, ratio = 5, a = a, b = b, c = c, d = d) # generating parameters for nominal data with DDF, 5 items, # each item 3 choices a <- matrix(runif(20, 0.8, 2), ncol = 4) b <- matrix(runif(20, -2, 2), ncol = 4) # generating nominal data set with 300 observations (150 each group) genNLR(N = 300, itemtype = "nominal", a = a, b = b) # generating nominal data set with 300 observations (250 reference group, 50 focal) genNLR(N = 300, itemtype = "nominal", ratio = 5, a = a, b = b) # generating parameters for nominal data with DDF, 5 items, # items 1 and 2 have 2 choices, items 3, 4 and 5 have 3 choices a <- matrix(runif(20, 0.8, 2), ncol = 4) a[1:2, c(2, 4)] <- NA b <- matrix(runif(20, -2, 2), ncol = 4) b[1:2, c(2, 4)] <- NA # generating nominal data set with 300 observations (150 each group) genNLR(N = 300, itemtype = "nominal", a = a, b = b) # generating nominal data set with 300 observations (250 reference group, 50 focal) genNLR(N = 300, itemtype = "nominal", ratio = 5, a = a, b = b)
# seed set.seed(123) # generating parameters for dichotomous data with DIF, 5 items a <- matrix(runif(10, 0.8, 2), ncol = 2) b <- matrix(runif(10, -2, 2), ncol = 2) c <- matrix(runif(10, 0, 0.25), ncol = 2) d <- matrix(runif(10, 0.8, 1), ncol = 2) # generating dichotomous data set with 300 observations (150 each group) genNLR(N = 300, a = a, b = b, c = c, d = d) # generating dichotomous data set with 300 observations (150 each group) # and different mean and standard deviation for underlying distribution genNLR(N = 300, a = a, b = b, c = c, d = d, mu = c(1, 0), sigma = c(1, 2)) # generating dichotomous data set with 300 observations (250 reference group, 50 focal) genNLR(N = 300, ratio = 5, a = a, b = b, c = c, d = d) # generating parameters for nominal data with DDF, 5 items, # each item 3 choices a <- matrix(runif(20, 0.8, 2), ncol = 4) b <- matrix(runif(20, -2, 2), ncol = 4) # generating nominal data set with 300 observations (150 each group) genNLR(N = 300, itemtype = "nominal", a = a, b = b) # generating nominal data set with 300 observations (250 reference group, 50 focal) genNLR(N = 300, itemtype = "nominal", ratio = 5, a = a, b = b) # generating parameters for nominal data with DDF, 5 items, # items 1 and 2 have 2 choices, items 3, 4 and 5 have 3 choices a <- matrix(runif(20, 0.8, 2), ncol = 4) a[1:2, c(2, 4)] <- NA b <- matrix(runif(20, -2, 2), ncol = 4) b[1:2, c(2, 4)] <- NA # generating nominal data set with 300 observations (150 each group) genNLR(N = 300, itemtype = "nominal", a = a, b = b) # generating nominal data set with 300 observations (250 reference group, 50 focal) genNLR(N = 300, itemtype = "nominal", ratio = 5, a = a, b = b)
The GMAT
is a generated dataset based on parameters from Graduate
Management Admission Test (GMAT, Kingston et al., 1985). First two items were
considered to function differently in uniform and non-uniform way respectively. The dataset
represents responses of 2,000 subjects to multiple-choice test of 20 items. A correct answer
is coded as 1 and incorrect answer as 0. The column group
represents group membership,
where 0 indicates reference group and 1 indicates focal group. Groups are the same
size (i.e. 1,000 per group). The distributions of total scores (sum of correct answers) are the
same for both reference and focal group (Martinkova et al., 2017). The column criterion
represents generated continuous variable which is intended to be predicted by test.
data(GMAT)
data(GMAT)
A GMAT
data frame consists of 2,000 observations on the following 22 variables:
dichotomously scored items of the test
group membership vector, "0"
reference group, "1"
focal group
continuous criterion intended to be predicted by test
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Kingston, N., Leary, L., & Wightman, L. (1985). An exploratory study of the applicability of item response theory methods to the Graduate Management Admission Test. ETS Research Report Series, 1985(2): 1–64.
Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking equity: Why differential item functioning analysis should be a routine part of developing conceptual assessments. CBE–Life Sciences Education, 16(2), rm2, doi:10.1187/cbe.16-10-0307.
The GMAT2
is a generated dataset based on parameters from
Graduate Management Admission Test (GMAT, Kingston et al., 1985). First two items
were considered to function differently in uniform and non-uniform way respectively.
The dataset represents responses of 1,000 subjects to multiple-choice test of 20 items.
A correct answer is coded as 1 and incorrect answer as 0. The column group
represents
group membership, where 0 indicates reference group and 1 indicates focal group.
Groups are the same size (i.e. 500 per group).
data(GMAT2)
data(GMAT2)
A GMAT2
data frame consists of 1,000 observations on the following 21 variables:
dichotomously scored items of the test
group membership vector, "0"
reference group, "1"
focal group
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Kingston, N., Leary, L., & Wightman, L. (1985). An exploratory study of the applicability of item response theory methods to the Graduate Management Admission Test. ETS Research Report Series, 1985(2): 1–64.
Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking equity: Why differential item functioning analysis should be a routine part of developing conceptual assessments. CBE–Life Sciences Education, 16(2), rm2, doi:10.1187/cbe.16-10-0307.
GMAT2test
dataset.The GMAT2key
is a vector of factors representing correct answers of generated
GMAT2test
data set based on Graduate Management Admission Test (GMAT) data set (Kingston et al., 1985).
data(GMAT2key)
data(GMAT2key)
A nominal vector with 20 values representing correct answers to items of GMAT2test
dataset. For more details see GMAT2test
.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Kingston, N., Leary, L., & Wightman, L. (1985). An exploratory study of the applicability of item response theory methods to the Graduate Management Admission Test. ETS Research Report Series, 1985(2): 1–64.
Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking equity: Why differential item functioning analysis should be a routine part of developing conceptual assessments. CBE–Life Sciences Education, 16(2), rm2, doi:10.1187/cbe.16-10-0307.
The GMAT2test
is a generated dataset based on parameters from Graduate Management
Admission Test (GMAT, Kingston et al., 1985). First two items were considered to function differently
in uniform and non-uniform way respectively. The data set represents responses of 1,000 subjects to
multiple-choice test of 20 items. Additionally, 4 possible answers on all items were generated,
coded A, B, C, and D. The column group
represents group membership, where 0 indicates reference group
and 1 indicates focal group. Groups are the same size (i.e. 500 per group).
data(GMAT2test)
data(GMAT2test)
A GMAT2test
data frame consists of 1,000 observations on the following 21 variables:
nominal items of the test coded A, B, C, and D
group membership vector, "0"
reference group, "1"
focal group
Correct answers are presented in GMAT2key
data set.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Kingston, N., Leary, L., & Wightman, L. (1985). An exploratory study of the applicability of item response theory methods to the Graduate Management Admission Test. ETS Research Report Series, 1985(2): 1–64.
Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking equity: Why differential item functioning analysis should be a routine part of developing conceptual assessments. CBE–Life Sciences Education, 16(2), rm2, doi:10.1187/cbe.16-10-0307.
GMATtest
dataset.The GMATkey
is a vector of factors representing correct answers of
generated GMATtest
data set based on Graduate Management Admission Test (GMAT, Kingston et al., 1985).
data(GMATkey)
data(GMATkey)
A nominal vector with 20 values representing correct answers to items of GMATtest
dataset. For more details see GMATtest
.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Kingston, N., Leary, L., & Wightman, L. (1985). An exploratory study of the applicability of item response theory methods to the Graduate Management Admission Test. ETS Research Report Series, 1985(2): 1–64.
Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking equity: Why differential item functioning analysis should be a routine part of developing conceptual assessments. CBE–Life Sciences Education, 16(2), rm2, doi:10.1187/cbe.16-10-0307.
The GMATtest
is a generated dataset based on parameters from
Graduate Management Admission Test (GMAT, Kingston et al., 1985). First two items
were considered to function differently in uniform and non-uniform way respectively.
The dataset represents responses of 2,000 subjects to multiple-choice test of 20 items.
Additionally, 4 possible answers on all items were generated, coded A, B, C, and D. The column
group
represents group membership, where 0 indicates reference group and 1 indicates
focal group. Groups are the same size (i.e. 1,000 per group). The distributions of total scores
(sum of correct answers) are the same for both reference and focal group (Martinkova et al., 2017).
The column criterion
represents generated continuous variable which is intended to be predicted
by test.
data(GMATtest)
data(GMATtest)
A GMATtest
data frame consists of 2,000 observations on the following 22 variables:
nominal items of the test coded A, B, C, and D
group membership vector, "0"
reference group, "1"
focal group
continuous criterion intended to be predicted by test
Correct answers are presented in GMATkey
data set.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Kingston, N., Leary, L., & Wightman, L. (1985). An exploratory study of the applicability of item response theory methods to the Graduate Management Admission Test. ETS Research Report Series, 1985(2): 1–64.
Martinkova, P., Drabinova, A., Liaw, Y. L., Sanders, E. A., McFarland, J. L., & Price, R. M. (2017). Checking equity: Why differential item functioning analysis should be a routine part of developing conceptual assessments. CBE–Life Sciences Education, 16(2), rm2, doi:10.1187/cbe.16-10-0307.
"ddfMLR"
class.S3 methods for extracting log-likelihood, Akaike's
information criterion (AIC) and Schwarz's Bayesian criterion
(BIC) for an object of "ddfMLR"
class.
## S3 method for class 'ddfMLR' logLik(object, item = "all", ...) ## S3 method for class 'ddfMLR' AIC(object, item = "all", ...) ## S3 method for class 'ddfMLR' BIC(object, item = "all", ...)
## S3 method for class 'ddfMLR' logLik(object, item = "all", ...) ## S3 method for class 'ddfMLR' AIC(object, item = "all", ...) ## S3 method for class 'ddfMLR' BIC(object, item = "all", ...)
object |
an object of |
item |
numeric or character: either character |
... |
other generic parameters for S3 methods. |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
ddfMLR
for DDF detection among nominal data. logLik
for generic function extracting log-likelihood. AIC
for generic function calculating AIC and BIC.
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # 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) ## End(Not run)
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # 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) ## End(Not run)
"difNLR"
class.S3 methods for extracting log-likelihood, Akaike's information criterion (AIC)
and Schwarz's Bayesian criterion (BIC) for an object of the "difNLR"
class.
## S3 method for class 'difNLR' logLik(object, item = "all", ...) ## S3 method for class 'difNLR' AIC(object, item = "all", ...) ## S3 method for class 'difNLR' BIC(object, item = "all", ...)
## S3 method for class 'difNLR' logLik(object, item = "all", ...) ## S3 method for class 'difNLR' AIC(object, item = "all", ...) ## S3 method for class 'difNLR' BIC(object, item = "all", ...)
object |
an object of the |
item |
numeric or character: either character |
... |
other generic parameters for S3 methods. |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Karel Zvara
Faculty of Mathematics and Physics, Charles University
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. & 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.
difNLR
for DIF detection among binary data using the generalized logistic regression model. logLik
for a generic function extracting log-likelihood. AIC
for a generic function calculating AIC and BIC.
## Not run: # 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")) # 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) ## End(Not run)
## Not run: # 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")) # 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) ## End(Not run)
"difORD"
class.S3 methods for extracting log-likelihood, Akaike's
information criterion (AIC) and Schwarz's Bayesian criterion
(BIC) for an object of "difORD"
class.
## S3 method for class 'difORD' logLik(object, item = "all", ...) ## S3 method for class 'difORD' AIC(object, item = "all", ...) ## S3 method for class 'difORD' BIC(object, item = "all", ...)
## S3 method for class 'difORD' logLik(object, item = "all", ...) ## S3 method for class 'difORD' AIC(object, item = "all", ...) ## S3 method for class 'difORD' BIC(object, item = "all", ...)
object |
an object of |
item |
numeric or character: either character |
... |
other generic parameters for S3 methods. |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
difORD
for DIF detection among
ordinal data. logLik
for generic function
extracting log-likelihood. AIC
for generic
function calculating AIC and BIC.
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # 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) ## End(Not run)
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # 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) ## End(Not run)
Calculates DDF likelihood ratio statistics for nominal data based on multinomial log-linear model.
MLR(Data, group, key, type = "both", match = "zscore", anchor = 1:ncol(Data), p.adjust.method = "none", alpha = 0.05, parametrization)
MLR(Data, group, key, type = "both", match = "zscore", anchor = 1:ncol(Data), p.adjust.method = "none", alpha = 0.05, parametrization)
Data |
data.frame or matrix: dataset which rows represent unscored examinee answers (nominal) and columns correspond to the items. |
group |
numeric: binary vector of group membership. |
key |
character: the answer key. Each element corresponds to the correct answer of one item. |
type |
character: type of DDF to be tested. Either
|
match |
numeric or character: matching criterion to be used as
an estimate of trait. Can be either |
anchor |
character or numeric: specification of DIF free
items. A vector of item identifiers (integers specifying the
column number) specifying which items are currently considered
as anchor (DIF free) items. Argument is ignored if |
p.adjust.method |
character: method for multiple comparison
correction. Possible values are |
alpha |
numeric: significance level (default is 0.05). |
parametrization |
deprecated. Use
|
where is by default standardized total score (also called
Z-score) and
is a group membership. Probability of correct
answer (specified in argument
key
) is
Parameters are estimated via neural networks. For more details see
multinom
.
A list with the following arguments:
Sval
the values of likelihood ratio test statistics.
pval
the p-values by likelihood ratio test.
adj.pval
the adjusted p-values by likelihood ratio test using p.adjust.method
.
df
the degress of freedom of likelihood ratio test.
par.m0
the estimates of null model.
par.m1
the estimates of alternative model.
se.m0
standard errors of parameters in null model.
se.m1
standard errors of parameters in alternative model.
cov.m0
list of covariance matrices of item parameters for null model.
cov.m1
list of covariance matrices of item parameters for alternative model.
ll.m0
log-likelihood of m0 model.
ll.m1
log-likelihood of m1 model.
AIC.m0
AIC of m0 model.
AIC.m1
AIC of m1 model.
BIC.m0
BIC of m0 model.
BIC.m1
BIC of m1 model.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Agresti, A. (2010). Analysis of ordinal categorical data. Second edition. John Wiley & Sons.
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.
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects MLR(Data, group, key, type = "both") # testing uniform DDF effects MLR(Data, group, key, type = "udif") # testing non-uniform DDF effects MLR(Data, group, key, type = "nudif") ## End(Not run)
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects MLR(Data, group, key, type = "both") # testing uniform DDF effects MLR(Data, group, key, type = "udif") # testing non-uniform DDF effects MLR(Data, group, key, type = "nudif") ## End(Not run)
The MSATB
dataset consists of the responses of 1,407 subjects
(484 males, 923 females) to admission test to medical school in the Czech republic.
It contains 20 selected items from original test while first item was previously detected
as differently functioning (Vlckova, 2014). A correct answer is coded as 1 and incorrect
answer as 0. The column gender
represents gender of students, where 0 indicates
males (reference group) and 1 indicates females (focal group).
data(MSATB)
data(MSATB)
A MSATB
data frame consists of 1,407 observations on the following 21 variables:
dichotomously scored items of the test
gender of respondents, "0"
males, "1"
females
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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.
Vlckova, K. (2014). Test and item fairness. Master's thesis. Faculty of Mathematics and Physics, Charles University.
MSATBtest
dataset.The MSATBkey
is a vector of factors representing correct answers of
MSATBtest
dataset.
data(MSATBkey)
data(MSATBkey)
A nominal vector with 20 values representing correct answers to items of MSATBtest
dataset. For more details see MSATBtest
.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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.
Vlckova, K. (2014). Test and item fairness. Master's thesis. Faculty of Mathematics and Physics, Charles University.
The MSATBtest
dataset consists of the responses of 1,407 subjects (484 males, 923 females)
to multiple-choice admission test to medical school in the Czech republic. It contains 20 selected items from original
test while first item was previously detected detected as differently functioning (Vlckova, 2014).
Possible answers were A, B, C, and D, while any combination of these can be correct. The column gender
represents
gender of students, where 0 indicates males (reference group) and 1 indicates females (focal group).
data(MSATBtest)
data(MSATBtest)
A MSATBtest
data frame consists of 1,407 observations on the following 21 variables:
nominal items of the test
gender of respondents, "0"
males, "1"
females
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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.
Vlckova, K. (2014). Test and item fairness. Master's thesis. Faculty of Mathematics and Physics, Charles University.
Calculates likelihood ratio test statistics, F-test statistics, or Wald's test statistics for DIF detection among dichotomous items using non-linear regression models (generalized logistic regression models).
NLR(Data, group, model, constraints = NULL, type = "all", method = "nls", match = "zscore", anchor = 1:ncol(Data), start, p.adjust.method = "none", test = "LR", alpha = 0.05, initboot = TRUE, nrBo = 20, sandwich = FALSE)
NLR(Data, group, model, constraints = NULL, type = "all", method = "nls", match = "zscore", anchor = 1:ncol(Data), start, p.adjust.method = "none", test = "LR", alpha = 0.05, initboot = TRUE, nrBo = 20, sandwich = FALSE)
Data |
data.frame or matrix: dataset in which rows represent scored
examinee answers ( |
group |
numeric: a binary vector of a group membership ( |
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: an estimation method to be applied. The options are
|
match |
character or numeric: matching criterion to be used as
an estimate of the trait. It can be either |
anchor |
character or numeric: specification of DIF free items. A vector
of item identifiers (integers specifying the column number) specifying
which items are currently considered as anchor (DIF free) items. Argument
is ignored if the |
start |
numeric: initial values for the estimation of item parameters. If
not specified, starting values are calculated with the
|
p.adjust.method |
character: a method for a multiple comparison
correction. Possible values are |
test |
character: a statistical test to be performed for DIF detection.
Can be either |
alpha |
numeric: a significance level (the default is 0.05). |
initboot |
logical: in the case of convergence issues, should starting
values be re-calculated based on bootstrapped samples? (the default is
|
nrBo |
numeric: the maximal number of iterations for the calculation of starting values using bootstrapped samples (the default is 20). |
sandwich |
logical: should the sandwich estimator be applied for
computation of the covariance matrix of item parameters when using
|
The function calculates test statistics using a DIF detection procedure based on non-linear regression models (i.e., extensions of the logistic regression procedure; Swaminathan & Rogers, 1990; Drabinova & Martinkova, 2017).
The unconstrained form of the 4PL generalized logistic regression model for
probability of correct answer (i.e., ) using IRT
parameterization is
where is the matching criterion (e.g., standardized total score)
and
is a group membership variable for respondent
.
Parameters
,
,
, and
are
discrimination, difficulty, guessing, and inattention for the reference group
for item
. Terms
and
then
represent differences between the focal and reference groups in
discrimination and difficulty for item
. Terms
, and
are guessing and inattention parameters for the focal group for
item
. In the case that there is no assumed difference between the
reference and focal group in the guessing or inattention parameters, the
terms
and
are used.
Alternatively, intercept-slope parameterization may be applied:
where parameters are
intercept, effect of the matching criterion, effect of the group membership,
and their mutual interaction, respectively.
The model
and constraints
arguments can further constrain the
4PL model. The arguments model
and constraints
can also be
combined. Both arguments can be specified as a single value (for all items)
or as an item-specific vector (where each element corresponds 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 set the same 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 function uses intercept-slope parameterization for the estimation via the
estimNLR
function. Item parameters are then
re-calculated into the IRT parameterization using the delta method.
The function offers either the non-linear least squares estimation via the
nls
function (Drabinova & Martinkova, 2017; Hladka &
Martinkova, 2020), the maximum likelihood method with the "L-BFGS-B"
algorithm with constraints via the optim
function (Hladka &
Martinkova, 2020), the maximum likelihood method with the EM algorithm (Hladka,
Martinkova, & Brabec, 2024), the maximum likelihood method with the algorithm
based on parametric link function (PLF, the default option; Hladka, Martinkova,
& Brabec, 2024), or the maximum likelihood method with the iteratively
reweighted least squares algorithm via the glm
function.
A list with the following arguments:
Sval
the values of the test
statistics.
pval
the p-values by the test
.
adjusted.pval
adjusted p-values by the p.adjust.method
.
df
the degrees of freedom of the test
.
test
used test.
par.m0
the matrix of estimated item parameters for the null model.
se.m0
the matrix of standard errors of item parameters for the null model.
cov.m0
list of covariance matrices of item parameters for the null model.
par.m1
the matrix of estimated item parameters for the alternative model.
se.m1
the matrix of standard errors of item parameters for the alternative model.
cov.m1
list of covariance matrices of item parameters for the alternative model.
cf
numeric: a number of convergence issues.
cf.which
the indicators of the items that did not converge.
ll.m0
log-likelihood of null model.
ll.m1
log-likelihood of alternative model.
startBo0
the binary matrix. Columns represent iterations of initial values re-calculations, rows represent items. The value of 0 means no convergence issue in the null model, 1 means convergence issue in the null model.
startBo1
the binary matrix. Columns represent iterations of initial values re-calculations, rows represent items. The value of 0 means no convergence issue in the alternative model, 1 means convergence issue in the alternative model.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Karel Zvara
Faculty of Mathematics and Physics, Charles University
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.
Hladka, A., Martinkova, P., & Brabec, M. (2024). New iterative algorithms for estimation of item functioning. Journal of Educational and Behavioral Statistics. Online first, doi:10.3102/10769986241312354.
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
## Not run: # loading data data(GMAT) Data <- GMAT[, 1:20] # items group <- GMAT[, "group"] # group membership variable # testing both DIF effects using the LR test (default) # and the model with fixed guessing for both groups NLR(Data, group, model = "3PLcg") # using the F test and Wald's test NLR(Data, group, model = "3PLcg", test = "F") NLR(Data, group, model = "3PLcg", test = "W") # using the Benjamini-Hochberg correction NLR(Data, group, model = "3PLcg", p.adjust.method = "BH") # 4PL model with the same guessing and inattention # to test uniform DIF NLR(Data, group, model = "4PLcgdg", type = "udif") # 2PL model to test non-uniform DIF NLR(Data, group, model = "2PL", type = "nudif") # 4PL model with fixed a and c parameters # to test difference in parameter b NLR(Data, group, model = "4PL", constraints = "ac", type = "b") # using various estimation algorithms NLR(Data, group, model = "3PLcg", method = "nls") NLR(Data, group, model = "3PLcg", method = "mle") NLR(Data, group, model = "3PLcg", method = "em") NLR(Data, group, model = "3PLcg", method = "plf") NLR(Data, group, model = "2PL", method = "irls") ## End(Not run)
## Not run: # loading data data(GMAT) Data <- GMAT[, 1:20] # items group <- GMAT[, "group"] # group membership variable # testing both DIF effects using the LR test (default) # and the model with fixed guessing for both groups NLR(Data, group, model = "3PLcg") # using the F test and Wald's test NLR(Data, group, model = "3PLcg", test = "F") NLR(Data, group, model = "3PLcg", test = "W") # using the Benjamini-Hochberg correction NLR(Data, group, model = "3PLcg", p.adjust.method = "BH") # 4PL model with the same guessing and inattention # to test uniform DIF NLR(Data, group, model = "4PLcgdg", type = "udif") # 2PL model to test non-uniform DIF NLR(Data, group, model = "2PL", type = "nudif") # 4PL model with fixed a and c parameters # to test difference in parameter b NLR(Data, group, model = "4PL", constraints = "ac", type = "b") # using various estimation algorithms NLR(Data, group, model = "3PLcg", method = "nls") NLR(Data, group, model = "3PLcg", method = "mle") NLR(Data, group, model = "3PLcg", method = "em") NLR(Data, group, model = "3PLcg", method = "plf") NLR(Data, group, model = "2PL", method = "irls") ## End(Not run)
Calculates DIF likelihood ratio statistics for ordinal data based either on adjacent category logit regression model or on cumulative logit regression model.
ORD(Data, group, model = "adjacent", type = "both", match = "zscore", anchor = 1:ncol(Data), p.adjust.method = "none", alpha = 0.05, parametrization)
ORD(Data, group, model = "adjacent", type = "both", match = "zscore", anchor = 1:ncol(Data), p.adjust.method = "none", alpha = 0.05, parametrization)
Data |
data.frame or matrix: dataset which rows represent ordinally scored examinee answers and columns correspond to the items. |
group |
numeric: binary vector of group membership. |
model |
character: logistic regression model for ordinal data
(either |
type |
character: type of DIF to be tested. Either
|
match |
numeric or character: matching criterion to be used as
an estimate of trait. Can be either |
anchor |
character or numeric: specification of DIF free
items. A vector of item identifiers (integers specifying the
column number) specifying which items are currently considered
as anchor (DIF free) items. Argument is ignored if |
p.adjust.method |
character: method for multiple comparison
correction. Possible values are |
alpha |
numeric: significance level (default is 0.05). |
parametrization |
deprecated. Use
|
Calculates DIF likelihood ratio statistics based either on adjacent category logit model or on cumulative logit model for ordinal data.
Using adjacent category logit model, logarithm of ratio of probabilities of two adjacent categories is
where is by default standardized total score (also called
Z-score) and
is a group membership.
Using cumulative logit model, probability of gaining at least
points is given by 2PL model, i.e.,
The category probability (i.e., probability of gaining exactly
points) is then
.
Both models are estimated by iteratively reweighted least squares.
For more details see vglm
.
A list with the following arguments:
Sval
the values of likelihood ratio test statistics.
pval
the p-values by likelihood ratio test.
adj.pval
the adjusted p-values by likelihood ratio test using p.adjust.method
.
df
the degress of freedom of likelihood ratio test.
par.m0
the estimates of null model.
par.m1
the estimates of alternative model.
se.m0
standard errors of parameters in null model.
se.m1
standard errors of parameters in alternative model.
cov.m0
list of covariance matrices of item parameters for null model.
cov.m1
list of covariance matrices of item parameters for alternative model.
ll.m0
log-likelihood of null model.
ll.m1
log-likelihood of alternative model.
AIC.m0
AIC of null model.
AIC.m1
AIC of alternative model.
BIC.m0
BIC of null model.
BIC.m1
BIC of alternative model.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Agresti, A. (2010). Analysis of ordinal categorical data. Second edition. John Wiley & Sons.
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.
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects ORD(Data, group, type = "both") # testing uniform DIF effects ORD(Data, group, type = "udif") # testing non-uniform DIF effects ORD(Data, group, type = "nudif") # testing DIF using cumulative logit model ORD(Data, group, model = "cumulative") ## End(Not run)
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects ORD(Data, group, type = "both") # testing uniform DIF effects ORD(Data, group, type = "udif") # testing non-uniform DIF effects ORD(Data, group, type = "nudif") # testing DIF using cumulative logit model ORD(Data, group, model = "cumulative") ## End(Not run)
"ddfMLR"
class.Plot method for an object of "ddfMLR"
class
using ggplot2.
The characteristic curves for an item specified in item
argument are plotted. Plotted curves represent the best model.
## S3 method for class 'ddfMLR' plot(x, item = "all", group.names, ...)
## S3 method for class 'ddfMLR' plot(x, item = "all", group.names, ...)
x |
an object of |
item |
numeric or character: either character |
group.names |
character: names of reference and focal group. |
... |
other generic parameters for |
Returns list of objects of class "ggplot"
.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
ddfMLR
for DDF detection. ggplot
for general function to plot a "ggplot"
object.
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # graphical devices plot(x, item = "Item1", group.names = c("Group 1", "Group 2")) plot(x, item = x$DDFitems) plot(x, item = c(3, 1, 5)) ## End(Not run)
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # graphical devices plot(x, item = "Item1", group.names = c("Group 1", "Group 2")) plot(x, item = x$DDFitems) plot(x, item = c(3, 1, 5)) ## End(Not run)
"difNLR"
class.A plotting method for an object of the "difNLR"
class using the
ggplot2 package.
Two types of plots are available. The first one is obtained by setting
plot.type = "cc"
(default). The characteristic curves for items specified
in the item
argument are plotted. Plotted curves represent the best
fitted model.
The second plot is obtained by setting plot.type = "stat"
. The test
statistics (either LR-test, F-test, or Wald test; depending on argument
test
) are displayed on the Y axis, for each converged item. The detection
threshold is displayed by a horizontal line and items detected as DIF are
printed with the red color. Only parameters size
and title
are
used.
## S3 method for class 'difNLR' plot( x, plot.type = "cc", item = "all", group.names, draw.empirical = TRUE, draw.CI = FALSE, ... )
## S3 method for class 'difNLR' plot( x, plot.type = "cc", item = "all", group.names, draw.empirical = TRUE, draw.CI = FALSE, ... )
x |
an object of the |
plot.type |
character: a type of a plot to be plotted (either |
item |
numeric or character: either character |
group.names |
character: names of the reference and focal groups. |
draw.empirical |
logical: should empirical probabilities be plotted as
points? (the default value is |
draw.CI |
logical: should confidence intervals for predicted values be
plotted? (the default value is |
... |
other generic parameters for the |
For an option plot.type = "stat"
, returns object of the "ggplot"
class. In the case of plot.type = "cc"
, returns a list of objects of the
"ggplot"
class.
Outputs can be edited and modified as a standard "ggplot"
object
including colours, titles, shapes, or linetypes.
Note that the option draw.CI = TRUE
returns confidence intervals for
predicted values as calculated by the predict.difNLR
.
Confidence intervals may overlap even in the case that item functions
differently.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Karel Zvara
Faculty of Mathematics and Physics, Charles University
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. & 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.
difNLR
for DIF detection among binary data using the generalized logistic regression model. predict.difNLR
for prediction.
ggplot
for a general function to plot with the "ggplot2" package.
## Not run: # 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")) # item characteristic curves plot(x) plot(x, item = x$DIFitems) plot(x, item = 1) plot(x, item = "Item2", group.names = c("Group 1", "Group 2")) # item characteristic curves without empirical probabilities plot(x, item = 1, draw.empirical = FALSE) # item characteristic curves without empirical probabilities but with CI plot(x, item = 1, draw.empirical = FALSE, draw.CI = TRUE) # graphical devices - test statistics plot(x, plot.type = "stat") ## End(Not run)
## Not run: # 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")) # item characteristic curves plot(x) plot(x, item = x$DIFitems) plot(x, item = 1) plot(x, item = "Item2", group.names = c("Group 1", "Group 2")) # item characteristic curves without empirical probabilities plot(x, item = 1, draw.empirical = FALSE) # item characteristic curves without empirical probabilities but with CI plot(x, item = 1, draw.empirical = FALSE, draw.CI = TRUE) # graphical devices - test statistics plot(x, plot.type = "stat") ## End(Not run)
"difORD"
class.Plot method for an object of "difORD"
class
using ggplot2.
The characteristic curves (category probabilities) for an item
specified in item
argument are plotted. Plotted curves
represent the best model. For cumulative logit model, also
cumulative probabilities may be plotted.
## S3 method for class 'difORD' plot(x, item = "all", plot.type, group.names, ...)
## S3 method for class 'difORD' plot(x, item = "all", plot.type, group.names, ...)
x |
an object of |
item |
numeric or character: either character |
plot.type |
character: which plot should be displayed for
cumulative logit regression model. Either |
group.names |
character: names of reference and focal group. |
... |
other generic parameters for |
Returns list of objects of class "ggplot"
.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
difORD
for DIF detection among ordinal data. ggplot
for general function to plot a "ggplot"
object.
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # graphical devices plot(x, item = 6) plot(x, item = "R6", group.names = c("Males", "Females")) # testing both DIF effects with cumulative logit model (x <- difORD(Data, group, focal.name = 1, model = "cumulative")) plot(x, item = 7, plot.type = "cumulative") plot(x, item = 7, plot.type = "category") ## End(Not run)
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # graphical devices plot(x, item = 6) plot(x, item = "R6", group.names = c("Males", "Females")) # testing both DIF effects with cumulative logit model (x <- difORD(Data, group, focal.name = 1, model = "cumulative")) plot(x, item = 7, plot.type = "cumulative") plot(x, item = 7, plot.type = "category") ## End(Not run)
"ddfMLR"
class.S3 method for predictions from the model used in the
object of "ddfMLR"
class.
## S3 method for class 'ddfMLR' predict(object, item = "all", match, group, ...)
## S3 method for class 'ddfMLR' predict(object, item = "all", match, group, ...)
object |
an object of |
item |
numeric or character: either character |
match |
numeric: matching criterion for new observations. |
group |
numeric: group membership for new observations. |
... |
other generic parameters for |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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.
ddfMLR
for DDF detection among nominal data using multinomial log-linear regression model. predict
for generic function for prediction.
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # fitted values predict(x, item = 1) # predicted values predict(x, item = 1, match = 0, group = c(0, 1)) predict(x, item = x$DDFitems, match = 0, group = c(0, 1)) ## End(Not run)
## Not run: # loading data data(GMATtest, GMATkey) Data <- GMATtest[, 1:20] # items group <- GMATtest[, "group"] # group membership variable key <- GMATkey # correct answers # testing both DDF effects (x <- ddfMLR(Data, group, focal.name = 1, key)) # fitted values predict(x, item = 1) # predicted values predict(x, item = 1, match = 0, group = c(0, 1)) predict(x, item = x$DDFitems, match = 0, group = c(0, 1)) ## End(Not run)
"difNLR"
class.S3 method for predictions from the fitted model used in the object of the
"difNLR"
class.
## S3 method for class 'difNLR' predict(object, item = "all", match, group, interval = "none", CI = 0.95, ...)
## S3 method for class 'difNLR' predict(object, item = "all", match, group, interval = "none", CI = 0.95, ...)
object |
an object of the |
item |
numeric or character: either character |
match |
numeric: a matching criterion for new observations. |
group |
numeric: a group membership variable for new observations. |
interval |
character: a type of interval calculation, either
|
CI |
numeric: a significance level for confidence interval (the default is
|
... |
other generic parameters for the |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Karel Zvara
Faculty of Mathematics and Physics, Charles University
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. & 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.
difNLR
for DIF detection among binary data using the generalized logistic regression model. predict
for a generic function for prediction.
## Not run: # 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")) # predicted values summary(predict(x)) predict(x, item = 1) predict(x, item = "Item1") # predicted values for new observations - average score predict(x, item = 1, match = 0, group = 0) # reference group predict(x, item = 1, match = 0, group = 1) # focal group predict(x, item = 1, match = 0, group = c(0, 1)) # both groups # predicted values for new observations - various Z-scores and groups new.match <- rep(c(-1, 0, 1), each = 2) new.group <- rep(c(0, 1), 3) predict(x, item = 1, match = new.match, group = new.group) # predicted values for new observations with confidence intervals predict(x, item = 1, match = new.match, group = new.group, interval = "confidence") predict(x, item = c(2, 4), match = new.match, group = new.group, interval = "confidence") ## End(Not run)
## Not run: # 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")) # predicted values summary(predict(x)) predict(x, item = 1) predict(x, item = "Item1") # predicted values for new observations - average score predict(x, item = 1, match = 0, group = 0) # reference group predict(x, item = 1, match = 0, group = 1) # focal group predict(x, item = 1, match = 0, group = c(0, 1)) # both groups # predicted values for new observations - various Z-scores and groups new.match <- rep(c(-1, 0, 1), each = 2) new.group <- rep(c(0, 1), 3) predict(x, item = 1, match = new.match, group = new.group) # predicted values for new observations with confidence intervals predict(x, item = 1, match = new.match, group = new.group, interval = "confidence") predict(x, item = c(2, 4), match = new.match, group = new.group, interval = "confidence") ## End(Not run)
"difORD"
class.S3 method for predictions from the model used in the
object of "difORD"
class.
## S3 method for class 'difORD' predict(object, item = "all", match, group, type = "category", ...)
## S3 method for class 'difORD' predict(object, item = "all", match, group, type = "category", ...)
object |
an object of |
item |
numeric or character: either character |
match |
numeric: matching criterion for new observations. |
group |
numeric: group membership for new observations. |
type |
character: type of probability to be computed. Either
|
... |
other generic parameters for |
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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.
difORD
for DIF detection among ordinal data using either cumulative logit or adjacent category logit model. predict
for generic function for prediction.
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with cumulative logit model (x <- difORD(Data, group, focal.name = 1, model = "cumulative")) # fitted values predict(x, item = "R6") # predicted values predict(x, item = "R6", match = 0, group = c(0, 1)) predict(x, item = "R6", match = 0, group = c(0, 1), type = "cumulative") predict(x, item = c("R6", "R7"), match = 0, group = c(0, 1)) # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # fitted values predict(x, item = "R6") # predicted values predict(x, item = "R6", match = 0, group = c(0, 1)) predict(x, item = c("R6", "R7"), match = 0, group = c(0, 1)) ## End(Not run)
## Not run: # loading data data(Anxiety, package = "ShinyItemAnalysis") Data <- Anxiety[, paste0("R", 1:29)] # items group <- Anxiety[, "gender"] # group membership variable # testing both DIF effects with cumulative logit model (x <- difORD(Data, group, focal.name = 1, model = "cumulative")) # fitted values predict(x, item = "R6") # predicted values predict(x, item = "R6", match = 0, group = c(0, 1)) predict(x, item = "R6", match = 0, group = c(0, 1), type = "cumulative") predict(x, item = c("R6", "R7"), match = 0, group = c(0, 1)) # testing both DIF effects with adjacent category logit model (x <- difORD(Data, group, focal.name = 1, model = "adjacent")) # fitted values predict(x, item = "R6") # predicted values predict(x, item = "R6", match = 0, group = c(0, 1)) predict(x, item = c("R6", "R7"), match = 0, group = c(0, 1)) ## End(Not run)
Calculates starting values for the difNLR()
function based on linear
approximation.
startNLR(Data, group, model, constraints = NULL, match = "zscore", parameterization = "irt", simplify = FALSE)
startNLR(Data, group, model, constraints = NULL, match = "zscore", parameterization = "irt", simplify = FALSE)
Data |
data.frame or matrix: dataset in which rows represent
scored examinee answers ( |
group |
numeric: a binary vector of a group membership ( |
model |
character: generalized logistic regression model for which starting values should be estimated. See Details. |
constraints |
character: which parameters should be the same for both
groups. Possible values are any combinations of parameters |
match |
character or numeric: matching criterion to be used as
an estimate of the trait. It can be either |
parameterization |
character: parameterization of regression
coefficients. Possible options are |
simplify |
logical: should initial values be simplified into the matrix? It is only applicable when parameterization is the same for all items. |
The unconstrained form of the 4PL generalized logistic regression model for
probability of correct answer (i.e., ) using IRT parameterization
is
where is the matching criterion (e.g., standardized total score) and
is a group membership variable for respondent
.
Parameters
,
,
, and
are discrimination, difficulty, guessing, and inattention for the reference
group for item
. Terms
and
then represent differences between the focal and reference groups in
discrimination and difficulty for item
. Terms
, and
are guessing and inattention parameters for the focal group for
item
. In the case that there is no assumed difference between the
reference and focal group in the guessing or inattention parameters, the terms
and
are used.
Alternatively, intercept-slope parameterization may be applied:
where parameters are
intercept, effect of the matching criterion, effect of the group membership,
and their mutual interaction, respectively.
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 set the same 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.
Three possible parameterizations can be specified in the
"parameterization"
argument: "irt"
returns the IRT parameters
of the reference group and differences in these parameters between the
reference and focal group. Parameters of asymptotes are printed separately
for the reference and focal groups. "is"
returns intercept-slope
parameterization. Parameters of asymptotes are again printed separately for
the reference and focal groups. "logistic"
returns parameters in
logistic regression parameterization as in the glm
function, and it is available only for the 2PL model.
A list containing elements representing items. Each element is a named numeric vector with initial values for the chosen generalized logistic regression model.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
[email protected]
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. & 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.
Hladka, A. (2021). Statistical models for detection of differential item functioning. Dissertation thesis. Faculty of Mathematics and Physics, Charles University.
# loading data data(GMAT) Data <- GMAT[, 1:20] # items group <- GMAT[, "group"] # group membership variable # 3PL model with the same guessing for both groups startNLR(Data, group, model = "3PLcg") startNLR(Data, group, model = "3PLcg", parameterization = "is") # simplified into a single table startNLR(Data, group, model = "3PLcg", simplify = TRUE) startNLR(Data, group, model = "3PLcg", parameterization = "is", simplify = TRUE) # 2PL model startNLR(Data, group, model = "2PL") startNLR(Data, group, model = "2PL", parameterization = "is") startNLR(Data, group, model = "2PL", parameterization = "logistic") # 4PL model with a total score as the matching criterion startNLR(Data, group, model = "4PL", match = "score") startNLR(Data, group, model = "4PL", match = "score", parameterization = "is") # starting values for model specified for each item startNLR(Data, group, model = c( rep("1PL", 5), rep("2PL", 5), rep("3PL", 5), rep("4PL", 5) ) ) # 4PL model with fixed a and c parameters startNLR(Data, group, model = "4PL", constraints = "ac", simplify = TRUE)
# loading data data(GMAT) Data <- GMAT[, 1:20] # items group <- GMAT[, "group"] # group membership variable # 3PL model with the same guessing for both groups startNLR(Data, group, model = "3PLcg") startNLR(Data, group, model = "3PLcg", parameterization = "is") # simplified into a single table startNLR(Data, group, model = "3PLcg", simplify = TRUE) startNLR(Data, group, model = "3PLcg", parameterization = "is", simplify = TRUE) # 2PL model startNLR(Data, group, model = "2PL") startNLR(Data, group, model = "2PL", parameterization = "is") startNLR(Data, group, model = "2PL", parameterization = "logistic") # 4PL model with a total score as the matching criterion startNLR(Data, group, model = "4PL", match = "score") startNLR(Data, group, model = "4PL", match = "score", parameterization = "is") # starting values for model specified for each item startNLR(Data, group, model = c( rep("1PL", 5), rep("2PL", 5), rep("3PL", 5), rep("4PL", 5) ) ) # 4PL model with fixed a and c parameters startNLR(Data, group, model = "4PL", constraints = "ac", simplify = TRUE)