if (FALSE) {
# With real data
# DIF detection using tau-a and purification
data(SCS)
Data <- SCS[, 1:10]
group <- SCS$Gender
# Using ta and purification
res1 <- difQuade(Data, group, focal.name = 2,
type = "ta", purify = TRUE)
print(res1)
# Here is a function thta plot the results
plot(res1)
# Using Goodman & Kruskal's gamma with restscore matching
res2 <- difQuade(Data, group, focal.name = 2,
type = "gamma", match = "restscore")
print(res2)
# Using Wilson's e index (recommended for tied ordinal data)
res3 <- difQuade(Data, group, focal.name = 2,
type = "e")
print(res3)
# Somers' dyx index with no purification
res4 <- difQuade(Data, group, focal.name = 2,
type = "dyx", purify = FALSE)
print(res4)
# With simulated data
set.seed(1234)
# original item parameters
a <- rlnorm(10, -0.5) # slopes
b <- runif(10, -2, 2) # difficulty
d <- list()
d[[1]] <- c(0, 2, .5, -.15, -1.1)
d[[2]] <- c(0, 2, .25, -.45, -.75)
d[[3]] <- c(0, 1, .5, -.65, -1)
d[[4]] <- c(0, 2, .5, -.85, -2)
d[[5]] <- c(0, 1, .25, -.05, -1)
d[[6]] <- c(0, 2, .5, -.95, -1)
d[[7]] <- c(0, 1, .25, -.35, -2)
d[[8]] <- c(0, 2, .5, -.15, -1)
d[[9]] <- c(0, 1, .25, -.25, -2)
d[[10]] <- c(0, 2, .5, -.35, -1)
# Uniform DIF
It <- 10; NR <- 1000; NF <- 1000
ItDIFa <- NULL; Ga <- NULL
ItDIFb <- c(1, 3)
Gb <- rep(.5, 2)
Out.Unif <- SimPolyDif(It, ItDIFa, ItDIFb, NR, NF, a, b, d,
ncat = 5, Ga = Ga, Gb = Gb)
Out.Unif$ipars
Data <- Out.Unif$data
# Using ta and purification
res5 <- difQuade(Data = Data[, 1:10], group = Data$group,
focal.name = "G1", type = "ta", purify = TRUE)
print(res5)
# Here is a function thta plot the results
plot(res5)
# Using Goodman & Kruskal's gamma with restscore matching
res6 <- difQuade(Data = Data[, 1:10], group = Data$group,
focal.name = "G1", type = "gamma", match = "restscore")
print(res6)
# Using Wilson's e index (recommended for tied ordinal data)
res7 <- difQuade(Data = Data[, 1:10], group = Data$group,
focal.name = "G1", type = "e")
print(res7)
# Somers' dyx index with no purification
res8 <- difQuade(Data = Data[, 1:10], group = Data$group,
focal.name = "G1", type = "dyx", purify = FALSE)
print(res8)
}
Run the code above in your browser using DataLab