Learn R Programming

mirt (version 0.4.0)

multipleGroup: Multiple Group Estimation

Description

multipleGroup performes a full-information maximum-likelihood multiple group analysis for dichotomous and polytomous data under the item response theory paradigm using either Cai's (2010) Metropolis-Hastings Robbins-Monro algorithm or with an EM approach.

Usage

multipleGroup(data, model, group, itemtype = NULL, guess
    = 0, upper = 1, free.start = NULL, invariance = '',
    method = 'MHRM', constrain = NULL, startvalues = NULL,
    parprior = NULL, freepars = NULL, draws = 2000, quadpts
    = NULL, technical = list(), debug = FALSE, verbose =
    TRUE)

## S3 method for class 'MultipleGroupClass': coef(object, digits = 3, verbose = TRUE, ...)

## S3 method for class 'MultipleGroupClass': summary(object, digits = 3, verbose = TRUE, ...)

## S3 method for class 'MultipleGroupClass': anova(object, object2)

Arguments

data
a matrix or data.frame that consists of numerically ordered data, with missing data coded as NA
model
an object or named list of objects returned from confmirt.model() declaring how the factor model is to be estimated. The names of the list input must correspond to the unique values in the group variable. See
group
a character vector indicating group membership
invariance
a character vector containing the following possible options: [object Object],[object Object],[object Object],[object Object],[object Object]
guess
initial (or fixed) values for the pseudo-guessing parameter. Can be entered as a single value to assign a global guessing parameter or may be entered as a numeric vector for each item
upper
initial (or fixed) upper bound parameters for 4-PL model. Can be entered as a single value to assign a global upper bound parameter or may be entered as a numeric vector corresponding to each item
free.start
a list containing the start value and logical indicating whether a given parameter is to be freely estimated. Each element of the list consists of three components, the parameter number, the starting (or fixed) value, and a logical to indicate whe
verbose
logical; display iteration history during estimation?
draws
the number of Monte Carlo draws to estimate the log-likelihood
quadpts
the number of quadratures to be used per dimensions when method = 'EM'
method
a character indicating whether to use the EM ('EM') or the MH-RM ('MHRM') algorithm
itemtype
type of items to be modeled, declared as a vector for each item or a single value which will be repeated globally. The NULL default assumes that the items are ordinal or 2PL, however they may be changed to the following: 'Rasch', '1PL', '2PL', '3P
constrain
a list of user declared equality constraints. To see how to define the parameters correctly use constrain = 'index' initially to see how the parameters are labeled. To constrain parameters to be equal create a list with separate conca
parprior
a list of user declared prior item probabilities. To see how to define the parameters correctly use parprior = 'index' initially to see how the parameters are labeled. Can define either normal (normally for slopes and intercepts) or b
freepars
a list of user declared logical values indicating which parameters to estimate. To see how to define the parameters correctly use freepars = 'index' initially to see how the parameters are labeled. These values may be modified and inp
startvalues
a list of user declared start values for parameters. To see how to define the parameters correctly use startvalues = 'index' initially to see what the defaults would noramlly be. These values may be modified and input back into the fu
debug
logical; turn on debugging features?
object
an object of class confmirtClass
object2
an object of class confmirtClass
digits
the number of significant digits to be rounded
technical
list specifying subtle parameters that can be adjusted. These values are [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
...
additional arguments to be passed

Details

By default the estimation in multipleGroup assumes that the models are maximally independent, and therefore could initially be performed by sub setting the data and running identical models with confmirt or mirt and aggregating the results (e.g., log-likelihood). However, constrains may be imposed across groups by invoking various invariance keywords or by inputing user defined freepars, constrain, and startvalues lists.

See Also

expand.table, key2binary, simdata, confmirt.model, fscores

Examples

Run this code
#single factor
set.seed(12345)
a <- matrix(abs(rnorm(15,1,.3)), ncol=1)
d <- matrix(rnorm(15,0,.7),ncol=1)
itemtype <- rep('dich', nrow(a))
N <- 1000
dataset1 <- simdata(a, d, N, itemtype)
dataset2 <- simdata(a, d, N, itemtype, mu = .1, sigma = matrix(1.5))
dat <- rbind(dataset1, dataset2)
group <- c(rep('D1', N), rep('D2', N))
models <- confmirt.model()
   F1 = 1-15


mod_configural <- multipleGroup(dat, models, group = group, method = 'EM') #completely seperate analyses
mod_metric <- multipleGroup(dat, models, group = group, invariance=c('slopes'), method = 'EM') #equal slopes
mod_scalar2 <- multipleGroup(dat, models, group = group, method = 'EM',  #equal intercepts, free variance and means
                             invariance=c('slopes', 'intercepts', 'free_varcov','free_means'))
mod_scalar1 <- multipleGroup(dat, models, group = group, method = 'EM', #fixed means
                             invariance=c('slopes', 'intercepts', 'free_varcov'))
mod_fullconstrain <- mirt(data, models) #fix variance (equivelent to full constrain)

anova(mod_metric, mod_configural) #equal slopes only
anova(mod_scalar2, mod_metric) #equal intercepts, free variance and mean
anova(mod_scalar1, mod_scalar2) #fix mean
anova(mod_fullconstrain, mod_scalar1) #fix variance


#Wald test can be useful here too
#compare whether intercepts should be equal
index <- multipleGroup(dat, models, group = group, constrain = 'index')
index
nitems <- ncol(dat)
L <- matrix(0, nitems, 124)
for(i in 1:nitems){
     L[i, index[[1]][[i]][2]] <- 1
     L[i, index[[2]][[i]][2]] <- -1
 }
wald(L, mod_configural)


#############
#multiple factors

a <- matrix(c(abs(rnorm(5,1,.3)), rep(0,15),abs(rnorm(5,1,.3)),
rep(0,15),abs(rnorm(5,1,.3))), 15, 3)
d <- matrix(rnorm(15,0,.7),ncol=1)
mu <- c(-.4, -.7, .1)
sigma <- matrix(c(1.21,.297,1.232,.297,.81,.252,1.232,.252,1.96),3,3)
itemtype <- rep('dich', nrow(a))
N <- 1000
dataset1 <- simdata(a, d, N, itemtype)
dataset2 <- simdata(a, d, N, itemtype, mu = mu, sigma = sigma)
dat <- rbind(dataset1, dataset2)
group <- c(rep('D1', N), rep('D2', N))

#group models
model1 <- confmirt.model()
   F1 = 1-5
   F2 = 6-10
   F3 = 11-15


model2 <- confmirt.model()
   F1 = 1-5
   F2 = 6-10
   F3 = 11-15
   COV = F1*F2, F1*F3, F2*F3


models <- list(D1=model1, D2=model2) #note the names match the groups

mod_configural <- multipleGroup(dat, models, group = group) #completely seperate analyses
mod_metric <- multipleGroup(dat, models, group = group, invariance=c('slopes')) #equal slopes
mod_scalar <- multipleGroup(dat, models, group = group, #equal means, slopes, intercepts
                             invariance=c('slopes', 'intercepts', 'free_varcov'))
mod_fullconstrain <- confmirt(data, models)

anova(mod_metric, mod_configural)
anova(mod_scalar, mod_metric)
anova(mod_fullconstrain, mod_scalar)

Run the code above in your browser using DataLab