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", parametrization = "irt", alpha = 0.05)data.frame or matrix: dataset which rows represent unscored examinee answers (nominal) and columns correspond to the items.
numeric: binary vector of group membership. "0" for reference group, "1" for
focal group.
character: the answer key. Each element corresponds to the correct answer of one item.
character: type of DDF to be tested. Either "both" for uniform and non-uniform
DDF (i.e., difference in parameters "a" and "b") (default), or "udif" for
uniform DDF only (i.e., difference in difficulty parameter "b"), or "nudif" for
non-uniform DDF only (i.e., difference in discrimination parameter "a"). Can be specified
as a single value (for all items) or as an item-specific vector.
numeric or character: matching criterion to be used as an estimate of trait. Can be
either "zscore" (default, standardized total score), "score" (total test score),
or vector of the same length as number of observations in Data.
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 match is not "zscore" or "score".
character: method for multiple comparison correction. Possible values are
"holm", "hochberg", "hommel", "bonferroni", "BH", "BY",
"fdr", and "none" (default). For more details see p.adjust.
character: parametrization of regression coefficients. Possible options are
"irt" for difficulty-discrimination parametrization (default) and "classic" for
intercept-slope parametrization. See Details.
numeric: significance level (default is 0.05).
A list with the following arguments:
Svalthe values of likelihood ratio test statistics.
pvalthe p-values by likelihood ratio test.
adj.pvalthe adjusted p-values by likelihood ratio test using p.adjust.method.
dfthe degress of freedom of likelihood ratio test.
par.m0the estimates of null model.
par.m1the estimates of alternative model.
se.m0standard errors of parameters in null model.
se.m1standard errors of parameters in alternative model.
ll.m0log-likelihood of m0 model.
ll.m1log-likelihood of m1 model.
AIC.m0AIC of m0 model.
AIC.m1AIC of m1 model.
BIC.m0BIC of m0 model.
BIC.m1BIC of m1 model.
Calculates DDF likelihood ratio statistics based on multinomial log-linear model. Probability of
selection the \(k\)-th category (distractor) is
$$P(y = k) = exp((a_k + a_kDif*g)*(x - b_k - b_kDif*g)))/(1 + \sum exp((a_l + a_lDif*g)*(x - b_l - b_lDif*g))), $$
where \(x\) is by default standardized total score (also called Z-score) and \(g\) is a group
membership. Parameters \(a_k\) and \(b_k\) are discrimination and difficulty for the \(k\)-th
category. Terms \(a_kDif\) and \(b_kDif\) then represent differences between two groups
(reference and focal) in relevant parameters. Probability of correct answer (specified in argument
key) is
$$P(y = k) = 1/(1 + \sum exp((a_l + a_lDif*g)*(x - b_l - b_lDif*g))). $$
Parameters are estimated via neural networks. For more details see multinom.
Argument parametrization is a character which specifies parametrization of regression parameters.
Default option is "irt" which returns IRT parametrization (difficulty-discrimination, see above).
Option "classic" returns intercept-slope parametrization with effect of group membership and
interaction with matching criterion, i.e. \(b_0k + b_1k*x + b_2k*g + b_3k*x*g\) instead of
\((a_k + a_kDif*g)*(x - b_k - b_kDif*g))\).
Agresti, A. (2010). Analysis of ordinal categorical data. Second edition. John Wiley & Sons.
Hladka, A. & Martinkova, P. (2020). difNLR: Generalized logistic regression models for DIF and DDF detection. The R journal, 12(1), 300--323, 10.32614/RJ-2020-014.
# NOT RUN {
# loading data based on GMAT
data(GMATtest, GMATkey)
Data <- GMATtest[, 1:20]
group <- GMATtest[, "group"]
key <- GMATkey
# 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")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab