R Programming/Probability Distributions

This page review the main probability distributions and describe the main R functions to deal with them.

R has lots of probability functions.
 * is the generic prefix for random variable generator such as,.
 * is the generic prefix for the probability density function such as,.
 * is the generic prefix for the cumulative density function such as,.
 * is the generic prefix for the quantile function such as,.

Benford Distribution
The is the distribution of the first digit of a number. It is due to Benford 1938 and Newcomb 1881.

Bernoulli
We can draw from a using sample, runif or rbinom with size = 1.

Binomial
We can sample from a using the   function with arguments   for number of samples to take,   defining the number of trials and   defining the probability of success in each trial.

Hypergeometric distribution
We can sample  times from a  using the   function.

Geometric distribution
The.

Multinomial
The.

Negative binomial distribution
The is the distribution of the number of failures before k successes in a series of Bernoulli events.

Poisson distribution
We can draw  values from a  with a mean set by the argument.

Zipf's law
The distribution of the frequency of words is known as. It is also a good description of the distribution of city size. dzipf and pzipf (VGAM)

Beta and Dirichlet distributions

 * in gtools and MCMCpack
 * in gtools and MCMCpack

Cauchy
We can sample  values from a  with a given   parameter $$x_0$$ (default is 0) and   parameter $$\gamma$$ (default is 1) using the   function.

Chi Square distribution
Quantile of the ($$\chi^2$$ distribution)

Exponential
We can sample  values from a  with a given   (default is 1) using the   function

Fisher-Snedecor
We can draw the density of a (F-distribution) :

Gamma
We can sample  values from a  with a given   parameter and   parameter $$\theta$$ using the   function. Alternatively a  parameter and   parameter $$\beta=1/\theta$$ can be given.

Levy
We can sample  values from a  with a given location parameter $$\mu$$ (defined by the argument , default is 0) and scaling parameter (given by the argument  , default is 1) using the   function.

Log-normal distribution
We can sample  values from a  with a given   (default is 0) and   (default is 1) using the   function

Normal and related distributions
We can sample  values from a  or gaussian Distribution with a given   (default is 0) and   (default is 1) using the   function

Quantile of the normal distribution


 * The mvtnorm package includes functions for multivariate normal distributions.
 * rmvnorm generates a multivariate normal distribution.

Pareto Distributions

 * dgpd in evd
 * in actuar
 * The VGAM package also has functions for the Pareto distribution.

Student's t distribution
Quantile of the

The following lines plot the .975th quantile of the t distribution in function of the degrees of freedom :

Uniform distribution
We can sample  values from a  (also known as a rectangular distribution] between two values (defaults are 0 and 1) using the   function

Weibull
We can sample  values from a  with a given   and   parameter $$\mu$$ (default is 1) using the   function.

Extreme values and related distribution

 * The
 * The : distribution of the difference of two gumbel distributions.
 * Frechet  evd
 * Generalized Extreme Value  evd
 * Gumbel  evd
 * in actuar

Distribution in circular statistics

 * Functions for circular statistics are included in the CircStats package.
 * (also known as the nircular normal or Tikhonov distribution) density function
 * function
 * Mixed Von Mises density
 * wrapped Cauchy density
 * wrapped normal density.