extrapolate_quantiles: Summarize a distribution with a set of quantiles

View source: R/extrapolate_quantiles.R

extrapolate_quantilesR Documentation

Summarize a distribution with a set of quantiles

Description

Summarize a distribution with a set of quantiles

Usage

extrapolate_quantiles(x, probs, replace_na = TRUE, ...)

Arguments

x

a distribution vector

probs

a vector of probabilities at which to calculate quantiles

replace_na

logical. If x contains NA's, these are imputed if possible (if TRUE) or retained (if FALSE). This only effects elements of class dist_quantiles.

...

additional arguments passed on to the quantile method

Value

a distribution vector containing dist_quantiles. Any elements of x which were originally dist_quantiles will now have a superset of the original quantile_values (the union of those and probs).

Examples

library(distributional)
dstn <- dist_normal(c(10, 2), c(5, 10))
extrapolate_quantiles(dstn, probs = c(.25, 0.5, .75))

dstn <- dist_quantiles(list(1:4, 8:11), list(c(.2, .4, .6, .8)))
# because this distribution is already quantiles, any extra quantiles are
# appended
extrapolate_quantiles(dstn, probs = c(.25, 0.5, .75))

dstn <- c(
  dist_normal(c(10, 2), c(5, 10)),
  dist_quantiles(list(1:4, 8:11), list(c(.2, .4, .6, .8)))
)
extrapolate_quantiles(dstn, probs = c(.25, 0.5, .75))

cmu-delphi/epipredict documentation built on March 5, 2025, 12:17 p.m.