Generates mean posterior linear predictions for objects fitted by bnec. object should be of class bayesnecfit or bayesmanecfit.

# S3 method for class 'bayesnecfit'
fitted(object, ...)

# S3 method for class 'bayesmanecfit'
fitted(object, summary = TRUE, robust = FALSE, probs = c(0.025, 0.975), ...)

Arguments

object

An object of class bayesnecfit or bayesmanecfit.

...

Additional arguments to fitted.brmsfit if object is of class bayesnecfit, or to posterior_epred.brmsfit if object is of class bayesmanecfit.

summary

Should summary statistics be returned instead of the raw values? Default is TRUE.

robust

If FALSE (the default) the mean is used as the measure of central tendency and the standard deviation as the measure of variability. If TRUE, the median and the median absolute deviation (MAD) are applied instead. Only used if summary is TRUE.

probs

The percentiles to be computed by the quantile function. Only used if summary is TRUE.

Value

See ?brms:fitted.brmsfit.

Examples

if (FALSE) { # \dontrun{
library(bayesnec)
# Uses default `resolution` and `x_range` to generate `newdata` internally
fitted(manec_example)
# Provide user-specified `newdata`
nd_ <- data.frame(x = seq(0, 3, length.out = 200))
fits <- fitted(manec_example, ecx_val = 50, newdata = nd_,
               make_newdata = FALSE)
nrow(fits) == 200
# Predictions for raw input data
nec4param <- pull_out(manec_example, model = "nec4param")
fits <- fitted(nec4param, make_newdata = FALSE)
x <- pull_brmsfit(nec4param)$data$x
plot(x, fits[, 1])
} # }