if (FALSE) {
# test to generate UDIF
It <- 15 # number of items
ItDIFa <- NULL
ItDIFb <- c(1,3)
NR <- 100 # number of responses for group 1 (reference)
NF <- 100 # number of responses for group 2 (focal)
a <- rep(1,It) # for tests: runif(It,0.2,.5)
b <- rnorm(It,1,.5)
Gb <- rep(2,2) # Group value for U-DIF
Ga <- 0 # Group value for NU-DIF: need to be fix to 0 for U-DIF
#Type <- "UDIF"
#seed <- 1
Out1 <- SimDichoDif(It,ItDIFa,ItDIFb,NR,NF,a,b,Ga,Gb)
Out1
Out1$ipars
# Test to generate NUDIF
It <- 15 # Nb of items with DIF
ItDIFa <- c(1,3)
ItDIFb <- c(1,3)
NR <- 100 # N for Ref.
NF <- 100 # N for Focal
a <- rep(1,It) # For Rasch or any value for 1PL
b <- rnorm(It,1,.5) # Item difficulties from random normal
Gb <- rep(.8,2) # Group value for U-DIF
Ga <- rep(1.2,2) # Group value for NU-DIF
#Type <- "NUDIF"
#seed <- 1
Out2 <- SimDichoDif(It,ItDIFa,ItDIFb,NR,NF,a,b,Ga,Gb)
Out2
Out2$ipars
# Generates a mix of UDIF and NUDIF
It <- 15 # Nb of items with DIF
ItDIFa <- c(1)
ItDIFb <- c(1,3)
NR <- 100 # N for Ref.
NF <- 100 # N for Focal
a <- rep(1,It) # For Rasch or any value for 1PL
b <- rnorm(It,1,.5) # Item difficulties from random normal
Gb <- rep(.8,2) # Group value for U-DIF
Ga <- 1.2 # Group value for NU-DIF
#Type <- "NUDIF"
#seed <- 1
Out3 <- SimDichoDif(It,ItDIFa,ItDIFb,NR,NF,a,b,Ga,Gb)
Out3
Out3$ipars
}
Run the code above in your browser using DataLab