Beta {stats}

The Beta Distribution
Package:
stats
Version:
R 3.0.2

Description

Density, distribution function, quantile function and random generation for the Beta distribution with parameters `shape1` and `shape2` (and optional non-centrality parameter `ncp`).

Usage

```dbeta(x, shape1, shape2, ncp = 0, log = FALSE)
pbeta(q, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE)
qbeta(p, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE)
rbeta(n, shape1, shape2, ncp = 0)
```

Arguments

x, q
vector of quantiles.
p
vector of probabilities.
n
number of observations. If `length(n) > 1`, the length is taken to be the number required.
shape1, shape2
positive parameters of the Beta distribution.
ncp
non-centrality parameter.
log, log.p
logical; if TRUE, probabilities p are given as log(p).
lower.tail
logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].

Details

The Beta distribution with parameters `shape1` = a and `shape2` = b has density Γ(a+b)/(Γ(a)Γ(b))x^(a-1)(1-x)^(b-1) for a > 0, b > 0 and 0 ≤ x ≤ 1 where the boundary values at x=0 or x=1 are defined as by continuity (as limits).
The mean is a/(a+b) and the variance is ab/((a+b)^2 (a+b+1)).

`pbeta` is closely related to the incomplete beta function. As defined by Abramowitz and Stegun 6.6.1 and 6.6.2 I_x(a,b) = B_x(a,b) / B(a,b) where B(a,b) = B_1(a,b) is the Beta function (`beta`).

I_x(a,b) is `pbeta(x, a, b)`.

The noncentral Beta distribution (with `ncp` = λ) is defined (Johnson et al, 1995, pp. 502) as the distribution of X/(X+Y) where X ~ chi^2_2a(λ) and Y ~ chi^2_2b.

Values

`dbeta` gives the density, `pbeta` the distribution function, `qbeta` the quantile function, and `rbeta` generates random deviates.

Invalid arguments will result in return value `NaN`, with a warning. The length of the result is determined by `n` for `rbeta`, and is the maximum of the lengths of the numerical parameters for the other functions. The numerical parameters other than `n` are recycled to the length of the result. Only the first elements of the logical parameters are used.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical Functions. New York: Dover. Chapter 6: Gamma and Related Functions.

Johnson, N. L., Kotz, S. and Balakrishnan, N. (1995) Continuous Univariate Distributions, volume 2, especially chapter 25. Wiley, New York.

Note

Supplying `ncp = 0` uses the algorithm for the non-central distribution, which is not the same algorithm used if `ncp` is omitted. This is to give consistent behaviour in extreme cases with values of `ncp` very near zero.

`beta` for the Beta function.
```x <- seq(0, 1, length = 21)