Performs differential item functioning (DIF) detection for items with
continuous responses using nested linear regression models.
The procedure is an analogue of logistic-regression DIF methods for
dichotomous/ordinal items, but relies on lm.
Continuous(DATA, GROUP, member.type = c("group", "cont"),
match = "score", type = c("both", "udif", "nudif"),
criterion = c("F", "Wald"),
anchor = seq_len(ncol(DATA)),
tested_items = seq_len(ncol(DATA)),
all.cov = FALSE)A list with components:
Numeric vector of length \(M\) containing test statistics for
each tested item (non-tested items are NA).
\(M \times 4\) matrix of parameter estimates for full models
(M1), columns (Intercept), MATCH, GROUP,
MATCH:GROUP.
\(M \times 4\) matrix of standard errors for full models (M1).
List of length \(M\) with covariance matrices for M1
(only if all.cov = TRUE).
\(M \times 4\) matrix of parameter estimates for reduced models (M0).
\(M \times 4\) matrix of standard errors for reduced models (M0).
List of length \(M\) with covariance matrices for M0
(only if all.cov = TRUE).
Numeric vector of length \(M\) giving \(\Delta R^2 = R^2_{M1} - R^2_{M0}\) for each tested item.
Character string describing the matching option used.
A numeric matrix or data frame of item responses with \(N\) rows (persons) and \(M\) columns (items). Each column is treated as a continuous dependent variable.
A vector of length \(N\) defining the membership variable.
If member.type = "group", GROUP should represent two groups
(e.g., a factor with two levels or a 0/1 numeric coding).
If member.type = "cont", GROUP is treated as a continuous
covariate and enters the model linearly.
Character string specifying the type of membership variable.
"group" for a categorical grouping variable, or
"cont" for a continuous membership covariate.
Matching variable specification passed to the internal matching builder.
Common options include "score" (total score on anchor items and the
tested item), "zscore" (standardized "score"), or
"restscore" (total anchor score without the tested item).
Matching can also be a numeric a vector of length \(N\) or a numeric
matrix/data.frame with the same dimensions as Data (\(N \times
M\); each column is item-specific matching criterion).
Defines the DIF effect tested:
"udif"uniform DIF only (group main effect).
"nudif"non-uniform DIF only (interaction effect).
"both"tests uniform and non-uniform DIF jointly.
Test criterion used to compare nested models:
"F"nested-model \(F\) test via anova(M0, M1).
"Wald"Wald chi-square test based on dropped coefficients.
Integer vector indicating anchor items used to build the matching variable. Default is all items.
Integer vector indicating which items are tested for DIF. Default is all items.
Logical; if TRUE, variance--covariance matrices of parameters for
both models are returned for each tested item. Default is FALSE.
For each tested item \(i\), two nested linear models are fitted:
y ~ MATCH + GROUP + MATCH:GROUP when type = "both"
y ~ MATCH + GROUP when type = "udif"
y ~ MATCH + GROUP + MATCH:GROUP when type = "nudif",
depending on type.
Drops the terms corresponding to the DIF effect(s) being tested.
y ~ MATCH when type = "both"
y ~ MATCH when type = "udif"
y ~ MATCH + GROUP when type = "nudif",
The test statistic is:
an \(F\) statistic from nested regression comparison when
criterion = "F";
a Wald chi-square statistic when criterion = "Wald".
The change in explained variance, \(\Delta R^2\), is computed as the difference in \(R^2\) between M1 and M0.
Coefficient tables are mapped to fixed slots:
(Intercept), MATCH, GROUP, and MATCH:GROUP,
to ensure stable output even if GROUP is internally expanded
(e.g., GROUP1).
difContinuous, difLogistic.
## Toy example with continuous items
set.seed(123)
N <- 400
M <- 8
## Simulate a continuous "ability"
theta <- rnorm(N)
## Two groups
GROUP <- rep(0:1, each = N/2)
## Continuous item scores (no DIF)
DATA <- sapply(1:M, function(j){
0.5 + 1.0 * theta + rnorm(N, sd = 1)
})
## Add uniform DIF to item 3
DATA[, 3] <- DATA[, 3] + 0.6 * GROUP
## Run Continuous DIF detection
res <- Continuous(DATA = DATA, GROUP = GROUP,
match = "score", type = "both",
criterion = "F")
res$stat
res$deltaR2
Run the code above in your browser using DataLab