# Beta Distribution

 Probability Home Beta Distribution

The distribution function of a random variable X distributed according to the beta distribution with shape parameters a > 0 and b > 0 is a continuous function, F(x) = P(X < x), given by
F(x) =
 0 for x < 0 [ 1 / B(a,b) ] ∫0xt a-1(1 - t) b-1 dt for 0 ≤ x ≤ 1 1 for x > 1
where B(a,b) is the beta function, B(a,b) = Γ(a) Γ(b) / Γ(a+b).

The corresponding probability density function, f(x) = dF(x)/dx, is
f(x) =
 0 for x < 0 [ 1 / B(a,b) ] x a-1(1 - x) b-1 for 0 ≤ x ≤ 1 0 for x > 1
where B(a,b) is the beta function.

#### Function List

• double Beta_Distribution( double x, double a, double b )

This function returns F(x) where F(x) is described above.

• double Beta_Density( double x, double a, double b )

This function returns f(x) where f(x) is described above.

• void Beta_Distribution_Tables( double a, double b, double start, double delta, int nsteps, double *density, double* distribution_function )

This function returns f(x) where f(x) is described above in the array density, i.e. density[i] = f(xi) where xi = start + i delta, i = 0,...,nsteps and returns F(x) where F(x) is described above in the array distribution_function, i.e. distribution_function[i] = F(xi) where xi = start + i delta, i = 0,...,nsteps. Note that density must be declared double density[N] where N ≥ nsteps + 1 in the calling routine and similarly the distribution_function must be declared double distribution_function[N] where
N ≥ nsteps + 1 in the calling routine.

#### Source Code

C source code is available for these routines: