Skip to contents

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 linear predictor or the response 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.