The purpose of
distplyr is to equip every analyst with a tool to seemlessly draw powerful insights using distributions. Distributions add colour to your analysis. They show the complete picture of uncertainty.
Many distributions in practice are built in “layers”, by transforming and combining other distributions. The result is a tailored distribution that does not follow a basic parametric form such as “Normal” or “Exponential”. The motivation behind the name of
distplyr is that distributions are built by manipulation, akin to the package
Note: This package is still in its infancy. There are many other critical features to come.
There are many parametric families of distributions at your disposal. Here is a Uniform distribution:
(d1 <- dst_unif(2, 5)) #> Uniform Distribution #> #> Parameters: #> parameter value #> 1 min 2 #> 2 max 5 #> #> Number of Discontinuities: 0
Evaluate functional representations, such as the cdf and hazard function:
Make a mixture distribution by combining some distributions:
(d2 <- mix(dst_norm(-5, 1), dst_norm(0, 1), weights = c(1, 4))) #> Mixture Distribution #> #> Components: #> distribution weight #> 1 Gaussian 0.2 #> 2 Gaussian 0.8 #> #> Number of Discontinuities: 0 plot(d2, n = 1001) #> Warning in get_lower(cdf, level = at[1L]): This function doesn't work properly #> yet! #> Warning in get_higher(cdf, level = at[n_x]): This function doesn't work properly #> yet! #> Warning in get_lower(cdf, level = at[1L]): This function doesn't work properly #> yet! #> Warning in get_higher(cdf, level = at[n_x]): This function doesn't work properly #> yet!
Make a graft distribution by replacing a distribution’s tail:
d3 <- stepdst(mpg, data = mtcars) d4 <- graft_right(d3, dst_gpd(25, 5, 1), sep_y = 25) plot(d4, "cdf", n = 1001, to = 34) plot(d3, "cdf", n = 1001, lty = 2, add = TRUE)
distplyr is not on CRAN yet, so the best way to install it is:
distplyr is not a modelling package, meaning it won’t optimize a distribution’s fit to data.
distributions3 package is a similar package in that it bundles parametric distributions together using S3 objects, but does not handle step distributions.
distr package allows you to make distributions including empirical ones, and transform them, using S4 classes.
Please note that the ‘distplyr’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.