SimPolyDif | R Documentation |
Function to generate DIF for polytomous items using the GPCM.
SimPolyDif(It, ItDIFa, ItDIFb,
NR, NF, a, b, d, ncat=3,
Ga=rep(0,ItDIFa), Gb=rep(0,ItDIFb),
D=1,
thR=NULL,thF=NULL,muR=0,muF=0,sigR=1,sigF=1,
ItDIFd=NULL, Gd = lapply(1:It, function(x){rep(0,ncat)}))
It |
It: Number of items |
ItDIFa |
Vector of integers specifying which items have DIF for a parameters. |
ItDIFb |
Vector of integers specifying which items have DIF for b parameters. |
NR |
Number of respondents for reference group. |
NF |
Number of respondents for focal group (generalize to multiple focal groups). |
a |
Item slope for reference group. |
b |
Item difficulty for reference group. |
d |
Step parameters, as a list whose length is the same as the number of items, for the reference group. |
ncat |
Number of categories per item. Currently the same number for all items. |
Gb |
Vector of difference in b's for focal group(s). |
Ga |
Vector of difference in a's for focal group(s). |
D |
Scaling parameter for GPCM. Defaults to 1. |
thR |
Optional vector of latent variable values for reference group. |
thF |
Optional vector of latent variable values for focal group. |
muR |
Mean of latent variable for reference group. Used if latent scores not supplied. |
muF |
Mean of latent variable for reference group. Used if latent scores not supplied. |
sigR |
Standard deviation of latent variable for reference group. Used if latent scores not supplied. |
sigF |
Standard deviation of latent variable for reference group. Used if latent scores not supplied. |
ItDIFd |
Vector of integers specifying which items have DIF for step parameters. |
Gd |
List of differences in d's for focal group(s). |
This function is based on traditional parameterizations of the GPCM that have an overall difficulty parameter and step parameters.
A list with several arguments:
data |
the matrix with DIF items. |
ipars |
the item parameters. |
thetas |
the person parameters. |
Carl F. Falk
Department of Psychology
McGill University (Canada)
carl.falk@mcgill.ca, https://www.mcgill.ca/psychology/carl-f-falk
Sebastien Beland
Faculte des sciences de l'education
Universite de Montreal (Canada)
sebastien.beland@umontreal.ca
Muraki, E. (1992). A generalized partial credit model: Application of an EM algorithm. Applied Psychological Measurement, 16, 159–176.
## Not run:
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
difPolyLogistic(as.data.frame(Data[, 1:It]),
group = Data[, It + 1], focal.name = "G2")
# Nonuniform DIF
ItDIFa <- c(1, 2)
Ga <- rep(.25, 2)
ItDIFb <- c(1, 3)
Gb <- rep(.5, 2)
Out.NUnif <- SimPolyDif(It, ItDIFa, ItDIFb, NR, NF, a, b, d,
ncat = 5, Ga = Ga, Gb = Gb)
Out.NUnif$ipars
Data <- Out.NUnif$data
difPolyLogistic(as.data.frame(Data[, 1:It]),
group = Data[, It + 1], focal.name = "G2")
# Also changing step parameters
ItDIFd <- c(2)
Gd <- list(c(0, .25, -.25, .25, -.25))
Out.NUnif2 <- SimPolyDif(It, ItDIFa, ItDIFb, NR, NF, a, b, d,
ncat = 5, Ga = Ga, Gb = Gb,
ItDIFd = ItDIFd, Gd = Gd)
Out.NUnif2$ipars
Data <- Out.NUnif2$data
difPolyLogistic(as.data.frame(Data[, 1:It]),
group = Data[, It + 1], focal.name = "G2")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.