Hi Tongyun,
Just replace the 1 with something defined by mirt.model() representing a two dimensional pattern, and the rest will work. Cheers.
Phil
>
> Thank you in advance!
>
> Tongyun
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
Thanks Phil! It works, but I have two follow-up questions:
1) I ran a confirmatory simple-structure 2-dimensional MIRT, everything worked until the last step when I requested for plausible values, I got error message saying Error in `colnames<-`(`*tmp*`, value = "SE_") : length of 'dimnames' [2] not equal to array extent". I wonder if there is anything wrong in my use of fscore() function. Below is my code:
#Model
Q=matrix(c(rep(1,34),rep(0,39),rep(0,34),rep(1,39)), ncol=2,byrow=F, dimnames = list(NULL, c('V1', 'V2')))
COV=matrix(c(FALSE, TRUE, TRUE, FALSE), 2)
model=mirt.model(Q, COV=COV)
#Covariate
N <- 5000
X1 <- rnorm(N); X2 <- rnorm(N)
covdata <- data.frame(X1, X2)
#Latent Regression
mod1 = mirt(data, model, covdata=covdata, formula = ~ X1 + X2)
pv = fscores(mod1, plausible.draws = 5)
2) My second question is, can I do a two-step estimation? Basically, I used the same model but fixed all the item parameters using item parameter estimates from a previous run, but I got an error message in the last step: "in UpdatePrepList(PrepList, pars, random = mixed.design$random, :Rows in supplied and starting value data.frame objects do not match. Were the data or itemtype input arguments modified?" Did I do something wrong? Below is my code:
model=mirt.model(Q, COV=COV)
mod=mirt(data,model,pars='values')
mod$value[mod$name == 'a1']=a1
mod$value[mod$name == 'a2']=a2
mod$value[mod$name == 'd']=d
mod$est=FALSE
mod$est[mod$item == 'GROUP']=TRUE
mod2=mirt(data, model, pars=mod, covdata=covdata, formula = ~ X1 + X2)