## Not run:
# With real data
data(verbal)
Data <- verbal[,1:24]
group <- verbal[,24]
# \donttest{
res1 <- ILHTEdif(
resp_mat = Data,
group = group,
alpha = 0.05
)
# With simulate data, forcing NF = NR
set.seed(2025)
NR <- 300
sim <- SimDichoDif(
It = 20,
ItDIFa = c(2, 5),
ItDIFb = c(8, 12),
NR = NR,
NF = NR, # Same size for NF and NR
a = rep(1, 20),
b = rnorm(20, 0, 1),
Ga = c(0.5, -0.5),
Gb = c(1, -1)
)
# Extract response matrix and group vector
resp_mat <- sim$data[, 1:20]
group <- factor(sim$data[, 21], labels = c("Ref", "Focal"))
subject_ids <- seq_len(nrow(resp_mat))
# Run the DIF analysis
res2 <- ILHTEdif(
resp_mat = resp_mat,
group = group,
subject_ids = subject_ids,
alpha = 0.05
)
# With rest score
res3 <- ILHTEdif(
resp_mat = resp_mat,
group = group,
subject_ids = subject_ids,
alpha = 0.05,
nAGQ = 1,
purify = FALSE, # activate purification
match = "restscore",
maxIter = 3 # up to 3 purification passes
)
# With purification
res4 <- ILHTEdif(
resp_mat = resp_mat,
group = group,
subject_ids = subject_ids,
alpha = 0.05,
nAGQ = 1,
purify = TRUE, # activate purification
match = "total",
maxIter = 3 # up to 3 purification passes
)
# View results for res2
print(res2$itemDIF) # all Zeta estimates
print(res2$itemSig) # those beyond ±1.96·SD
print(res2$plot) # plot of Zeta ±1.96·SD
# }
## End(Not run)
Run the code above in your browser using DataLab