inst/tinytest/test_riskreg.R

set.seed(1)
m <- lava::lvm(
  a[-2] ~ 1 * x + z,
  linpred.target[1] ~ 1,
  linpred.nuisance[-1] ~ 2 * x + z
)
lava::distribution(m, ~a) <- lava::binomial.lvm("logit")
m <- lava::binomial.rr(m, "y", "a", "linpred.target", "linpred.nuisance")
d <- lava::sim(m, 1e3)

fit <- targeted::riskreg(y ~ a | 1 | x + z | 1, data = d, type = "rr")
influ <- lava::IC(fit)
val <- colMeans(influ)^2
expect_true(val < 1e-3)

Try the targeted package in your browser

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

targeted documentation built on Jan. 12, 2026, 9:08 a.m.