When I try to compute fit statistics for multigroup model with missing data I encounter an error:
Error in mod2values(x) :
cannot get a slot ("est") from an object of type "S4"
The problem does not occur in multigroup models without missing data nor in in single-group models with missing data, but coincidence of this two features (multigroup and missing data) causes problems.
See:
# code from examples in help for itemfit()
set.seed(1234)
a <- matrix(rlnorm(20, meanlog=0, sdlog = .1),ncol=1)
d <- matrix(rnorm(20),ncol=1)
items <- rep('dich', 20)
data <- simdata(a,d, 2000, items)
# further part of the example in which missing data is added
data[sample(1:prod(dim(data)), 500)] <- NA
raschfit <- mirt(data, 1, itemtype='Rasch')
Theta <- fscores(raschfit, method = 'ML', full.scores=TRUE)
itemfit(raschfit, impute = 10, Theta=Theta)
# new code - multigroup Rasch model (with full measurement invariance)
raschGrFit = multipleGroup(data, 1,
group = c(rep("gr1", 1000), rep("gr2", 1000)),
invariance = c("free_means", "free_var",
"slopes", "intercepts"),
itemtype = "Rasch")
# trying to compute itemfit (causes an error...)
ThetaGr <- fscores(raschGrFit, method = 'ML', full.scores=TRUE)
itemfit(raschGrFit, impute = 10, Theta=ThetaGr)
When I try to compute fit statistics for multigroup model with missing data I encounter an error: Error in mod2values(x) : cannot get a slot ("est") from an object of type "S4"
The problem does not occur in multigroup models without missing data nor in in single-group models with missing data, but coincidence of this two features (multigroup and missing data) causes problems.
See: