tests/testthat/test-0-8-bayesian-3pl-diagnostics.R

test_that("gaze-anchored 3PL audit is guarded by mirt availability", {
  if (!requireNamespace("mirt", quietly = TRUE)) skip("mirt unavailable")
  set.seed(8801)
  X <- as.data.frame(matrix(rbinom(120 * 8, 1, .62), nrow = 120, ncol = 8))
  names(X) <- paste0("I", seq_len(ncol(X)))
  proc <- expand.grid(person_id = seq_len(nrow(X)), item_id = names(X), KEEP.OUT.ATTRS = FALSE)
  proc$rt_ms <- stats::rlnorm(nrow(proc), log(1000), .2)
  proc$ttff_ms <- stats::rlnorm(nrow(proc), log(300), .2)
  proc$dwell_ms <- stats::rlnorm(nrow(proc), log(700), .2)
  fit <- fit_gaze_anchored_3pl_audit(X, proc, item = "item_id", process_features = c("rt_ms", "ttff_ms", "dwell_ms"))
  expect_s3_class(fit, "eye_gaze_anchored_3pl_audit")
  expect_equal(nrow(fit$item_parameters), ncol(X))
  expect_true(all(c("item_id", "lower_asymptote") %in% names(fit$item_parameters)))
  expect_true(is.data.frame(gaze_anchored_3pl_alignment(fit)))
})

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.