predict.lm_b: Predict method for lm_b model fits

View source: R/predict.lm_b.R

predict.lm_bR Documentation

Predict method for lm_b model fits

Description

Predict method for lm_b model fits

Usage

## S3 method for class 'lm_b'
predict(object, newdata, CI_level = 0.95, PI_level = 0.95, n_draws = 0, ...)

Arguments

object

Object of class lm_b

newdata

An optional data.frame in which to look for variables with which to predict.

CI_level

Posterior probability covered by credible interval

PI_level

Posterior probability covered by prediction interval

n_draws

If desired, the number of posterior samples drawn.

...

optional arguments.

Value

tibble with estimate (posterior mean), prediction intervals, and credible intervals for the mean.

Examples


set.seed(2025)
N = 500
test_data <-
  data.frame(x1 = rnorm(N),
             x2 = rnorm(N),
             x3 = letters[1:5])
test_data$outcome <-
  rnorm(N,-1 + test_data$x1 + 2 * (test_data$x3 %in% c("d","e")) )
fit1 <-
  lm_b(outcome ~ x1 + x2 + x3,
       data = test_data)
predict(fit1)



bayesics documentation built on March 11, 2026, 5:07 p.m.