| predict.lm_b | R Documentation |
Predict method for lm_b model fits
## S3 method for class 'lm_b'
predict(object, newdata, CI_level = 0.95, PI_level = 0.95, n_draws = 0, ...)
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. |
tibble with estimate (posterior mean), prediction intervals, and credible intervals for the mean.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.