lassoDIF.ABWIC: Detection of Differential Item Functioning Using the Lasso...

View source: R/lassoDIF.ABWIC.R

lassoDIF.ABWICR Documentation

Detection of Differential Item Functioning Using the Lasso Approach: Selection of Optimal \lambda Value

Description

Performs DIF detection using a lasso-penalized logistic regression model for dichotomous items and selects the optimal value of the penalty parameter \lambda using an information criterion.

Usage

lassoDIF.ABWIC(Data, group, type = "AIC", N = NULL, lambda = NULL, ...)

Arguments

...

Additional arguments passed to internal methods.

Data

A numeric data frame or matrix: either only the item responses or the item responses with a group membership column.

group

A numeric or character vector: either a vector of group membership or a column index/name indicating group membership in Data.

type

Character string indicating the criterion used to select the optimal \lambda value. Must be one of "AIC", "BIC", or "WIC".

N

Integer: total sample size. If NULL, it is inferred from the number of rows in Data.

lambda

Optional numeric vector of \lambda values to be used in the penalization path. If NULL, a default sequence is used.

Details

This function detects uniform DIF using a penalized logistic regression model based on the 2PL model. The model includes item-by-group interaction terms that are subject to lasso penalization. The optimal \lambda value is selected based on either the AIC, BIC, or WIC criterion.

For the selected \lambda^*, the function returns DIF parameters for all items, and flags items whose corresponding DIF parameters are non-zero.

Note: the function's behavior is sensitive to input parameters (e.g., criterion type, sample size, \lambda grid). It is strongly recommended to explore different settings and validate findings before interpreting DIF detection results.

Value

A list with the following components:

DIFitems

Indices of items flagged as exhibiting DIF.

DIFpars

Matrix of estimated DIF parameters for each item.

crit.value

Numeric vector of criterion values (e.g., AIC or BIC) across the \lambda path.

crit.type

The criterion used to select the optimal \lambda (either "AIC", "BIC", or "WIC").

lambda

Vector of \lambda values considered.

opt.lambda

The optimal \lambda value selected.

glmnet.fit

Fitted glmnet model object.

Author(s)

David Magis
Data science consultant at IQVIA Belux
Brussels, Belgium
Carl F. Falk
Department of Psychology
McGill University (Canada)
carl.falk@mcgill.ca, https://www.mcgill.ca/psychology/carl-f-falk
Sebastien Beland
Faculte des sciences de l'education
Universite de Montreal (Canada)
sebastien.beland@umontreal.ca

References

Magis, D., Tuerlinckx, F., & De Boeck, P. (2015). Detection of Differential Item Functioning Using the Lasso Approach. Journal of Educational and Behavioral Statistics, 40(2), 111–135. https://doi.org/10.3102/1076998614559747

Examples

## Not run: 

# With the Verbal data set

data(verbal)

Dat    <-verbal[,1:20]
Member <-verbal[,26]

# Using AIC for selection
lassoDIF.ABWIC(Dat, Member, type="AIC")

# Using BIC for selection
lassoDIF.ABWIC(Dat, Member, type="BIC")

# With simulated data

It   <- 15 # number of items
ItDIFa <- NULL
ItDIFb <- c(1,3)
NR   <- 100 # number of responses for group 1 (reference)
NF   <- 100 # number of responses for group 2 (focal)
a    <- rep(1,It)          # for tests: runif(It,0.2,.5)  
b    <- rnorm(It,1,.5)  
Gb   <- rep(2,2)           # Group value for U-DIF
Ga   <- 0                  # Group value for NU-DIF: need to be fix to 0 for U-DIF
Out1 <- SimDichoDif(It,ItDIFa,ItDIFb,
NR,NF,a,b,Ga,Gb)
Dat<-Out1$data[,1:15]
Member<-Out1$data[,16]

# Using AIC for selection
lassoDIF.ABWIC(Dat, Member, type="AIC")

# Using BIC for selection
lassoDIF.ABWIC(Dat, Member, type="BIC")

# This plot shows how the estimated DIF effects for each item evolve
# as the lasso penalty (lambda) increases

aic.res <- lassoDIF.ABWIC(Dat, Member, type="AIC")
plot_lasso_paths(aic.res$glmnet.fit)
bic.res <- lassoDIF.ABWIC(Dat, Member, type="BIC")
plot_lasso_paths(bic.res$glmnet.fit)

 
## End(Not run)
 

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