tests/testthat/test-device-linking.R

test_that("device linking estimates and applies transfer", {
  set.seed(1)
  base <- expand.grid(person_id = 1:30, item_id = 1:3)
  reference <- transform(base, device = "reference", metric = rnorm(nrow(base), 10, 2))
  candidate <- transform(reference, device = "candidate", metric = 1 + 1.1 * metric + rnorm(nrow(base), 0, 0.3))
  data <- rbind(reference, candidate)
  fit <- fit_device_linking(data, "metric", "reference")
  linked <- apply_device_linking(candidate, fit)
  expect_true("metric_linked" %in% names(linked))
  equivalence <- audit_device_equivalence(fit, equivalence_margin = 2)
  expect_s3_class(equivalence, "eye_device_equivalence")
  expect_true(nrow(estimate_device_specific_error(fit)) >= 1)
  expect_plot_silent(plot_device_agreement(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.