Problems simulating data

51 views
Skip to first unread message

Luis Manuel Lozano

unread,
Jun 2, 2016, 10:29:17 AM6/2/16
to mirt-package
Hi Phil,

I ama new R user and of course, new on dirt package, so maybe the question is an easy one because of my inexperience.

I am trying to simulate a multidimensional IRT model with two factors (a correlation of .35 between them). The answers have to be in a Likert scale of 5 points. The code I use is:

library(mvtnorm)
library(mirt)

Theta <- rmvnorm(1000, sigma = matrix(c(1, .35, .35, 1), 2))

a <- matrix(c(rlnorm(40, .2, .3),rlnorm(40,.7,.4)),2)
diffs <- t(apply(matrix(runif(40*4, .3, 1), 40), 1, cumsum)); 
diffs <- -(diffs - rowMeans(diffs)); 
d <- diffs + rnorm(40)

datos <- simdata(a, d, 1000, Theta=Theta, itemtype = 'graded')
datos
modelo<-mirt(datos,2)

When I run the program I obtain negative coefficients in the a parameters and I do not know what is wrong?

Do you think that the program is correct? If not where can I read something to make it properly?

Thanks in advance and congratulations for the packages
Luis M. Lozano

Phil Chalmers

unread,
Jun 3, 2016, 11:04:14 AM6/3/16
to Luis Manuel Lozano, mirt-package
The model is exploratory, so negative coefs are likely to occur and require rotation after convergence (see topics on exploratory factor analysis for more information on this phenomenon). Cheers.

Phil

--
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.

Reply all
Reply to author
Forward
0 new messages