Summarize a distribution with a set of quantiles
Source:R/extrapolate_quantiles.R
extrapolate_quantiles.Rd
Summarize a distribution with a set of quantiles
Arguments
- x
a
distribution
vector- probs
a vector of probabilities at which to calculate quantiles
- replace_na
logical. If
x
containsNA
's, these are imputed if possible (ifTRUE
) or retained (ifFALSE
). This only effects elements of classdist_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))
#> <distribution[2]>
#> [1] quantiles(10)[3] quantiles(2)[3]
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))
#> <distribution[2]>
#> [1] quantiles(2.5)[7] quantiles(9.5)[7]
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))
#> <distribution[4]>
#> [1] quantiles(10)[3] quantiles(2)[3] quantiles(2.5)[7] quantiles(9.5)[7]