A thin wrapper on kb_predict_weight(): predict weight at the supplied new_data
rows (or the observed data when new_data = NULL). For allometric curves to
visualise, use kb_predict_weight_by().
Arguments
- object
A
kb_fit_weightobject.- new_data
A data frame with a
diametercolumn (and optionalsite/yearcolumns), orNULLto predict at the observed data.- ...
Unused.
- new_levels
A string, one of
"sample"or"average", controlling how random effects that are not conditioned on are treated (factors absent from the prediction, and any new level not seen in the fit)."sample"draws a new random effect fromNormal(0, sd), widening the interval to include between-group variation;"average"holds the random effects at zero, giving the typical group. Known levels are always conditioned on."sample"draws fresh randomness on each call, so set a seed withset.seed()for a reproducible interval.- representative_site
A character vector of site levels present in the fit, or
NULL(the default). When supplied, a new or absent site takes its site main effects (intercept and slope) from the named reference site (the per-draw average when several are named), instead of thenew_levelstreatment; thesite:yearinteraction still followsnew_levels.- conf_level
A number between 0 and 1 giving the compatibility-interval level.
- estimate
A function that reduces a numeric vector of posterior draws to a scalar point estimate (e.g.
medianormean).- sig_fig
A whole number of significant figures for summary output.
See also
Other generics:
augment.kb_fit(),
coef.kb_fit(),
converged.kb_fit(),
fitted.kb_fit_weight(),
glance.kb_fit(),
kb_stancode(),
log_lik.kb_fit(),
posterior_epred.kb_fit_weight(),
posterior_linpred.kb_fit_weight(),
posterior_predict.kb_fit_weight(),
prior_summary.kb_fit(),
residuals.kb_fit_weight(),
samples(),
summary.kb_fit(),
tidy.kb_fit_weight()
Examples
predict(fit_weight_sim_nereo, data.frame(diameter = c(20, 40)))
#> <kb_predictions> predictor: diameter | response: weight
#> # A tibble: 2 × 4
#> diameter estimate lower upper
#> <dbl> <dbl> <dbl> <dbl>
#> 1 20 0.0423 0.0201 0.0999
#> 2 40 0.225 0.118 0.445
