View source: R/difContinuous.R
| difContinuous | R Documentation |
Detects differential item functioning (DIF) for items with continuous responses
using nested linear regression models. The function provides optional
item purification and p-value adjustment, and returns results in a
"Continuous" object.
difContinuous(
Data, group, focal.name,
anchor = NULL,
member.type = "group",
match = "score",
type = "both",
criterion = "F",
alpha = 0.05, all.cov = FALSE,
purify = FALSE, nrIter = 10,
p.adjust.method = NULL, puriadjType = "simple",
save.output = FALSE, output = c("out", "default")
)
Data |
A numeric matrix or data frame of item responses with |
group |
The grouping/membership variable. It can be:
When |
focal.name |
Character string specifying the focal group (reference group is the other level)
when |
anchor |
Integer vector (or |
member.type |
Type of membership variable: |
match |
Matching variable specification passed to the internal matching builder.
Common options include |
type |
DIF effect tested:
|
criterion |
Test used for nested-model comparison:
|
alpha |
Significance level for DIF detection and purification. Must be in (0, 1). |
all.cov |
Logical; if |
purify |
Logical; if |
nrIter |
Maximum number of purification iterations. Non-negative integer. |
p.adjust.method |
Optional character string specifying a p-value adjustment method as in
|
puriadjType |
When
|
save.output |
Logical; if |
output |
Character vector controlling the output file when |
The function internally calls Continuous to fit, for each tested item,
a full linear model (M1) and a reduced model (M0) depending on type.
Test statistics are computed using criterion.
If purify = FALSE, DIF testing is performed once using the specified anchors.
If purify = TRUE and allowed by the matching option, purification proceeds as follows:
Run DIF once with all items as anchors.
Flag items with adjusted p-values below alpha as DIF.
Recompute matching scores using only non-DIF items as anchors.
Repeat until convergence or nrIter is reached.
During purification, a difPur matrix is stored, indicating DIF status by step.
For items finally flagged as DIF, parameter estimates and standard errors returned in
lmPar and lmSe correspond to the reduced model (M0), as in the behavior of
other difR-style regression DIF functions.
An object of class "Continuous" with components:
Numeric vector of test statistics per item (non-tested items are NA).
Numeric vector of raw p-values per item.
M \times 4 matrix of parameter estimates shown for each item
(M1 for non-DIF, M0 for DIF).
M \times 4 matrix of standard errors corresponding to lmPar.
M \times 4 matrices of estimates and SEs for reduced models.
Lists of covariance matrices for M0 and M1 (only if all.cov = TRUE).
Numeric vector of \Delta R^2 per item.
Significance level used.
Critical value of the chosen test at level alpha.
Either a character string "No DIF item detected" or an integer
vector of flagged items.
Echoed specifications used in the analysis.
Adjustment method requested (possibly NULL).
Adjusted p-values if p.adjust.method is not NULL;
otherwise NULL.
Logical indicating whether purification was performed.
Number of purification iterations effectively run (if applicable).
Purification adjustment type (if applicable).
Matrix tracking DIF status by purification step (if applicable).
Logical indicating whether purification converged.
Item names (column names of Data).
Anchor specification as provided (or NULL under purification).
Echoed saving options.
Final processed data matrix and grouping variable used.
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
hladka@cs.cas.cz
Sebastien Beland
Faculte des sciences de l'education
Universite de Montreal (Canada)
sebastien.beland@umontreal.ca
Continuous,
difLogistic.
set.seed(123)
n <- 300 # sample size
group <- rep(c(0, 1), each = n / 2) # binary group membership variable
theta <- rnorm(n) # latent trait
# generating 5 continuous items with noise
Data <- data.frame(
Item1 = 0.5 * theta + rnorm(n), # No DIF
Item2 = 0.4 * theta + 0.3 * group + rnorm(n), # Uniform DIF
Item3 = 0.6 * theta + 0.6 * theta * group + rnorm(n), # Non-uniform DIF
Item4 = 0.4 * theta + rnorm(n), # No DIF
Item5 = 0.4 * theta - 0.4 * group + rnorm(n) # Uniform DIF
)
# various matching criteria
difContinuous(Data, group, focal.name = 1)
difContinuous(Data, group, focal.name = 1, match = rowSums(Data))
difContinuous(Data, group, focal.name = 1, match = as.data.frame(replicate(5, rowSums(Data))))
difContinuous(Data, group, focal.name = 1, match = "zscore")
difContinuous(Data, group, focal.name = 1, match = "restscore")
difContinuous(Data, group, focal.name = 1, match = theta)
# DIF detection with linear model, anchor items
difContinuous(Data, group, focal.name = 1, anchor = c(1, 4))
difContinuous(Data, group, focal.name = 1, anchor = paste0("Item", c(1, 4)))
# DIF detection with linear model, different type of DIF
difContinuous(Data, group, focal.name = 1, type = "both")
difContinuous(Data, group, focal.name = 1, type = "udif")
difContinuous(Data, group, focal.name = 1, type = "nudif")
# DIF detection with linear model, different test criterion
difContinuous(Data, group, focal.name = 1, criterion = "F")
difContinuous(Data, group, focal.name = 1, criterion = "Wald")
# DIF detection with linear model, item purification and multiple comparison corrections
difContinuous(Data, group, focal.name = 1, purify = TRUE)
difContinuous(Data, group, focal.name = 1, p.adjust.method = "BH")
difContinuous(Data, group, focal.name = 1, purify = TRUE,
p.adjust.method = "holm", puriadjType = "simple")
difContinuous(Data, group, focal.name = 1, purify = TRUE,
p.adjust.method = "holm", puriadjType = "combined")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.