augment_posterior: Create a long data-frame of posterior predictions

Description Usage Arguments Value

Description

These functions are wrapper around RStanARM's prediction functions that return a long tidy dataframe of model predictions. augment_posterior_predict() wraps rstanarm::posterior_predict() and augment_posterior_linpred() wraps rstanarm::posterior_predict().

Usage

1
2
3
augment_posterior_predict(model, newdata = NULL, ..., nsamples = NULL)

augment_posterior_linpred(model, newdata = NULL, ..., nsamples = NULL)

Arguments

model

a model fit with RStanARM

newdata

a dataframe of new observations to generate predictions. If omitted or null, the original data-set used to fit the model is used for the predictions.

...

other arguments passed to rstanarm::posterior_predict() or rstanarm::posterior_linpred().

nsamples

number of samples to draw from the posterior. Defaults to the full number of samples.

Value

a data-frame (a tibble::tibble()) of posterior predictions. The dataset used to generate the predictions is augmented with posterior predictions, so that there is row per posterior prediction per observation. Additionaly columns are included: .observation uniquely identifies rows from the prediction data-set, .draw is the posterior sample number, and .posterior_value is the predicted value for that .observation in that .draw.


tjmahr/tristan documentation built on May 8, 2019, 9:46 a.m.