Distributions in R
[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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 their blog: Revolutions.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.