tests/testthat/test-vcov.R

dat <- lavaan::HolzingerSwineford1939
mod <- "
  visual  =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
"

test_that("vcov() returns a matrix for INLAvaan objects", {
  fit <- acfa(mod, dat, verbose = FALSE, nsamp = 3, test = "none")
  vc <- suppressMessages(vcov(fit))
  expect_true(is.matrix(vc))
  expect_equal(nrow(vc), length(coef(fit)))
  expect_equal(ncol(vc), length(coef(fit)))
})

test_that("vcov(type = 'theta') returns Laplace covariance", {
  fit <- acfa(mod, dat, verbose = FALSE, nsamp = 3, test = "none")
  vt <- vcov(fit, type = "theta")
  expect_true(is.matrix(vt))
  expect_true(isSymmetric(vt))
})

Try the INLAvaan package in your browser

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

INLAvaan documentation built on Oct. 2, 2026, 1:07 a.m.