Version: | 0.4.2 |
Date: | 2025-1-8 |
Title: | Logistic Ordinal Regression Differential Item Functioning using IRT |
Maintainer: | Seung W. Choi <schoi@austin.utexas.edu> |
Depends: | R (≥ 3.6.0), mirt, rms, doSNOW, foreach |
Description: | Performs analysis of Differential Item Functioning (DIF) for dichotomous and polytomous items using an iterative hybrid of ordinal logistic regression and item response theory (IRT) according to Choi, Gibbons, and Crane (2011) <doi:10.18637/jss.v039.i08>. |
Imports: | stats4 |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
LazyLoad: | yes |
NeedsCompilation: | no |
Packaged: | 2025-01-08 19:24:59 UTC; chois1 |
Author: | Seung W. Choi [aut, cre], Laura E. Gibbons [aut], Paul K. Crane [aut] |
Repository: | CRAN |
Date/Publication: | 2025-01-09 00:10:02 UTC |
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).
Details
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.
Author(s)
Seung W. Choi, with contributions from Laura E. Gibbons and Paul K. Crane
Maintainer: Seung W. Choi <choi.phd@gmail.com>
References
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.
See Also
Examples
##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)
A Measure of Anxiety
Description
The data contains responses from 766 people sampled from a general population to the PROMIS Anxiety scale (https://www.healthmeasures.net/explore-measurement-systems/promis/) composed of 29 Likert-type questions with a common rating scale (1=Never, 2=Rarely, 3=Sometimes, 4=Often, and 5=Always).
Usage
data(Anxiety)
Format
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
Source
https://www.healthmeasures.net/explore-measurement-systems/promis/
References
PROMIS Cooperative Group. Unpublished Manual for the Patient-Reported Outcomes Measurement Information System (PROMIS) Version 1.1. October, 2008: https://www.healthmeasures.net/explore-measurement-systems/promis/
Examples
## Not run: data(Anxiety)
calculates DFIT statistics
Description
Calculates DFIT statistics using an object of class "lordif"
Usage
DFIT(obj)
Arguments
obj |
an object of class "lordif" |
Details
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.
Value
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 |
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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.
See Also
Examples
##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)
calculates item response probabilities
Description
Calculates item response probabilities over a theta grid according to either the GRM or the GPCM.
Usage
calcprob(ipar, theta, model = "GRM")
Arguments
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" |
Details
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".
Value
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.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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.
See Also
Examples
##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 EAP theta estimates and associated standard errors
Description
Calculates Expected A Posteriori (EAP) theta estimates and associated standard error estimates (posterior standard deviations).
Usage
calctheta(ipar, resp.data, theta, prior.mean = 0, prior.sd = 1, model = "GRM")
Arguments
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") |
Details
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").
Value
A list object with the following components
EAP |
Expected A Posteriori estimates of theta |
SE |
Standard Error estimates |
Note
Some missing item responses (NA) are allowed.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
Bock, R. D. & Mislevy, R. J. (1982). Adaptive EAP Estimation of Ability in a Microcomputer Environment. Applied Psychological Measurement, 6(4), 431-444.
See Also
Examples
## Not run: calctheta(ipar,resp.data,model="GPCM")
collapses response categories
Description
Collapses response categories if cell frequencies by group are below a minimum threshold specified by minCell and returns a vector of recoded responses.
Usage
collapse(resp, group, minCell)
Arguments
resp |
a vector of item responses |
group |
a vector of group designations |
minCell |
a minimum cell frequency |
Details
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.
Value
a numeric vector of the same length as resp with collapsed/recoded values.
Note
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.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
See Also
Examples
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
performs Stocking-Lord Equating
Description
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)
Usage
equate(ipar.to, ipar.from, theta, model = "GRM", start.AK = c(1, 0),
lower.AK = c(0.5, -2), upper.AK = c(2, 2))
Arguments
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 |
Details
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).
Value
returns a vector of two elements, c(A, K) where A is a multiplicative constant and K is an additive constant
Note
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).
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
Stocking, M. L. & Lord, F. M. (1983). Developing a Common Metric in Item Response Theory. Applied Psychological Measurement, 7(2), 201-210.
See Also
Examples
##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 parameters
Description
Extracts IRT item parameter estimates from an output returned from mirt::mirt()
Usage
extract(ipar)
Arguments
ipar |
output from the |
Details
similar to the coef function in the mirt package
Value
a data frame containing item parameter estimates in the order of a, cb1, cb2,..., cb(maxCat-1).
Author(s)
Seung W. Choi <choi.phd@gmail.com>
See Also
Examples
##calib.sparse <- mirt(sparse.matrix,1,itemtype="gpcm")
## Not run: ipar.sparse <- extract(calib.sparse)
determines a cutoff threshold
Description
Determines an empirical cutoff value for statistics generated from a Monte Carlo simulation.
Usage
getcutoff(stat, alpha, reverse)
Arguments
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) |
Details
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.
Value
returns a scalar corresponding to the quantile of the statistics determined by alpha or (1-alpha)
Author(s)
Seung W. Choi <choi.phd@gmail.com>
See Also
Examples
#top 1 percent
getcutoff(runif(1000),0.01,TRUE)
#bottom 1 percent
getcutoff(runif(1000),0.01,FALSE)
performs Logistic Ordinal Regression Differential Item Functioning using IRT
Description
performs iterative hybrid ordinal logistic regression/IRT DIF
Usage
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)
Arguments
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 |
Details
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.
Value
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 |
Note
requires the mirt and rms packages
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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.
See Also
Examples
## 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 to generate empirical distributions
Description
performs Monte Carlo simulations under no-DIF conditions to generate empirical distributions of statistics
Usage
montecarlo(obj, alpha = 0.01, nr = 100)
Arguments
obj |
an object returned from |
alpha |
desired significance level (e.g., .01) |
nr |
number of replications |
Details
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.
Value
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 |
Note
nr must be a large integer (e.g., 500) to generate smooth distributions.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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/.
See Also
Examples
##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 test for empirical cutoff thresholds
Description
performs permutation tests under no-DIF conditions to generate empirical distributions of DIF statistics
Usage
permute(obj, alpha = 0.01, nr = 100)
Arguments
obj |
an object returned from |
alpha |
desired significance level (e.g., .01) |
nr |
number of replications |
Details
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.
Value
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 |
Note
nr must be a large integer (e.g., 500) for smooth distributions.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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/.
See Also
Examples
##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)
Plot method for lordif class
Description
plots diagnostic graphs for items flagged for DIF
Usage
## S3 method for class 'lordif'
plot(x, labels = c("Reference", "Focal"), width = 7, height = 7, BW = FALSE, ...)
Arguments
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 |
BW |
whether to plot in black-and-white rather than in color |
... |
extra graphical parameters |
Details
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
Value
Returns no object.
Note
Produces graphs only if x contains DIF items. No graphs if no DIF items are present.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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/.
See Also
Examples
##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)
Plot method for Monte Carlo simulation output
Description
Produces plots for Monte Carlo output
Usage
## S3 method for class 'lordif.MC'
plot(x, mfrow = c(3, 1), width = 7, height = 7, BW = FALSE, ...)
Arguments
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 |
BW |
whether to plot in black-and-white rather than in color |
... |
extra graphical parameters |
Details
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
Value
Returns no object.
Note
x is an object of class lordif.MC returned from montecarlo
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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/.
See Also
Examples
## 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 item response probabilities according to GPCM
Description
Calculates a matrix of item response probabilities over a grid of theta values for an item
Usage
probgpcm(theta, a, cb)
Arguments
theta |
a vector of theta values (e.g., quadrature points) |
a |
a slope parameter value |
cb |
a vector of category threshold values |
Details
The Generalized Partial Credit Model (Muraki, 1992) is assumed.
Value
Returns a matrix of item response probabilities. The first dimension corresponds to the length of theta.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
Muraki, E. (1992). A generalized partial credit model: Application of an EM algorithm. Applied Psychological Measurement, 16, 159-176.
See Also
Examples
probgrm(seq(-4,4,.1), 1.5, c(-1.2,0.5,1.5))
calculates item response probabilities according to GRM
Description
Calculates a matrix of item response probabilities over a grid of theta values for an item
Usage
probgrm(theta, a, cb)
Arguments
theta |
a vector of theta values (e.g., quadrature points) |
a |
a slope parameter value |
cb |
a vector of category threshold values |
Details
The Graded Response Model (Samejima, 1969) is assumed.
Value
Returns a matrix of item response probabilities. The first dimension corresponds to the length of theta.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
Samejima, F. (1969). Estimation of latent ability using a response pattern of graded scores. Psychometrika Monograph, 17.
See Also
Examples
probgrm(seq(-4,4,.1), 1.5, c(-1.2,0.5,1.5))
recodes item responses
Description
Recodes item responses as specified by original and modified
Usage
recode(vec, original, modified)
Arguments
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) |
Details
vec, original, and modified must be of the same mode. original and modified must be of the same length.
Value
Returns a vector of the same length and mode as vec with recoded values.
Author(s)
Seung W. Choi <choi.phd@gmail.com>
Examples
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
Description
Runs ordinal logistic regression DIF
Usage
rundif(item, resp, theta, gr, criterion, alpha, beta.change, pseudo.R2, R2.change, wt)
Arguments
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 |
Details
The argument item lists the column numbers of the data frame resp to be included in the analysis.
Value
Returns a list of the following components:
stats |
a data frame containing output statistics |
flag |
a logical vector of DIF flags |
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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.
See Also
Examples
## Not run: rundif(item,resp,theta,gr)
runs ordinal logistic regression models
Description
Runs ordinal logistic regression models and produces DIF statistics and effect size measures
Usage
runolr(rv, ev, gr, wt)
Arguments
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 |
Details
Model 1: ev
Model 2: ev + gr
Model 3: ev*gr or equivalently ev + gr + ev*gr
Value
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 |
Author(s)
Seung W. Choi <choi.phd@gmail.com>
References
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.
See Also
Examples
## Not run: runolr(rv, ev, gr)
splits item response vectors of DIF items by group
Description
Splits item response vectors of DIF items into separate group-specific vectors.
Usage
separate(resp, flag, gr)
Arguments
resp |
a data frame (or matrix) of item responses |
flag |
a vector of DIF flags |
gr |
a vector of group identifiers |
Details
To obtain group specific item calibrations, response vectors of DIF items are split into multiple vectors by group and treated as separate items.
Value
Returns a data frame with item response vectors for non-DIF items followed by separated item response vectors for DIF items
Author(s)
Seung W. Choi <choi.phd@gmail.com>
Examples
## Not run: separate(resp,flag,gr)
computes a test characteristic curve (tcc)
Description
computes a test characteristic curve (tcc) from input item parameters
Usage
tcc(a, cb, theta, model = "GRM")
Arguments
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" |
Details
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.
Value
Retruns a vector of tcc values over a theta grid
Author(s)
Seung W. Choi <choi.phd@gmail.com>
See Also
Examples
## Not run: tcc(a,cb,theta,model="GRM")
## Not run: tcc(a,cb,theta,model="GPCM")