Create a posterior prediction from a rstanfit object
Source:R/utils-stan.R
posterior_predict_stanfit.Rd
This 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
formula
object created for the DistributionModel.- newdata
A data.frame with new data to be used for prediction.
- type
A
character
of whether the linearpredictor
or theresponse
is to be summarized.- family
A
character
giving 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.