``distr'' is a package for R from version 1.8.1 onwards that is distributed under GPL license 2.0. Its own current version is 1.4. It requires package setRNG by Paul Gilbert, pgilbert@bank-banque-canada.ca, to be installed from


The aim of this package is to provide a conceptual treatment of random variables (r.v.'s) by means of S4 classes. A mother class Distribution is introduced with slots for a parameter and ---most important--- for the four constitutive methods r, d, p, and q for simulation respectively for evaluation of density / c.d.f. and quantile function of the corresponding distribution. All distributions of the base package for which corresponding r-, d-, p-, and q-functions exist (like normal, Poisson, etc.) are implemented as subclasses of either AbscontDistribution or DiscreteDistribution, which themselves are again subclasses of Distribution. This approach seems very appealing to us from a conceptual viewpoint:

Just pass an object of some derived distribution class to a generic function as argument and let the dispatching mechanism decide what to do on run-time.

As an example, we may automatically generate new objects of these classes with corresponding r, d, p, and q-slots for the laws of r.v.'s under standard mathematical univariate transformations and under convolution of independent r.v.'s. For Distribution objects X and Y expressions like 3*X+sin(exp(-Y/4+3)) have their natural interpretation as corresponding image distributions.

Additionally, we also provide classes for a standardized treatment of simulations (also under contaminations) and evaluations of statistical procedures on such simulations. A somewhat longer and more detailed manual can be obtained under



S4 Classes for Distributions




Documentation reproduced from package distr, version 1.4, License: GPL (version 2 or later)

Community examples

Looks like there are no examples yet.