tests/testthat/tests.mplus.R

context("Tests for TIRT models fitted with Mplus")

skip("Mplus is not open source software")

test_that("mplus code for bernoulli responses works", {
  set.seed(1234)
  lambdas <- c(runif(6, 0.5, 1), runif(6, -1, -0.5))
  sdata <- sim_TIRT_data(
    npersons = 100,
    ntraits = 3,
    nblocks_per_trait = 4,
    gamma = 0,
    lambda = lambdas,
    Phi = diag(3),
    family = "bernoulli"
  )
  fit <- suppressWarnings(fit_TIRT_mplus(sdata))
  expect_is(fit, "TIRTfit")
  pr <- suppressWarnings(predict(fit))
  pr_names <- c("id", "trait", "estimate")
  expect_equal(names(pr), pr_names)
  expect_equal(length(unique(pr$id)), 100)
})

Try the thurstonianIRT package in your browser

Any scripts or data that you put into this service are public.

thurstonianIRT documentation built on Aug. 22, 2023, 5:08 p.m.