difstudy: Differential Item Functioning Study

View source: R/difstudy.R

difstudyR Documentation

Differential Item Functioning Study

Description

Functions for estimating differential item functioning (DIF) with a set of scored item responses.

Usage

difstudy(
  x,
  groups,
  ref,
  scores = NULL,
  method = c("mh", "lr"),
  anchor_items = 1:ncol(x),
  dif_items = 1:ncol(x),
  complete = TRUE,
  na.rm = FALSE,
  p_cut = 0.05,
  sdp_w = c("focal", "reference", "total")
)

Arguments

x

matrix or data.frame of scored item responses.

groups

vector defining dichotomous grouping variable.

ref

string identifying label used in groups to represent the reference group, with no default.

scores

optional vector of construct scores, defaulting to row sums over all columns in x when NULL and anchor_items is not specified.

method

what DIF method to use, with "mh" for Mantel-Haenszel and "lr" for logistic regression.

anchor_items

vector of item names or column numbers for identifying anchoring items in x. These will be used when finding construct scores if scores is missing, defaulting to all columns in x.

dif_items

vector of item names or column numbers identifying what items in x should be analyzed for DIF, defaulting to all columns in x.

complete

logical with default TRUE indicating whether or not x, groups, and scores should be reduced to cases with complete data.

na.rm

logical with default FALSE specifying whether missings should be removed before calculating individual descriptives.

p_cut

numeric cutoff for evaluating the p-value for the Mantel-Haenszel chi-square, with default 0.05.

sdp_w

string for choosing the weight when finding the standardized difference statistic, defaulting to the number of test takers in the focal group.

Examples

# Vector of item names
ritems <- c("r414q02", "r414q11", "r414q06", "r414q09",
  "r452q03", "r452q04", "r452q06", "r452q07", "r458q01",
  "r458q07", "r458q04")
rsitems <- paste0(ritems, "s")
# Subset PISA09 to Belgium and Germany
pisa <- subset(PISA09, cnt %in% c("BEL", "DEU"))
x_totals <- rowSums(pisa[, rsitems], na.rm = TRUE)
# Uniform DIF with Mantel-Haenszel
difstudy(x = pisa[, rsitems], groups = pisa$cnt, ref = "BEL",
  scores = x_totals, method = "mh")
# Uniform and nonuniform DIF with logistic regression
difstudy(x = pisa[, rsitems], groups = pisa$cnt, ref = "BEL",
  method = "lr")


talbano/epmr documentation built on Aug. 25, 2023, 1:35 p.m.