predict.np_glm_b: Predict method for lm_b model fits

View source: R/predict.np_glm_b.R

predict.np_glm_bR Documentation

Predict method for lm_b model fits

Description

Predict method for lm_b model fits

Usage

## S3 method for class 'np_glm_b'
predict(object, newdata, trials, CI_level = 0.95, ...)

Arguments

object

Object of class lm_b

newdata

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

trials

Integer vector giving the number of trials for each observation if family = binomial().

CI_level

numeric. Credible interval level.

...

optional arguments.

Value

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

Examples


# Generate some data
set.seed(2025)
N = 500
test_data = 
  data.frame(x1 = rnorm(N),
             x2 = rnorm(N),
             x3 = letters[1:5])
test_data$outcome = 
  rbinom(N,1,1.0 / (1.0 + exp(-(-2 + test_data$x1 + 2 * (test_data$x3 %in% c("d","e")) ))))

# Fit the GLM via the (non-parametric) loss-likelihood bootstrap.
fit1 <-
  np_glm_b(outcome ~ x1 + x2 + x3,
           data = test_data,
           family = binomial())
predict(fit1)



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