R/model_functions.R
predict.comp_bayes_lm.Rd
Applies fitted model from comp_bayes_lm()
and
returns posterior predicted values.
# S3 method for comp_bayes_lm predict(object, newdata, ...)
object | Output of |
---|---|
newdata | A data frame of type |
... | Currently ignored—only included for consistency with generic. |
Closed-form solutions of Bayesian linear regression doi: 10.1371/journal.pone.0229930.s004
A vector of predictions with length equal to the input data.
Other modeling functions:
comp_bayes_lm()
,
create_bayes_lm_data()
,
run_cv()
library(dplyr) library(sf) library(ggplot2) # Load in posterior parameter example # and growth data to compare to data(comp_bayes_lm_ex, growth_ex) predictions <- focal_vs_comp_ex %>% mutate(growth_hat = predict(comp_bayes_lm_ex, focal_vs_comp_ex)) predictions %>% ggplot(aes(growth, growth_hat)) + geom_point() + geom_abline(slope = 1, intercept = 0)