inst/tinytest/test_pava.R

n <- 10
x <- runif(n, -4, 4)
y <- rbinom(n, 1, lava::expit(-1 + x))
ord <- order(x)
pv <- targeted::pava(y[ord])
xx <- x[ord[pv$index]]
yy <- pv$value
af <- stepfun(c(xx), c(yy, max(yy)), f = 0, right = TRUE)
af2 <- as.stepfun(stats::isoreg(x, y))
expect_equal(sum((af(x) - af2(x))^2), 0, tolerance = 1e-1)

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.