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