Every distribution that R handles has four functions. There is a root name, for example, the root name for the normal distribution is norm. This root is prefixed by one of the letters
p for “probability”, the cumulative
distribution function (c. d. f.)q for “quantile”, the inverse
c. d. f.d for “density”, the density function
(p. f. or p. d. f.)r for “random”, a random variable
having the specified distributionFor the normal distribution, these functions are pnorm,
qnorm, dnorm, and rnorm. For the
binomial distribution, these functions are pbinom,
qbinom, dbinom, and rbinom. And
so forth.
R has functions to handle many probability distributions. The table below gives the names of the functions for each distribution and a link to the on-line documentation that is the authoritative reference for how the functions are used. But don’t read the on-line documentation yet. First, try the examples in the sections following the table.
| Distribution | Functions | |||
|---|---|---|---|---|
| Beta |
pbeta
|
qbeta
|
dbeta
|
rbeta
|
| Binomial |
pbinom
|
qbinom
|
dbinom
|
rbinom
|
| Cauchy |
pcauchy
|
qcauchy
|
dcauchy
|
rcauchy
|
| Chi-Square |
pchisq
|
qchisq
|
dchisq
|
rchisq
|
| Exponential |
pexp
|
qexp
|
dexp
|
rexp
|
| F |
pf
|
qf
|
df
|
rf
|
| Gamma |
pgamma
|
qgamma
|
dgamma
|
rgamma
|
| Geometric |
pgeom
|
qgeom
|
dgeom
|
rgeom
|
| Hypergeometric |
phyper
|
qhyper
|
dhyper
|
rhyper
|
| Logistic |
plogis
|
qlogis
|
dlogis
|
rlogis
|
| Log Normal |
plnorm
|
qlnorm
|
dlnorm
|
rlnorm
|
| Negative Binomial |
pnbinom
|
qnbinom
|
dnbinom
|
rnbinom
|
| Normal |
pnorm
|
qnorm
|
dnorm
|
rnorm
|
| Poisson |
ppois
|
qpois
|
dpois
|
rpois
|
| Student t |
pt
|
qt
|
dt
|
rt
|
| Studentized Range |
ptukey
|
qtukey
|
dtukey
|
rtukey
|
| Uniform |
punif
|
qunif
|
dunif
|
runif
|
| Weibull |
pweibull
|
qweibull
|
dweibull
|
rweibull
|
| Wilcoxon Rank Sum Statistic |
pwilcox
|
qwilcox
|
dwilcox
|
rwilcox
|
| Wilcoxon Signed Rank Statistic |
psignrank
|
qsignrank
|
dsignrank
|
rsignrank
|
The normal distribution is the most commonly used distribution in statistics. This tutorial explains how to work with the normal distribution in R using the functions dnorm, pnorm, rnorm, and qnorm.