dif_analysis: Differential item functioning

View source: R/DIF-Analysis.R

dif_analysisR Documentation

Differential item functioning

Description

Evaluates differential item functioning (DIF) using loess, Mantel-Haenszel (MH), logistic regression, and item response theory (IRT) approaches.

Usage

dif_analysis(
  dif.data,
  dif.methods = "default",
  match.type = "Total",
  match.bins = NULL,
  item.type = NULL,
  stop = TRUE
)

Arguments

dif.data

an object returned from dif_prep

dif.methods

character vector with one or more methods of of investigating DIF: locally estimated scatterplot smoothing ("loess"), Mantel-Haenszel test ("MH"), logistic regression ("logistic"), and multi-group item response theory ("IRT"). The default is all four methods with dichotomous items and c("loess", "IRT") when polytomous items are detected; MH and logistic can only accommodate dichotomous data.

match.type

For the loess, MH, and logistic methods, a character indicating whether a total summed score ("Total"; default) or the summed score excluding the item under investigation ("Rest") should be used as the stratifying variable.

match.bins

For MH, an optional vector of bin sizes for stratifying the match.type score. This is passed to the probs argument of stats::quantile. See examples for usage.

item.type

For IRT, the type of model to fit for each item. The default is "2PL" for dichotomous items and "graded" for polytomous items. See mirt for more options and details.

stop

If FALSE, when possible, errors will return NA for the item under investigation rather than stop the analysis completely (default is TRUE.

Details

This is a wrapper for the functions dif_loess, dif_mh, dif_logistic, and dif_irt, which run the requested DIF analyses on dif.data$item.data by dif.data$dif.groups.

Usage notes:

  • Dichotomous items must be coded 0 = incorrect, 1 = correct.

  • The Mantel-Haenszel and logistic methods can only accommodate dichotomous items.

  • Polytomous item responses are expected to be sequential integers (e.g., 1, 2, 3) but the lowest code does not have to be 0. Polytomous items are unit scaled when calculating the total or rest score.

  • Items with different number of response categories across levels of dif.data$dif.groups are removed from dif.data$item.data for the "IRT" method.

Value

A list containing dif.data and the results from each selected method. The list is not formatted in a directly usable manner; it is intended to be passed to dif_models for further processing or to dif_report for user-friendly formatting.

Examples

data("mdat")

# prep data
dif.data <- dif_prep(item.data = mdat`[`5:ncol(mdat)],
                             dif.groups = mdat$gender,
                             na.to.0 = TRUE)

# DIF analysis by dif.groups
# using rest scores and binning match scores by deciles to avoid empty cells in MH analysis
dif.analysis <- dif_analysis(dif.data = dif.data,
                           dif.methods =  c("MH", "IRT"),
                           match.type = "Rest",
                           match.bins = seq(0, 1, by = .1))

knickodem/WBdif documentation built on Feb. 3, 2024, 2:20 a.m.