distributions3, inspired by the eponynmous Julia
package, provides a
generic function interface to probability distributions.
has two goals:
pnorm(), etc, family of functions with S3
methods for distribution objects
Be extremely well documented and friendly for students in intro stat classes.
The main generics are:
random(): Draw samples from a distribution.
pdf(): Evaluate the probability density (or mass) at a point.
cdf(): Evaluate the cumulative probability up to a point.
quantile(): Determine the quantile for a given probability. Inverse of
distributions is not yet on CRAN. You can install the development
The basic usage of
distributions3 looks like:
library(distributions3) X <- Bernoulli(0.1) random(X, 10) #>  0 0 0 0 0 0 0 0 0 1 pdf(X, 1) #>  0.1 cdf(X, 0) #>  0.9 quantile(X, 0.5) #>  0
quantile() always returns lower tail probabilities. If
you aren’t sure what this means, please read the last several paragraphs
vignette("one-sample-z-confidence-interval") and have a gander at
I am very happy to review PRs and provide advice on how to add new functionality to the package. Documentation improvements are particularly appreciated!
To add a new distribution, the best way to get started is to look at
tests/testthat/test-Beta.R, copy them, and modify them
for whatever new distribution you’d like to add.
Please note that
distributions3 is released with a Contributor Code
By contributing to this project, you agree to abide by its terms.
For a comprehensive overview of the many packages providing various distribution related functionality see the CRAN Task View.
distris quite similar to
distributions, but uses S4 objects and is less focused on documentation.
distr, but uses R6 objects
fitdistrplusprovides extensive functionality for fitting various distributions but does not treat distributions themselves as objects
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.