##### Load required package.
library(mvtnorm)
##### Item parameters
set.seed(123)
GPCMa <- runif(60, 0.8, 2)
GPCMb <- vector("list", 60)
for(i in 1:60) GPCMb[[i]] <- -c(runif(1, -3, -2),
runif(1, -1.5, -0.5),
runif(1, 0, 1),
runif(1, 1.5, 2.5))
##### Generate data from a two-dimensional independent-clusters model
mydata <- DGP(matrix(c(GPCMa[1:30], rep(0, 60), GPCMa[31:60]),
ncol = 2), GPCMb, model = rep("GPCM", 60),
rmvnorm(1000, c(0, 0), matrix(c(1, 0.6, 0.6, 1),
ncol = 2)))
Run the code above in your browser using DataLab