Generate data from the posterior predictive distribution. This is useful for assessing the fit of a model. Alternatively this can be used for assessing counterfactuals or for prediction using the newdata argument.

# S3 method for epimodel
posterior_predict(
  object,
  newdata = NULL,
  draws = NULL,
  types = NULL,
  seed = NULL,
  posterior_mean = FALSE,
  ...
)

Arguments

object

A fitted model object returned by epim. See epimodel-objects.

newdata

If provided, the original data used in object is overridden. Useful both for counterfactual and prediction analysis

draws

Number of posterior draws to use. Defaults to the number of parameter draws in the fitted model.

types

A character vector specifying the names of the outcome variables to consider. If unspecified, uses all.

seed

An optional seed.

posterior_mean

If TRUE, return samples of posterior means rather than from the posterior predictive.

...

Not used.

Value

A named list of draws from the posterior predictive. Each element corresponds to a specific outcome.