## 1. Create "-prm.txt" file for a single group
## using the simulated CAT data
# 1-(1) extract the item metadata
x <- simCAT_MX$item.prm
# 1-(2) set a name of "-prm.txt" file
temp_prm <- file.path(tempdir(), "single_group_temp-prm.txt")
# 1-(3) write out the "-prm.txt" file
write.flexmirt(x, file=temp_prm, norm.pop=c(0, 1), rePrm=FALSE)
## 2. Create "-prm.txt" file for multiple groups
## using the simulated three multiple group data
# 2-(1) extract the item metadata
x <- simMG$item.prm
# set a name of "-prm.txt" file
temp_prm <- file.path(tempdir(), "mg_group_temp-prm1.txt")
# write out the "-prm.txt" file
write.flexmirt(x, file=temp_prm, norm.pop=list(c(0, 1), c(0.5, 0.8), c(-0.3, 1.3)),
rePrm=FALSE, mgroup=TRUE, group.name=c("GR1", "GR2", "GR3"))
# or write out the "-prm.txt" file so that
# all groups have the same ability distributions
# and the group names are generate autoumatically
temp_prm <- file.path(tempdir(), "mg_group_temp-prm2.txt")
write.flexmirt(x, file=temp_prm, norm.pop=c(0, 1),
rePrm=FALSE, mgroup=TRUE, group.name=NULL)
Run the code above in your browser using DataLab