Error: Rows in supplied and starting value data.frame objects do not match. Were the data or itemtype input arguments modified?
# Code ==========================================================================================
library(mirt)
library(mvtnorm)
# Simulated data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
a <- matrix(c(rep(1, 20), rep(0,40), rep(1,20)), 40)
d <- matrix(rnorm(40*4), 40)
d <- t(apply(d, 1, sort, decreasing=TRUE))
dat <- simdata(a, d, 1000, Theta=Theta, itemtype = 'graded')
dat <- data.frame(poly=dat[,1:6])
# Model specification - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
model1 <- mirt.model('F1 = 1-6')
model2 <- mirt.model('F1 = 1-3
F2 = 4-6
COV = F1*F2')
# Estimation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
res1 <- mirt(model=model1, method="MHRM", SE=T, SE.type="MHRM", data=dat)
res2 <- mirt(model=model2, method="MHRM", SE=T, SE.type="MHRM", data=dat)
# Function to wrap up some fit statistics - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fit.fun <- function(res) {
items.fit <- list(S_X2=itemfit(x=res,
fit_stats = "S_X2"),
X2_star=itemfit(x=res,
fit_stats="X2*",
boot=1000),
X2_star_df=itemfit(x=res,
fit_stats = "X2*_df",
boot_dfapprox=1000)
)
return(items.fit)
}
fit.res1 <- fit.fun(res1) # Here the function works
fit.res2 <- fit.fun(res2) # Here it doesn't.
# Error: Rows in supplied and starting value data.frame objects do not match. Were the
# data or itemtype input arguments modified?
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Dear Phil,First, thank you for developing the mirt package. It is a really powerful, flexible and complete tool that I am extensively using for my PhD research.
I guess that I encountered a bug with the itemfit().I was trying to "extract" from the results of my model different goodness-of-fit statistics.However when I try to estimate the X2* or the X2*_df statistics I encounter the following error:Error: Rows in supplied and starting value data.frame objects do not match. Were the data or itemtype input arguments modified?Since I was trying different uni- and bidimensional models, I noticed that the error occurs when I switch from unidimensional to bidimensional ones.I didn't try with additional dimensions, thus I don't know if the problem occurs also with multidimensional(>2) models.In any case, thanks in advance and I look forward to hearing from you.
--
You received this message because you are subscribed to the Google Groups "mirt-package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mirt-package...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mirt-package/51724ecc-0607-4579-b356-2239a8479177%40googlegroups.com.