
Create a posterior prediction from a rstanfit object
Source:R/utils-stan.R
posterior_predict_stanfit.RdThis function does simulates from the posterior of a created stan model, therefore providing a fast and efficient way to project coefficients obtained from Bayesian models to new/novel contexts.
Usage
posterior_predict_stanfit(
obj,
form,
newdata,
type = "predictor",
family = NULL,
offset = NULL,
draws = NULL
)Arguments
- obj
A
"stanfit"object (as used by rstan).- form
A
formulaobject created for the DistributionModel.- newdata
A data.frame with new data to be used for prediction.
- type
A
characterof whether the linearpredictoror theresponseis to be summarized.- family
A
charactergiving the family for simulating linear response values (Default:NULL)- offset
A vector with an optionally specified offset.
- draws
numeric indicating whether a specific number of draws should be taken.