Summarize a distribution with a set of quantiles
Source:R/extrapolate_quantiles.R
extrapolate_quantiles.Rd
This function takes a quantile_pred
vector and returns the same
type of object, expanded to include
additional quantiles computed at probs
. If you want behaviour more
similar to stats::quantile()
, then quantile(x,...)
may be more
appropriate.
Value
a quantile_pred
vector. Each element
of x
will now have a superset
of the original quantile_values
(the union of those and probs
).
Examples
dstn <- quantile_pred(rbind(1:4, 8:11), c(.2, .4, .6, .8))
# extra quantiles are appended
as_tibble(extrapolate_quantiles(dstn, probs = c(.25, 0.5, .75)))
#> # A tibble: 14 × 3
#> .pred_quantile .quantile_levels .row
#> <dbl> <dbl> <int>
#> 1 1 0.2 1
#> 2 1.25 0.25 1
#> 3 2 0.4 1
#> 4 2.5 0.5 1
#> 5 3 0.6 1
#> 6 3.75 0.75 1
#> 7 4 0.8 1
#> 8 8 0.2 2
#> 9 8.25 0.25 2
#> 10 9 0.4 2
#> 11 9.5 0.5 2
#> 12 10 0.6 2
#> 13 10.8 0.75 2
#> 14 11 0.8 2