Skip to content

Instantly share code, notes, and snippets.

@ramiroluz
Created October 3, 2017 14:16
Show Gist options
  • Save ramiroluz/c7de6ac845bc119008ce5b3fdf2d2faf to your computer and use it in GitHub Desktop.
Save ramiroluz/c7de6ac845bc119008ce5b3fdf2d2faf to your computer and use it in GitHub Desktop.
# https://github.com/philchalmers/mirtCAT/blob/master/R/extract.mirtCAT.R
set.seed(1234)
nitems <- 25
itemnames <- paste0('Item.', 1:nitems)
a <- matrix(rlnorm(nitems, .2, .3))
d <- matrix(rnorm(nitems))
dat <- simdata(a, d, 500, itemtype = 'dich')
colnames(dat) <- itemnames
mod <- mirt(dat, 1, verbose = FALSE, TOL = .01)
# simple math items
questions <- answers <- character(nitems)
choices <- matrix(NA, nitems, 5)
spacing <- floor(d - min(d)) + 1 #easier items have more variation in the options
@ramiroluz
Copy link
Author

d
[,1]
[1,] -1.4482049
[2,] 0.5747557
[3,] -1.0236557
[4,] -0.0151383
[5,] -0.9359486
[6,] 1.1022975
[7,] -0.4755931
[8,] -0.7094400
[9,] -0.5012581
[10,] -1.6290935
[11,] -1.1676193
[12,] -2.1800396
[13,] -1.3409932
[14,] -0.2942939
[15,] -0.4658975
[16,] 1.4494963
[17,] -1.0686427
[18,] -0.8553646
[19,] -0.2806230
[20,] -0.9943401
[21,] -0.9685143
[22,] -1.1073182
[23,] -1.2519859
[24,] -0.5238281
[25,] -0.4968500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment