Title: | Logistic Ordinal Regression Differential Item Functioning using IRT |
---|---|
Description: | Analysis of Differential Item Functioning (DIF) for dichotomous and polytomous items using an iterative hybrid of ordinal logistic regression and item response theory (IRT). |
Authors: | Seung W. Choi, with contributions from Laura E. Gibbons and Paul K. Crane |
Maintainer: | Seung W. Choi <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.3-3 |
Built: | 2024-11-17 06:53:57 UTC |
Source: | CRAN |
Analysis of Differential Item Functioning (DIF) for dichotomous and polytomous items, using an iterative hybrid of (ordinal) logistic regression and item response theory (IRT).
Package: | lordif |
Type: | Package |
Version: | 0.3-3 |
Date: | 2016-3-3 |
License: | GPL (>=2) |
LazyLoad: | yes |
Ordinal logistic regression (OLR) provides a flexible framework for detecting various types of DIF. Previous efforts extended the framework by substituting the matching variable based on sum scores with IRT based trait scores and by employing an iterative process of purifying the matching variable with the use of group-specific item parameters (Crane et. al., 2006). This package represents an effort to integrate both statistical and IRT procedures into a single program. A Monte Carlo simulation approach was incorporated to derive empirical threshold values for various DIF statistics and effect size measures.
Seung W. Choi, with contributions from Laura E. Gibbons and Paul K. Crane
Maintainer: Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
Crane, P. K., Gibbons, L. E., Jolley, L., & van Belle, G. (2006). Differential item functioning analysis with ordinal logistic regression techniques: DIF detect and difwithpar. Medical Care, 44(11 Suppl 3), S115-S123.
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##gender: 0=Male or 1=Female ##education: 0=some college or higher 1=high school or lower ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")], Anxiety$age) ##with sample weights - produces the same results as above, i.e., with equal weights ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")], Anxiety$age, weights=rep(1/766,766)) ##print output ## Not run: print(age.dif) ##print extended output ## Not run: summary(age.dif) ##generate plots for DIF items (reference group: <65) ## Not run: plot(age.dif,labels=c("Younger","Older")) ##run Monte Carlo simulations for threshold values ##this may take several minutes ## Not run: age.dif.MC<-montecarlo(age.dif,alpha=0.05,nr=100) ##print output ## Not run: print(age.dif.MC) ##print extended output ## Not run: summary(age.dif.MC) ##generate plots for Monte Carlo threshold values ## Not run: plot(age.dif.MC) ##run DFIT analysis ## Not run: age.dif.DFIT<-DFIT(age.dif)
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##gender: 0=Male or 1=Female ##education: 0=some college or higher 1=high school or lower ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")], Anxiety$age) ##with sample weights - produces the same results as above, i.e., with equal weights ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")], Anxiety$age, weights=rep(1/766,766)) ##print output ## Not run: print(age.dif) ##print extended output ## Not run: summary(age.dif) ##generate plots for DIF items (reference group: <65) ## Not run: plot(age.dif,labels=c("Younger","Older")) ##run Monte Carlo simulations for threshold values ##this may take several minutes ## Not run: age.dif.MC<-montecarlo(age.dif,alpha=0.05,nr=100) ##print output ## Not run: print(age.dif.MC) ##print extended output ## Not run: summary(age.dif.MC) ##generate plots for Monte Carlo threshold values ## Not run: plot(age.dif.MC) ##run DFIT analysis ## Not run: age.dif.DFIT<-DFIT(age.dif)
The data contains responses from 766 people sampled from a general population to the PROMIS Anxiety scale (http://www.nihpromis.org) composed of 29 Likert-type questions with a common rating scale (1=Never, 2=Rarely, 3=Sometimes, 4=Often, and 5=Always).
data(Anxiety)
data(Anxiety)
A data frame with 766 observations on the following 32 variables.
age
0=younger than 65 and 1=65 and older
gender
0=Male and 1=Female
education
0=some college or higher and 1=high school or lower
R1
I felt fearful
R2
I felt frightened
R3
It scared me when I felt nervous
R4
I felt anxious
R5
I felt like I needed help for my anxiety
R6
I was concerned about my mental health
R7
I felt upset
R8
I had a racing or pounding heart
R9
I was anxious if my normal routine was disturbed
R10
I had sudden feelings of panic
R11
I was easily startled
R12
I had trouble paying attention
R13
I avoided public places or activities
R14
I felt fidgety
R15
I felt something awful would happen
R16
I felt worried
R17
I felt terrified
R18
I worried about other people's reactions to me
R19
I found it hard to focus on anything other than my anxiety
R20
My worries overwhelmed me
R21
I had twitching or trembling muscles
R22
I felt nervous
R23
I felt indecisive
R24
Many situations made me worry
R25
I had difficulty sleeping
R26
I had trouble relaxing
R27
I felt uneasy
R28
I felt tense
R29
I had difficulty calming down
PROMIS Cooperative Group. Unpublished Manual for the Patient-Reported Outcomes Measurement Information System (PROMIS) Version 1.1. October, 2008: http://www.nihpromis.org
## Not run: data(Anxiety)
## Not run: data(Anxiety)
Calculates item response probabilities over a theta grid according to either the GRM or the GPCM.
calcprob(ipar, theta, model = "GRM")
calcprob(ipar, theta, model = "GRM")
ipar |
a data frame containing the following columns: a, cb1, cb2,..., cb(maxCat-1) |
theta |
a grid of theta values, e.g., theta <- seq(-4,4,.1) |
model |
IRT model, either "GRM" or "GPCM" |
Calculates an array of item response probabilities according to either the Graded Response Model (GRM: Samejima, 1969) or the Generalized Partial Credit Model (GPCM: Muraki, 1992) over a grid of theta values. The two required input objects are ipar and theta. ipar is a data frame containing item parameters in the following order: a, cb1, cb2,..., cb(maxCat-1). Items may have different numbers of categories. The variable maxCAT is the maximum number of response categories across all items. theta is a vector containing a grid of theta values. The IRT model can be either "GRM" or "GPCM".
Returns an array of item response probabilities of dimension, c(nq, ni, maxCAT-1), where nq is the length of the theta grid, ni is the number of items in ipar, i.e., nrow(ipar), and maxCAT is the maximum number of response categories across all items.
Seung W. Choi <[email protected]>
Samejima, F. (1969). Estimation of latent ability using a response pattern of graded scores. Psychometrika Monograph, 17.
Muraki, E. (1992). A generalized partial credit model: Application of an EM algorithm. Applied Psychological Measurement, 16, 159-176.
##item.par<-read.csv(fn,head=F,col.names=c("a","cb1","cb2","cb3","cb4")) ##theta <- seq(-4,4,.1) ## Not run: calcprob(item.par,theta,model="GPCM")
##item.par<-read.csv(fn,head=F,col.names=c("a","cb1","cb2","cb3","cb4")) ##theta <- seq(-4,4,.1) ## Not run: calcprob(item.par,theta,model="GPCM")
Calculates Expected A Posteriori (EAP) theta estimates and associated standard error estimates (posterior standard deviations).
calctheta(ipar, resp.data, theta, prior.mean = 0, prior.sd = 1, model = "GRM")
calctheta(ipar, resp.data, theta, prior.mean = 0, prior.sd = 1, model = "GRM")
ipar |
a data frame containing the following columns: a, cb1, cb2,..., cb(maxCat) |
resp.data |
a data frame containing item responses |
theta |
a theta grid (quadrature points) |
prior.mean |
prior mean |
prior.sd |
prior standard deviation |
model |
IRT model, either "GRM" or "GPCM") |
Calculates EAP theta estimates and standard error estimates based on the input item parameters (ipar), the item response data (resp.data), and the IRT model specified ("GRM" or "GPCM").
A list object with the following components
EAP |
Expected A Posteriori estimates of theta |
SE |
Standard Error estimates |
Some missing item responses (NA) are allowed.
Seung W. Choi <[email protected]>
Bock, R. D. & Mislevy, R. J. (1982). Adaptive EAP Estimation of Ability in a Microcomputer Environment. Applied Psychological Measurement, 6(4), 431-444.
## Not run: calctheta(ipar,resp.data,model="GPCM")
## Not run: calctheta(ipar,resp.data,model="GPCM")
Collapses response categories if cell frequencies by group are below a minimum threshold specified by minCell and returns a vector of recoded responses.
collapse(resp, group, minCell)
collapse(resp, group, minCell)
resp |
a vector of item responses |
group |
a vector of group designations |
minCell |
a minimum cell frequency |
Collapses item response categories in resp if the two-way contingency table (resp x group) has cell frequencies less than the minimum cell count threshold specified by minCell.
a numeric vector of the same length as resp with collapsed/recoded values.
The lowest item response category/score should be coded as 1 not 0 (e.g., 1, 2, 3, 4, 5; and not 0, 1, 2, 3, 4). There must be at least two unique categories after collapsing/recoding.
Seung W. Choi <[email protected]>
r1 <- c(1,1,2,1,1,2,2,1,2,2,1,2,2,1,1,2,1,2,2,3,3,1,2,3) gr <- c(0,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1) collapse(r1,gr,2) #minCell=2 ## returns c(1,1,2,1,1,2,2,1,2,2,1,2,2,1,1,2,1,2,2,2,2,1,2,2) ## response categories 2 and 3 are collapsed
r1 <- c(1,1,2,1,1,2,2,1,2,2,1,2,2,1,1,2,1,2,2,3,3,1,2,3) gr <- c(0,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1) collapse(r1,gr,2) #minCell=2 ## returns c(1,1,2,1,1,2,2,1,2,2,1,2,2,1,1,2,1,2,2,2,2,1,2,2) ## response categories 2 and 3 are collapsed
Calculates DFIT statistics using an object of class "lordif"
DFIT(obj)
DFIT(obj)
obj |
an object of class "lordif" |
Calculates DFIT statistics, including the compensatory differential item functioning (CDIF), the non-compensatory differential item functioning (NCDIF), and the differential test functioning (DTF), based on an object returned from lordif.
CDIF |
a data frame of dimension ni by (ng-1), containing compensatory differential item functioning statistics for ni items and (ng-1) groups |
NCDIF |
a data frame containing non-compensatory differential item functioning statistics |
DTF |
the Differential Test Functioning (DTF) statistic (Raju, van der Linden, & Fleer, 1995) |
ipar |
a list of item parameter estimates by group |
TCC |
a list of test characteristic functions by group |
Seung W. Choi <[email protected]>
Oshima, T., & Morris, S. (2008). Raju's differential functioning of items and tests (DFIT). Educational Measurement: Issues and Practice, 27, 43-50.
Raju, N. S., van der Linden, W. J., & Fleer, P. F., (1995). An IRT-based internal measure of test bias with application of differential item functioning. Applied Psychological Measurement, 19, 353-368.
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.DIF <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ##run DFIT ## Not run: age.DIF.DFIT <- DFIT(age.DIF)
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.DIF <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ##run DFIT ## Not run: age.DIF.DFIT <- DFIT(age.DIF)
Computes linear transformation constants to equate a set of GRM/GPCM item parameters to a target scale using a test characteristic curve equating procedure (Stocking & Lord, 1983)
equate(ipar.to, ipar.from, theta, model = "GRM", start.AK = c(1, 0), lower.AK = c(0.5, -2), upper.AK = c(2, 2))
equate(ipar.to, ipar.from, theta, model = "GRM", start.AK = c(1, 0), lower.AK = c(0.5, -2), upper.AK = c(2, 2))
ipar.to |
a data frame containing target item parameters in the following order: a, cb1, cb2,..., cb(maxCat-1) |
ipar.from |
a data frame containing to-be-equated item parameters in the following order: a, cb1, cb2,..., cb(maxCat-1) |
theta |
a theta grid |
model |
IRT model, either "GRM" or "GPCM" |
start.AK |
a vector of starting values, c(A, K) where A is a multiplicative constant and K is an additive constant |
lower.AK |
a vector of lower limits, c(A, K) where A is a multiplicative constant and K is an additive constant |
upper.AK |
a vector of upper limits, c(A, K) where A is a multiplicative constant and K is an additive constant |
Computes linear transformation constants (A and K) that equate a set of item parameters (ipar.from) to the scale defined by a target item parameters (ipar.to) by minimizing the squared difference between the test characteristic curves (Stocking & Lord, 1983). The minimization is performed by the nlminb function (in stats).
returns a vector of two elements, c(A, K) where A is a multiplicative constant and K is an additive constant
The item parameters are assumed to be on the theta metric (0,1). The number of category threshold parameters may differ across items but not greater than (maxCat-1).
Seung W. Choi <[email protected]>
Stocking, M. L. & Lord, F. M. (1983). Developing a Common Metric in Item Response Theory. Applied Psychological Measurement, 7(2), 201-210.
##ipar.to is a data frame containing "target" item parameters ##ipar.from is a data frame containing "to-be-equated" item parameters ## Not run: AK <- equate(ipar.to,ipar.from) #AK[1] contains the multiplicative constant #AK[2] contains the additive constant
##ipar.to is a data frame containing "target" item parameters ##ipar.from is a data frame containing "to-be-equated" item parameters ## Not run: AK <- equate(ipar.to,ipar.from) #AK[1] contains the multiplicative constant #AK[2] contains the additive constant
Extracts IRT item parameter estimates from an output returned from mirt
extract(ipar)
extract(ipar)
ipar |
output from the |
similar to the coef function in the mirt package
a data frame containing item parameter estimates in the order of a, cb1, cb2,..., cb(maxCat-1).
Seung W. Choi <[email protected]>
##calib.sparse <- mirt(sparse.matrix,1,itemtype="gpcm") ## Not run: ipar.sparse <- extract(calib.sparse)
##calib.sparse <- mirt(sparse.matrix,1,itemtype="gpcm") ## Not run: ipar.sparse <- extract(calib.sparse)
Determines an empirical cutoff value for statistics generated from a Monte Carlo simulation.
getcutoff(stat, alpha, reverse)
getcutoff(stat, alpha, reverse)
stat |
a vector containing statistics sampled from a Monte Carlo simulation |
alpha |
a p-value specifying the quantile of the statistics to be determined, e.g., (alpha x 100)th percentile |
reverse |
if TRUE, the quantile is determined by (1-alpha) |
Calculates the quantile value of statistics sampled from a Monte Carlo simulation. For example, when alpha = 0.1 the function determines the 1st percentile of the statistics. Conversely, if reverse is True, the function determines the 99th percentile, i.e., (1-alpha) x 100.
returns a scalar corresponding to the quantile of the statistics determined by alpha or (1-alpha)
Seung W. Choi <[email protected]>
#top 1 percent getcutoff(runif(1000),0.01,TRUE) #bottom 1 percent getcutoff(runif(1000),0.01,FALSE)
#top 1 percent getcutoff(runif(1000),0.01,TRUE) #bottom 1 percent getcutoff(runif(1000),0.01,FALSE)
performs iterative hybrid ordinal logistic regression/IRT DIF
lordif(resp.data, group, selection = NULL, criterion = c("Chisqr", "R2", "Beta"), pseudo.R2 = c("McFadden", "Nagelkerke", "CoxSnell"), alpha = 0.01, beta.change = 0.1, R2.change = 0.02, maxIter = 10, minCell = 5, minTheta = -4, maxTheta = 4, inc = 0.1, control = list(), model = "GRM", anchor = NULL, MonteCarlo = FALSE, nr = 100, weights = NULL, normwt = TRUE)
lordif(resp.data, group, selection = NULL, criterion = c("Chisqr", "R2", "Beta"), pseudo.R2 = c("McFadden", "Nagelkerke", "CoxSnell"), alpha = 0.01, beta.change = 0.1, R2.change = 0.02, maxIter = 10, minCell = 5, minTheta = -4, maxTheta = 4, inc = 0.1, control = list(), model = "GRM", anchor = NULL, MonteCarlo = FALSE, nr = 100, weights = NULL, normwt = TRUE)
resp.data |
data frame or matrix containing item responses |
group |
a vector of group designations |
selection |
a vector specifying a subset of items to be analyzed or NULL for all items |
criterion |
criterion for flagging (i.e., "Chisqr", "R2", or "Beta") |
pseudo.R2 |
pseudo R-squared measure (i.e., "McFadden", "Nagelkerke", or "CoxSnell") |
alpha |
significance level for Chi-squared criterion |
beta.change |
proportionate change for Beta criterion |
R2.change |
R-squared change for pseudo R-squared criterion |
maxIter |
maximum number of iterations for purification |
minCell |
minimum cell frequency to avoid collapsing |
minTheta |
minimum for theta grid |
maxTheta |
maximum for theta grid |
inc |
increment for theta grid |
control |
a list of control variables (refer to the |
model |
IRT model of choice, either "GRM" or "GPCM" (default: "GRM") |
anchor |
a vector specifying items to be used as anchors or NULL to determine anchors through purification |
MonteCarlo |
TRUE to trigger Monte Carlo simulations to determine empirical thresholds |
nr |
number of replications for Monte Carlo simulations |
weights |
an optional vector (same length as nobs) of fractional case weights (refer to the |
normwt |
set to TRUE to scale weights so they sum to nobs |
Performs an ordinal (common odds-ratio) logistic regression differential item functioning (DIF) analysis using IRT theta estimates as the conditioning variable. The graded response model (GRM) or the generalized partial credit model (GPCM) is used for IRT trait estimation. Items flagged for DIF are treated as unique items and group-specific item parameters are obtained. Non-DIF items serve as anchor items to the initial single-group calibration. The procedure runs iteratively until the same set of items is flagged over two consecutive iterations, unless anchor items are specified.
Returns an object (list) of class "lordif" with the following components:
call |
calling expression |
options |
options used for the run |
selection |
all or a subset of items analyzed |
stats |
matrix containing output statistics |
flag |
logical vector of final flags indicating whether each item is displaying DIF or not |
recoded |
data frame containing recoded item responses |
group |
vector of group designation values |
ng |
scalar for the number of groups |
ncat |
vector of the number of response categories for each item after collapsing/recoding |
calib |
vector of theta estimates based on the overall (non-group-specific) item parameters |
calib.sparse |
vector of theta estimates based on the DIF-free and group-specific item parameters |
iteration |
scalar for the number of iterations |
ipar |
data frame of the overall (non-group-specific) item parameter estimates |
ipar.sparse |
data frame of the group-specific item parameter estimates |
stats.raw |
matrix containing output statistics (the same components as stats above but based on raw scores) |
meanraw |
vector containing mean raw scores |
flag.raw |
logical vector of final DIF flags based on raw scores |
DFIT |
place-holder for DFIT analysis output |
anchor |
vector of items used as anchors |
MonteCarlo |
place-holder for Monte Carlo analysis output |
requires the mirt and rms packages
Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
Crane, P. K., Gibbons, L. E., Jolley, L., and van Belle, G. (2006). Differential item functioning analysis with ordinal logistic regression techniques: DIF detect and difwithpar. Medical Care, 44(11 Suppl 3), S115-S123.
## Not run: data(Anxiety) ## Not run: resp.data <- Anxiety[paste("R",1:29,sep="")] ## Not run: age <- Anxiety$age ## Not run: age.DIF <- lordif(resp.data,age,model="GPCM",anchor=c(1:5,7,8,10,12:17,19:23,25:29)) ## Not run: print(age.DIF)
## Not run: data(Anxiety) ## Not run: resp.data <- Anxiety[paste("R",1:29,sep="")] ## Not run: age <- Anxiety$age ## Not run: age.DIF <- lordif(resp.data,age,model="GPCM",anchor=c(1:5,7,8,10,12:17,19:23,25:29)) ## Not run: print(age.DIF)
performs Monte Carlo simulations under no-DIF conditions to generate empirical distributions of statistics
montecarlo(obj, alpha = 0.01, nr = 100)
montecarlo(obj, alpha = 0.01, nr = 100)
obj |
an object returned from |
alpha |
desired significance level (e.g., .01) |
nr |
number of replications |
Simulated datasets are generated under no-DIF conditions and have the same dimensions as the empirical dataset. Group n-sizes and differences (impact) in theta estimates are preserved in the simulated datasets. Returns empirical distributions and thresholds for various statistics and effect size measures.
Returns an object (list) of class "lordif.MC" with the following components:
call |
calling expression |
chi12 |
prob associated with the LR Chi-square test comparing Model 1 vs. 2 |
chi13 |
prob associated with the LR Chi-square test comparing Model 1 vs. 3 |
chi23 |
prob associated with the LR Chi-square test comparing Model 2 vs. 3 |
pseudo12.CoxSnell |
Cox & Snell pseudo R-square change from Model 1 to 2 |
pseudo13.CoxSnell |
Cox & Snell pseudo R-square change from Model 1 to 3 |
pseudo23.CoxSnell |
Cox & Snell pseudo R-square change from Model 2 to 3 |
pseudo12.Nagelkerke |
Nagelkerke pseudo R-square change from Model 1 to 2 |
pseudo13.Nagelkerke |
Nagelkerke pseudo R-square change from Model 1 to 3 |
pseudo23.Nagelkerke |
Nagelkerke pseudo R-square change from Model 2 to 3 |
pseudo12.McFadden |
McFadden pseudo R-square change from Model 1 to 2 |
pseudo13.McFadden |
McFadden pseudo R-square change from Model 1 to 3 |
pseudo23.McFadden |
McFadden pseudo R-square change from Model 2 to 3 |
beta12 |
proportional beta change from Model 1 to 2 |
alpha |
significance level |
nr |
number of replications |
cutoff |
thresholds for the statistics |
nr must be a large integer (e.g., 500) to generate smooth distributions.
Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.DIF <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ##the following takes several minutes ## Not run: age.DIF.MC <- montecarlo(age.DIF,alpha=0.01,nr=100)
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.DIF <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ##the following takes several minutes ## Not run: age.DIF.MC <- montecarlo(age.DIF,alpha=0.01,nr=100)
performs permutation tests under no-DIF conditions to generate empirical distributions of DIF statistics
permute(obj, alpha = 0.01, nr = 100)
permute(obj, alpha = 0.01, nr = 100)
obj |
an object returned from |
alpha |
desired significance level (e.g., .01) |
nr |
number of replications |
The vector of group designations is randomly shuffled nr times to estimate the sampling distribution of the statistics when the null hypothesis is true. Returns empirical distributions and thresholds for various statistics and effect size measures.
Returns an object (list) of class "lordif.MC" with the following components:
call |
calling expression |
chi12 |
prob associated with the LR Chi-square test comparing Model 1 vs. 2 |
chi13 |
prob associated with the LR Chi-square test comparing Model 1 vs. 3 |
chi23 |
prob associated with the LR Chi-square test comparing Model 2 vs. 3 |
pseudo12.CoxSnell |
Cox & Snell pseudo R-square change from Model 1 to 2 |
pseudo13.CoxSnell |
Cox & Snell pseudo R-square change from Model 1 to 3 |
pseudo23.CoxSnell |
Cox & Snell pseudo R-square change from Model 2 to 3 |
pseudo12.Nagelkerke |
Nagelkerke pseudo R-square change from Model 1 to 2 |
pseudo13.Nagelkerke |
Nagelkerke pseudo R-square change from Model 1 to 3 |
pseudo23.Nagelkerke |
Nagelkerke pseudo R-square change from Model 2 to 3 |
pseudo12.McFadden |
McFadden pseudo R-square change from Model 1 to 2 |
pseudo13.McFadden |
McFadden pseudo R-square change from Model 1 to 3 |
pseudo23.McFadden |
McFadden pseudo R-square change from Model 2 to 3 |
beta12 |
proportional beta change from Model 1 to 2 |
alpha |
significance level |
nr |
number of replications |
cutoff |
thresholds for the statistics |
nr must be a large integer (e.g., 500) for smooth distributions.
Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.DIF <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ##the following takes several minutes ## Not run: age.DIF.MC <- permute(age.DIF,alpha=0.01,nr=100)
##load PROMIS Anxiety sample data (n=766) ## Not run: data(Anxiety) ##age : 0=younger than 65 or 1=65 or older ##run age-related DIF on all 29 items (takes about a minute) ## Not run: age.DIF <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ##the following takes several minutes ## Not run: age.DIF.MC <- permute(age.DIF,alpha=0.01,nr=100)
plots diagnostic graphs for items flagged for DIF
## S3 method for class 'lordif' plot(x, labels = c("Reference", "Focal"), width = 7, height = 7, ...)
## S3 method for class 'lordif' plot(x, labels = c("Reference", "Focal"), width = 7, height = 7, ...)
x |
output from |
labels |
labels for group levels, e.g., c("Male","Female") |
width |
width of the canvas of the plotting device in inches |
height |
height of the canvas of the plotting device in inches |
... |
extra graphical parameters |
Generates the following graphs IF there is one or more DIF items: 1. Trait Distributions - density graphs for groups 2. Item True Score Functions - true score functions by theta for groups 3. Differences in Item True Score Functions - unsigned differences 4. Item Response Functions - item response function for groups 5. Impact (Weighted by Density) - unsigned differences weighted by theta distributions for the focal group 6. Comparison of TCCs by group based on all items and DIF items 7. Impact on Theta Estimates - theta estimates by group before and after accounting for DIF
Graphs 2-5 are generated for each DIF item Graphs 1, 6 and 7 are generated for the whole analysis
Returns no object.
Produces graphs only if x contains DIF items. No graphs if no DIF items are present.
Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
##run lordif first ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ## Not run: plot(age.dif,labels=c("Younger","Older"),width=8,height=7,cex=0.8,lwd=1)
##run lordif first ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ## Not run: plot(age.dif,labels=c("Younger","Older"),width=8,height=7,cex=0.8,lwd=1)
Produces plots for Monte Carlo output
## S3 method for class 'lordif.MC' plot(x, mfrow = c(3, 1), width = 7, height = 7, ...)
## S3 method for class 'lordif.MC' plot(x, mfrow = c(3, 1), width = 7, height = 7, ...)
x |
an object of class lordif.MC returned from |
mfrow |
number of rows and columns per page for multi-fane plots |
width |
width of the canvas of the plotting device in inches |
height |
height of the canvas of the plotting device in inches |
... |
extra graphical parameters |
Generates the following graphs: 1. thresholds for Chi-square probability for Model 1 vs. 2 2. thresholds for Chi-square probability for Model 1 vs. 3 3. thresholds for Chi-square probability for Model 2 vs. 3 4. pseudo R-square change from Model 1 to 2 5. pseudo R-square change from Model 1 to 3 6. pseudo R-square change from Model 2 to 3 7. proportional beta change from Model 1 to 2
Returns no object.
x is an object of class lordif.MC returned from montecarlo
Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
## s3 plot method for class 'lordif.MC': ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ## Not run: age.dif.MC <- montecarlo(age.dif,alpha=.05,nr=500) ## Not run: plot(age.dif.MC,mfrow=c(1,1),width=8,height=7)
## s3 plot method for class 'lordif.MC': ## Not run: age.dif <- lordif(Anxiety[paste("R",1:29,sep="")],Anxiety$age) ## Not run: age.dif.MC <- montecarlo(age.dif,alpha=.05,nr=500) ## Not run: plot(age.dif.MC,mfrow=c(1,1),width=8,height=7)
Calculates a matrix of item response probabilities over a grid of theta values for an item
probgpcm(theta, a, cb)
probgpcm(theta, a, cb)
theta |
a vector of theta values (e.g., quadrature points) |
a |
a slope parameter value |
cb |
a vector of category threshold values |
The Generalized Partial Credit Model (Muraki, 1992) is assumed.
Returns a matrix of item response probabilities. The first dimension corresponds to the length of theta.
Seung W. Choi <[email protected]>
Muraki, E. (1992). A generalized partial credit model: Application of an EM algorithm. Applied Psychological Measurement, 16, 159-176.
probgrm(seq(-4,4,.1), 1.5, c(-1.2,0.5,1.5))
probgrm(seq(-4,4,.1), 1.5, c(-1.2,0.5,1.5))
Calculates a matrix of item response probabilities over a grid of theta values for an item
probgrm(theta, a, cb)
probgrm(theta, a, cb)
theta |
a vector of theta values (e.g., quadrature points) |
a |
a slope parameter value |
cb |
a vector of category threshold values |
The Graded Response Model (Samejima, 1969) is assumed.
Returns a matrix of item response probabilities. The first dimension corresponds to the length of theta.
Seung W. Choi <[email protected]>
Samejima, F. (1969). Estimation of latent ability using a response pattern of graded scores. Psychometrika Monograph, 17.
probgrm(seq(-4,4,.1), 1.5, c(-1.2,0.5,1.5))
probgrm(seq(-4,4,.1), 1.5, c(-1.2,0.5,1.5))
Recodes item responses as specified by original and modified
recode(vec, original, modified)
recode(vec, original, modified)
vec |
a vector of item responses to be recoded |
original |
original item response categories, e.g., c(0,1,2,3) |
modified |
modified item response categories, e.g., c(1,2,3,4) |
vec, original, and modified must be of the same mode. original and modified must be of the same length.
Returns a vector of the same length and mode as vec with recoded values.
Seung W. Choi <[email protected]>
x <- c(0,1,2,3,4,0,1,2,3,4) y <- c(0,1,2,3,4) z <- c(1,2,3,4,5) recode(x,y,z) ##returns c(1,2,3,4,5,1,2,3,4,5)
x <- c(0,1,2,3,4,0,1,2,3,4) y <- c(0,1,2,3,4) z <- c(1,2,3,4,5) recode(x,y,z) ##returns c(1,2,3,4,5,1,2,3,4,5)
Runs ordinal logistic regression DIF
rundif(item, resp, theta, gr, criterion, alpha, beta.change, pseudo.R2, R2.change, wt)
rundif(item, resp, theta, gr, criterion, alpha, beta.change, pseudo.R2, R2.change, wt)
item |
a selection of items to be analyzed |
resp |
a data frame containing item responses |
theta |
a conditioning (matching) variable |
gr |
a vector of group identifiers |
criterion |
criterion for flagging (i.e., "CHISQR", "R2", or "BETA") |
alpha |
significance level for Chi-squared criterion |
beta.change |
proportional change for Beta criterion |
pseudo.R2 |
pseudo R-squared measure (i.e., "McFadden", "Nagelkerke", or "CoxSnell") |
R2.change |
R-squared change for pseudo R-squared criterion |
wt |
optional sample weights |
The argument item lists the column numbers of the data frame resp to be included in the analysis.
Returns a list of the following components:
stats |
a data frame containing output statistics |
flag |
a logical vector of DIF flags |
Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
Crane, P. K., Gibbons, L. E., Jolley, L., and van Belle, G. (2006). Differential item functioning analysis with ordinal logistic regression techniques: DIF detect and difwithpar. Medical Care, 44(11 Suppl 3), S115-S123.
## Not run: rundif(item,resp,theta,gr)
## Not run: rundif(item,resp,theta,gr)
Runs ordinal logistic regression models and produces DIF statistics and effect size measures
runolr(rv, ev, gr, wt)
runolr(rv, ev, gr, wt)
rv |
a response variable |
ev |
an explanatory variable (e.g., conditioning variable) |
gr |
a vector of group identifiers |
wt |
a vector of optional sample weights |
Model 1: ev
Model 2: ev + gr
Model 3: ev*gr or equivalently ev + gr + ev*gr
Returns a list of the following components:
chi12 |
prob for the LR Chi-square comparing Model 1 vs. Model 2 |
chi13 |
prob for the LR Chi-square comparing Model 1 vs. Model 3 |
chi23 |
prob for the LR Chi-square comparing Model 2 vs. Model 3 |
beta12 |
proportional change in the coefficient for ev |
pseudo1.CoxSnell |
Cox & Snell psudo R-square for Model 1 |
pseudo2.CoxSnell |
Cox & Snell psudo R-square for Model 2 |
pseudo3.CoxSnell |
Cox & Snell psudo R-square for Model 1 |
pseudo1.Nagelkerke |
Nagelkerke psudo R-square for Model 1 |
pseudo2.Nagelkerke |
Nagelkerke psudo R-square for Model 2 |
pseudo3.Nagelkerke |
Nagelkerke psudo R-square for Model 3 |
pseudo1.McFadden |
McFadden psudo R-square for Model 1 |
pseudo2.McFadden |
McFadden psudo R-square for Model 2 |
pseudo3.McFadden |
McFadden psudo R-square for Model 3 |
pseudo12.CoxSnell |
Cox & Snell R-square change from Model 1 to Model 2 |
pseudo13.CoxSnell |
Cox & Snell R-square change from Model 1 to Model 3 |
pseudo23.CoxSnell |
Cox & Snell R-square change from Model 2 to Model 3 |
pseudo12.Nagelkerke |
Nagelkerke R-square change from Model 1 to Model 2 |
pseudo13.Nagelkerke |
Nagelkerke R-square change from Model 1 to Model 3 |
pseudo23.Nagelkerke |
Nagelkerke R-square change from Model 2 to Model 3 |
pseudo12.McFadden |
McFadden R-square change from Model 1 to Model 2 |
pseudo13.McFadden |
McFadden R-square change from Model 1 to Model 3 |
pseudo23.McFadden |
McFadden R-square change from Model 2 to Model 3 |
df12 |
df for the LR Chi-square comparing Model 1 and Model 2 |
df13 |
df for the LR Chi-square comparing Model 1 and Model 3 |
df23 |
df for the LR Chi-square comparing Model 2 and Model 3 |
Seung W. Choi <[email protected]>
Choi, S. W., Gibbons, L. E., Crane, P. K. (2011). lordif: An R Package for Detecting Differential Item Functioning Using Iterative Hybrid Ordinal Logistic Regression/Item Response Theory and Monte Carlo Simulations. Journal of Statistical Software, 39(8), 1-30. URL http://www.jstatsoft.org/v39/i08/.
Crane, P. K., Gibbons, L. E., Jolley, L., & van Belle, G. (2006). Differential item functioning analysis with ordinal logistic regression techniques: DIF detect and difwithpar. Medical Care, 44(11 Suppl 3), S115-S123.
## Not run: runolr(rv, ev, gr)
## Not run: runolr(rv, ev, gr)
Splits item response vectors of DIF items into separate group-specific vectors.
separate(resp, flag, gr)
separate(resp, flag, gr)
resp |
a data frame (or matrix) of item responses |
flag |
a vector of DIF flags |
gr |
a vector of group identifiers |
To obtain group specific item calibrations, response vectors of DIF items are split into multiple vectors by group and treated as separate items.
Returns a data frame with item response vectors for non-DIF items followed by separated item response vectors for DIF items
Seung W. Choi <[email protected]>
## Not run: separate(resp,flag,gr)
## Not run: separate(resp,flag,gr)
computes a test characteristic curve (tcc) from input item parameters
tcc(a, cb, theta, model = "GRM")
tcc(a, cb, theta, model = "GRM")
a |
a vector of slope parameters |
cb |
a matrix of category boundary/threshold parameters |
theta |
a grid of theta values |
model |
IRT model, either "GRM" or "GPCM" |
Either the graded response model (GRM) or the generalized partial credit model (GPCM) can be specified. The lowest response/score for each item is coded as 0 not 1.
Retruns a vector of tcc values over a theta grid
Seung W. Choi <[email protected]>
## Not run: tcc(a,cb,theta,model="GRM") ## Not run: tcc(a,cb,theta,model="GPCM")
## Not run: tcc(a,cb,theta,model="GRM") ## Not run: tcc(a,cb,theta,model="GPCM")