# The Standard Beta Distribution.

### Description

Density, distribution, quantile, random number generation, and parameter estimation functions for the beta distribution with parameters shape1 and shape2. Parameter estimation can be based on a weighted or unweighted i.i.d. sample and can be carried out analytically or numerically.

### Usage

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 dBeta(x, shape1 = 2, shape2 = 3, params = list(shape1, shape2), ...) pBeta(q, shape1 = 2, shape2 = 3, params = list(shape1, shape2), ...) qBeta(p, shape1 = 2, shape2 = 3, params = list(shape1, shape2), ...) rBeta(n, shape1 = 2, shape2 = 3, params = list(shape1, shape2), ...) eBeta(X, w, method = c("MOM", "numerical.MLE"), ...) lBeta(X, w, shape1 = 2, shape2 = 3, params = list(shape1, shape2), logL = TRUE, ...) sBeta(X, w, shape1 = 2, shape2 = 3, params = list(shape1, shape2), ...) iBeta(X, w, shape1 = 2, shape2 = 3, params = list(shape1, shape2), ...) 

### Arguments

 x,q Vector of quantiles. shape1,shape2 Shape parameters. params A list that includes all named parameters. ... Additional parameters. p Vector of probabilities. n Number of observations. X Sample observations. w Optional vector of sample weights. method Parameter estimation method. logL logical, if TRUE lBeta gives the log-likelihood, otherwise the likelihood is given.

### Details

The dBeta(), pBeta(), qBeta(),and rBeta() functions serve as wrappers of the standard dbeta, pbeta, qbeta, and rbeta functions in the stats package. They allow for the shape parameters to be declared not only as individual numerical values, but also as a list so parameter estimation can be carried out.

The beta distribution with parameters shape1=α and shape2=β is given by

f(x) = \frac{x^{α-1} (1-x)^{β-1}}{B(α,β)}

where 0 ≤ x ≤ 1, α>0, β>0, and B is the beta function.

Analytical parameter estimation is conducted using the method of moments. The parameter estimates for α and β are as given in the Engineering Statistics Handbook.

The log-likelihood function of the beta distribution is given by

l(α, β | x) = (α-1)∑_{i} ln(x_i) + (β-1)∑_{i} ln(1-x_i) - ln B(α,β).

Aryal & Nadarajah (2004) derived the score function and Fisher's information matrix for the 4-parameter beta function, from which the 2-parameter cases can be obtained.

### Value

dBeta gives the density, pBeta the distribution function, qBeta the quantile function, rBeta generates random deviates, and eBeta estimates the parameters. lBeta provides the log-likelihood function, sBeta the observed score function, and iBeta the observed information matrix.

### Author(s)

Haizhen Wu and A. Jonathan R. Godfrey.
Updates and bug fixes by Sarah Pirikahu.

### References

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

Engineering Statistics Handbook

Bury, K. (1999) Statistical Distributions in Engineering, Chapter 14, pp.253-255, Cambridge University Press.

Aryal, G. and Nadarajah, S. (2004) Information Matrix for Beta Distributions, Serdica Math. J. 30, 513-526.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 # Parameter estimation for a distribution with known shape parameters x <- rBeta(n=500, params=list(shape1=2, shape2=2)) est.par <- eBeta(x); est.par plot(est.par) # Fitted density curve and histogram dens <- dBeta(x=seq(0,1,length=100), params=list(shape1=2, shape2=2)) hist(x, breaks=10, probability=TRUE, ylim = c(0,1.2*max(dens))) lines(seq(0,1,length=100), dens, col="blue") lines(density(x), lty=2) # Extracting shape parameters est.par[attributes(est.par)$par.type=="shape"] # Parameter estimation for a distribution with unknown shape parameters # Example from; Bury(1999) pp.253-255, parameter estimates as given by Bury are # shape1 = 4.222 and shape2 = 6.317 data <- c(0.461, 0.432, 0.237, 0.113, 0.526, 0.278, 0.275, 0.309, 0.67, 0.428, 0.556, 0.402, 0.472, 0.226, 0.632, 0.533, 0.309, 0.417, 0.495, 0.241) est.par <- eBeta(X=data, method="numerical.MLE"); est.par plot(est.par) # Log-likelihood, score function, and observed information matrix lBeta(data, param=est.par) sBeta(data, param=est.par) iBeta(data, param=est.par) # Evaluating the precision of parameter estimation by the Hessian matrix. H <- attributes(est.par)$nll.hessian;H var <- solve(H) se <- sqrt(diag(var)); se