predict {bayesnec} | R Documentation |
Generates mean posterior predictions for objects fitted by
bnec
Description
Generates mean posterior predictions for objects fitted by
bnec
. object
should be of class
bayesnecfit
or bayesmanecfit
.
Usage
## S3 method for class 'bayesnecfit'
predict(object, ...)
## S3 method for class 'bayesmanecfit'
predict(object, summary = TRUE, robust = FALSE, probs = c(0.025, 0.975), ...)
Arguments
object |
An object of class |
... |
Additional arguments to |
summary |
Should summary statistics be returned
instead of the raw values? Default is |
robust |
If |
probs |
The percentiles to be computed by the |
Value
See ?brms::predict.brmsfit
.
Examples
## Not run:
library(bayesnec)
# Uses default `resolution` and `x_range` to generate `newdata` internally
predict(manec_example)
# Provide user-specified `newdata`
nd_ <- data.frame(x = seq(0, 3, length.out = 200))
predict(manec_example, ecx_val = 50, newdata = nd_, make_newdata = FALSE)
# Predictions for raw input data
nec4param <- pull_out(manec_example, model = "nec4param")
preds <- predict(nec4param, make_newdata = FALSE)
x <- pull_brmsfit(nec4param)$data$x
plot(x, preds[, 1])
## End(Not run)