tests/testthat/test-0-9-m2-irt-diagnostics.R

test_that("IRT fit diagnostics remain finite on ordinary data", {
  set.seed(1)
  p <- matrix(runif(120, .15, .85), nrow = 20)
  y <- matrix(rbinom(120, 1, p), nrow = 20)
  colnames(y) <- colnames(p) <- paste0("I", 1:6)
  it <- eyeprocess_irt_item_fit_residuals(y, p)
  pe <- eyeprocess_irt_person_fit_residuals(y, p)
  q3 <- eyeprocess_irt_q3(y, p)
  io <- eyeprocess_irt_infit_outfit(y, p, by = "item")
  lz <- eyeprocess_irt_person_fit_lz(y, p)
  expect_equal(nrow(it), 6L)
  expect_equal(nrow(pe), 20L)
  expect_equal(dim(q3), c(6L, 6L))
  expect_true(all(is.finite(io$infit)))
  expect_true(all(is.finite(lz$lz)))
})

test_that("local-dependence extraction uses declared thresholds", {
  q <- matrix(c(NA,.4,.1,.4,NA,-.3,.1,-.3,NA),3,3)
  colnames(q) <- rownames(q) <- c("A","B","C")
  z <- eyeprocess_irt_local_dependence_pairs(q, threshold = .25)
  expect_equal(nrow(z), 2L)
  expect_true(all(z$abs_q3 >= .25))
})

Try the eyeprocess package in your browser

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

eyeprocess documentation built on Sept. 28, 2026, 5:08 p.m.