tests/testthat/test-variance.R

test_that("vcovHC works", {
  pc <- predict_counterfactual(fit_binom, treatment ~ s1)
  expect_snapshot(
    vcovHC(pc)
  )
  pc <- predict_counterfactual(fit_binom, treatment ~ pb(s1))
  expect_snapshot(
    vcovHC(pc)
  )
})

test_that("vcovG works", {
  pc <- predict_counterfactual(fit_binom, treatment ~ s1)
  expect_snapshot(
    vcovG(pc)
  )
  pc <- predict_counterfactual(fit_binom, treatment ~ 1)
  expect_snapshot(
    vcovG(pc)
  )
  pc <- predict_counterfactual(fit_binom, treatment ~ pb(s1))
  expect_snapshot(
    vcovG(pc)
  )
  expect_snapshot(
    vcovG(pc, decompose = FALSE)
  )
  pc <- predict_counterfactual(fit_binom, treatment ~ ps(s1))
  expect_snapshot(
    vcovG(pc)
  )
})

Try the RobinCar2 package in your browser

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

RobinCar2 documentation built on April 3, 2025, 9:34 p.m.