distplyr provides a vocabulary of verbs for manipulating distributions.
condition()(under development): Restrict the possible values that a random variable can take.
shift()(under development): Add a constant to a random variable.
scale()(under development): Multiply a constant to a random variable.
graft_right(): Replace the upper or lower tail of a distribution with another distribution.
mix(): Make a mixture distribution from two or more distributions.
Each of these take a distribution as its first argument(s), and return a distribution, making them pipeable.
Consider an empirical distribution of Ozone measurements from the
We can graft a GPD to either end:
o3_with_tails <- o3_raw %>% graft_right(dst_gpd(100, 30, 1), sep_y = 100) plot(o3_raw, "survival", n = 1001, to = 160) plot(o3_with_tails, "survival", n = 1001, lty = 2, add = TRUE)