Internal conf_int helper for the parsnip bru_reg engine
Source:R/bru_model.R
bru_predict_conf_int.RdComputes posterior credible intervals at an arbitrary level by sampling
via inlabru::generate() and taking the requested quantiles. Called by
parsnip's predict(type = "conf_int", level = ...) dispatch. Exported
only so parsnip::set_pred's quoted func can reach it via the
pkg = "inlaops" lookup; not intended for end users.
Examples
if (FALSE) { # interactive() && rlang::is_installed(c("INLA", "sn"))
set.seed(1)
dat <- data.frame(x = rnorm(30))
dat$y <- 1 + 0.5 * dat$x + rnorm(30, sd = 0.5)
fit <- bru_inlaops_fit(y ~ Intercept(1) + x, data = dat, family = "gaussian")
bru_predict_conf_int(
fit,
newdata = data.frame(x = c(-1, 0, 1)),
level = 0.9,
formula = bru_pred_formula(fit),
n.samples = 200
)
}