Learn R Programming

difNLR (version 1.3.7)

difORD: DIF detection among ordinal data.

Description

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.

Usage

difORD(Data, group, focal.name, model = "adjacent", type = "both", match = "zscore",
       anchor = NULL, purify = FALSE, nrIter = 10, p.adjust.method = "none",
       parametrization = "irt", alpha = 0.05)

Arguments

Data

data.frame or matrix: dataset which rows represent ordinaly scored examinee answers and columns correspond to the items. In addition, Data can hold the vector of group membership.

group

numeric or character: a dichotomous vector of the same length as nrow(Data) or a column identifier of Data.

focal.name

numeric or character: indicates the level of group which corresponds to focal group.

model

character: logistic regression model for ordinal data (either "adjacent" (default) or "cumulative"). See Details.

type

character: type of DIF to be tested. Either "both" for uniform and non-uniform DIF (i.e., difference in parameters "a" and "b") (default), or "udif" for uniform DIF only (i.e., difference in difficulty parameter "b"), or "nudif" for non-uniform DIF only (i.e., difference in discrimination parameter "a"). Can be specified as a single value (for all items) or as an item-specific vector.

match

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.

anchor

numeric or character: specification of DIF free items. Either NULL (default), or a vector of item names (column names of Data), or item identifiers (integers specifying the column number) determining which items are currently considered as anchor (DIF free) items. Argument is ignored if match is not "zscore" or "score".

purify

logical: should the item purification be applied? (default is FALSE).

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 "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", and "none" (default). For more details see p.adjust.

parametrization

character: parametrization of regression coefficients. Possible options are "irt" for difficulty-discrimination parametrization (default) and "classic" for intercept-slope parametrization. See Details.

alpha

numeric: significance level (default is 0.05).

Value

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.

parametrization

Parameters' parametrization.

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")).

Details

Performs DIF detection procedure for ordinal data based either on adjacent category logit model or on cumulative logit model.

Using adjacent category logit model, logarithm of ratio of probabilities of two adjacent categories is $$log(P(y = k)/P(y = k-1)) = (a + aDif*g)*(x - b_k - b_kDif*g),$$ where \(x\) is by default standardized total score (also called Z-score) and \(g\) is a group membership. Parameter \(a\) is a discrimination of the item and parameter \(b_k\) is difficulty for the \(k\)-th category of the item. Terms \(a_Dif\) and \(b_kDif\) then represent differences between two groups (reference and focal) in relevant parameters.

Using cumulative logit model, probability of gaining at least \(k\) points is given by 2PL model, i.e., $$P(y >= k) = exp((a + aDif*g)*(x - b_k - b_kDif*g))/(1 + exp((a + aDif*g)*(x - b_k - b_kDif*g))).$$ The category probability (i.e., probability of gaining exactly \(k\) points) is then \(P(Y = k) = P(Y >= k) - P(Y >= k + 1)\).

Both models are estimated by iteratively reweighted least squares. For more details see vglm.

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_1*x + b_2k*g + b_3*x*g\) instead of \((a + a_Dif*g)*(x - b_k - b_kDif*g))\).

Missing values are allowed but discarded for item estimation. They must be coded as NA for both, Data and group parameters.

References

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.

See Also

plot.difORD for graphical representation of item characteristic curves. coef.difORD for extraction of item parameters with their standard errors. logLik.difORD, AIC.difORD, BIC.difORD for extraction of loglikelihood and information criteria.

p.adjust for multiple comparison corrections. vglm for estimation function using iteratively reweighted least squares.

Examples

Run this code
# NOT RUN {
# Loading data
data(dataMedicalgraded, package = "ShinyItemAnalysis")
Data <- dataMedicalgraded[, 1:5]
group <- dataMedicalgraded[, 101]

# 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 = 3)
plot(x, item = "X2003")
plot(x, item = "X2003", group.names = c("Group 1", "Group 2"))

# 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
# using IRT parametrization
(x <- difORD(Data, group, focal.name = 1, model = "cumulative", parametrization = "irt"))

# Graphical devices
plot(x, item = 3, plot.type = "cumulative")
plot(x, item = 3, plot.type = "category")

# Estimated parameters in IRT parametrization
coef(x, simplify = TRUE)
# }

Run the code above in your browser using DataLab