Skip to contents

Append a tibble of predictions returned by predict_boots() with upper and lower bounds.

Usage

summarise_predictions(.data, interval_width = 0.95, conf = NULL)

summarize_predictions(.data, interval_width = 0.95, conf = NULL)

Arguments

.data

a tibble of predictions returned by predict_boots().

interval_width

a value between (0, 1) specifying the interval range.

conf

deprecated - please use interval_width instead.

Value

Appends the tibble of predictions returned by predict_boots() with three new columns: .pred_lower, .pred, and .pred_upper.

Details

Generates a summary of predictions with a upper and lower interval range. Presently, the quantile() function from the {stats} package is used to determine the lower, 50th percentile, and upper interval ranges.

Examples

if (FALSE) {
library(tidymodels)

# setup a workflow without fitting
wf <-
  workflow() %>%
  add_recipe(recipe(qsec ~ wt, data = mtcars)) %>%
  add_model(linear_reg())

# fit and predict 2000 bootstrap resampled models to mtcars
set.seed(123)
preds <-
  wf %>%
  predict_boots(n = 2000, training_data = mtcars, new_data = mtcars)

# append with prediction interval summary columns
preds %>%
  summarise_predictions(conf = 0.95)
}