Distributions in R

August 18, 2010
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

One of the R language's most powerful features is its ability to deal with random distributions: not just generating random numbers from various distributions (based on a very powerful pseudo-random number generator), but also calculating densities, probabilities, and quintiles. John Cook provides a handy reference chart listing all of the distributions supported by standard R (reproduced below -- and there are many other distributions supported by contributed packages), and also explains the elegant naming scheme for the various functions.

Distribution Base name    Parameters
beta beta shape1, shape2, ncp
binomial binom size, prob
Cauchy cauchy location, scale
chi-squared chisq df, ncp
exponential exp rate
F f df1, df2, ncp
gamma gamma shape, rate
geometric geom p
hypergeometric hyper m, n, k
log-normal lnorm meanlog, sdlog
logistic logis location, scale
negative binomial nbinom size, prob
normal norm mean, sd
Poisson pois lambda
Student t t df, ncp
uniform unif min, max
Weibull weibull shape, scale

Updated Aug 20: added the ncp parameter to beta, chisq, f, and t with thanks to Doug Bates' comment below.

John D Cook: Distributions in R and S-PLUS

To leave a comment for the author, please follow the link and comment on his blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.