"p" functions



Description:
The "p" functions return the cumulative distribution of a probability distribution. The quantiles, given by the "q" functions, are inverse to the cumulative distribution function.


Usage:
  pnorm(x, mu=0, sd=1)
  p + familyname (x, ...)

For the normal distribution, the function is pnorm(). Two parameters, mu= and sd= need to be specified. They default to 0 and 1, the standard normal distribution.
In general, the functions are named with a p and the family name such as t for the t-distribution. Common ones are:
Distribution        familyname     parameter names
normal        norm     mu=, sd=
t        t     df= (degrees of freedom)
exponential        exp     rate= (rate is 1/mean)
uniform        unif     a=, b=
chi square        chisq     df=
F        f     df1=, df2=
Table 1: Table of distributions and their arguments


See Also:
The qFunctions for quantiles of a distribution, the dFunctions for the p.d.f. of a distribution, and the rFunctions for randomly chosen numbers.


Example:
Find the shaded area under the standard normal density:
pFunctions-003.png
This is answered with
> pnorm(1.2)

[1] 0.885

Find the shaded area under the exponential density with rate 1.
pFunctions-005.png
This is given as a difference.
> pexp(1.5, rate = 1) - pexp(0.5, rate = 1)

[1] 0.3834

> diff(pexp(c(0.5, 1.5), rate = 1))

[1] 0.3834

Show that the cumulative distribution function and quantile function are inverse to each other.
> pnorm(qnorm(0.3))

[1] 0.3

> pt(qt(0.3, df = 10), df = 10)

[1] 0.3

Plot the cumulative distribution function (c.d.f.) for the standard normal, and add the empirical c.d.f. for a random sample of size 10. (The e.c.d.f. is returned by ecdf().)
> x = seq(-3, 3, length = 100)
> plot(x, pnorm(x), type = "l")
> lines(ecdf(rnorm(10)))

pFunctions-008.png


From the simplified R manual of the Stem and Tendril project




File translated from TEX by TTH, version 3.44.
On 9 Jun 2004, 14:34.