difMantel.poly: Mantel Differential Item Functionning Detection for...

View source: R/difMantel.poly.R

difMantel.polyR Documentation

Mantel Differential Item Functionning Detection for Polytomous Items

Description

Implements the Mantel (1963) test for detecting DIF in polytomous items.

Usage

difMantel.poly(data, group, focal.name, ref.name,
            match = "score", sig.level = 0.05,
            purify = FALSE, max.iter = 10)

Arguments

data

A matrix or data frame of polytomous item responses (one row per subject, one column per item).

group

A vector indicating group membership (same length as number of rows in data).

focal.name

The value in group corresponding to the focal group.

ref.name

The value in group corresponding to the reference group.

match

Specifies the matching variable. Can be "score" (default) for total score or "restscore" to exclude the item being tested from the matching score.

sig.level

Significance level for the DIF test (default = 0.05).

purify

Logical. If TRUE, performs iterative purification to exclude DIF items from the anchor set. Ignored if match = "restscore".

max.iter

Maximum number of purification iterations (default = 10).

Details

Chi-square statistic computed for each item using the generalized Mantel (1963) procedure for ordinal responses. This test evaluates whether the distribution of item responses differs significantly between the reference and focal groups, conditioning on the matching score (either total score or rest score). The statistic asymptotically follows a chi-square distribution with 1 degree of freedom under the null hypothesis of no DIF.

If match = "score", the total test score is used as the matching criterion. If match = "restscore", the item under evaluation is excluded from the score, reducing contamination and improving DIF detection accuracy.

When purify = TRUE, anchor items are iteratively refined: items flagged as DIF (p < sig.level) are excluded from the matching score in subsequent iterations. The process stops when the anchor set stabilizes or after max.iter iterations. If no items remain, the last computed statistics are retained.

For each item, the Mantel statistic is computed. Additionally, Liu–Agresti cumulative odds ratios (Psi_hat, Alpha_hat) and their standard errors (SE_log_Psi) are reported when possible. The logical flag LA.valid indicates whether these estimates could be computed.

Note: All response categories must be observed in both groups for Liu–Agresti estimates to be valid. Missing data should be removed prior to analysis.

Value

A data.frame with one column per item and the following columns:

Stat

The Mantel test statistic.

p.value

Associated p-value for the DIF test.

p.adj

p-value adjusted for multiple comparisons using Holm's method.

Psi_hat

Liu-Agresti's estimate of the odds ratio.

Alpha_hat

Estimated difficulty ratio.

SE_log_Psi

Standard error of the log-odds ratio.

rho.spear

Spearman correlation between item score and matching score.

LA.valid

Logical indicator of whether Liu-Agresti estimates were valid for each item.

Author(s)

Sebastien Beland
Faculte des sciences de l'education
Universite de Montreal (Canada)
sebastien.beland@umontreal.ca

References

Liu, I., & Agresti, A. (1996). Mantel–Haenszel–Type Inference for Cumulative Odds Ratios with a Stratified Ordinal Response. Biometrics, 52(4), 1223–1234.

Mantel, N. (1963). Chi-square tests with one degree of freedom: Extensions of the Mantel-Haenszel procedure. Journal of the American Statistical Association, 58, 690–700.

Examples

## Not run: 
# Real data example
data(SCS)
# Without purification
difMantel.poly(data = SCS[, 1:10], group = SCS$Gender, focal.name = 1, 
ref.name = 2, purify = FALSE)

# Without purification and restscore
difMantel.poly(data = SCS[, 1:10], group = SCS$Gender, focal.name = 1, 
ref.name = 2, purify = TRUE,match = "restscore")

# With purification
difMantel.poly(data = SCS[, 1:10], group = SCS$Gender, focal.name = 1, 
ref.name = 2, purify = TRUE)

# With simulated data

set.seed(1234)

# original item parameters
a <- rlnorm(10, -0.5)  # slopes
b <- runif(10, -2, 2)  # difficulty
d <- list()
d[[1]] <- c(0, 2, .5, -.15, -1.1)
d[[2]] <- c(0, 2, .25, -.45, -.75)
d[[3]] <- c(0, 1, .5, -.65, -1)
d[[4]] <- c(0, 2, .5, -.85, -2)
d[[5]] <- c(0, 1, .25, -.05, -1)
d[[6]] <- c(0, 2, .5, -.95, -1)
d[[7]] <- c(0, 1, .25, -.35, -2)
d[[8]] <- c(0, 2, .5, -.15, -1)
d[[9]] <- c(0, 1, .25, -.25, -2)
d[[10]] <- c(0, 2, .5, -.35, -1)

# Uniform DIF
It <- 10; NR <- 1000; NF <- 1000
ItDIFa <- NULL; Ga <- NULL
ItDIFb <- c(1, 3)
Gb <- rep(.5, 2)

Out.Unif <- SimPolyDif(It, ItDIFa, ItDIFb, NR, NF, a, b, d,
                       ncat = 5, Ga = Ga, Gb = Gb)
Out.Unif$ipars
Data <- Out.Unif$data

# Without purification and rest score
difMantel.poly(data = Data[, 1:10], group = Data$group, focal.name = "G1", 
ref.name = "G2", purify = FALSE,match = "restscore")

# With purification
difMantel.poly(data = Data[, 1:10], group = Data$group, focal.name = "G1", 
ref.name = "G2", purify = TRUE)

# We implemented a specific S3 plot method: plot.Logistic. It can be used as follows:
res <- difMantel.poly(data = Data[, 1:10], group = Data$group, focal.name = "G1", 
ref.name = "G2", purify = FALSE)
plot.MHPoly(res)

## End(Not run)

difR documentation built on June 8, 2025, 1:03 p.m.