﻿ g01ee Method
g01ee computes the upper and lower tail probabilities and the probability density function of the beta distribution with parameters $a$ and $b$.

# Syntax

C#
```public static void g01ee(
double x,
double a,
double b,
double tol,
out double p,
out double q,
out double pdf,
out int ifail
)```
Visual Basic
```Public Shared Sub g01ee ( _
x As Double, _
a As Double, _
b As Double, _
tol As Double, _
<OutAttribute> ByRef p As Double, _
<OutAttribute> ByRef q As Double, _
<OutAttribute> ByRef pdf As Double, _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void g01ee(
double x,
double a,
double b,
double tol,
[OutAttribute] double% p,
[OutAttribute] double% q,
[OutAttribute] double% pdf,
[OutAttribute] int% ifail
)```
F#
```static member g01ee :
x : float *
a : float *
b : float *
tol : float *
p : float byref *
q : float byref *
pdf : float byref *
ifail : int byref -> unit
```

#### Parameters

x
Type: System..::..Double
On entry: $\beta$, the value of the beta variate.
Constraint: $0.0\le {\mathbf{x}}\le 1.0$.
a
Type: System..::..Double
On entry: $a$, the first parameter of the required beta distribution.
Constraint: $0.0<{\mathbf{a}}\le {10}^{6}$.
b
Type: System..::..Double
On entry: $b$, the second parameter of the required beta distribution.
Constraint: $0.0<{\mathbf{b}}\le {10}^{6}$.
tol
Type: System..::..Double
On entry: this parameter is no longer referenced, but is included for backwards compatability.
p
Type: System..::..Double%
On exit: the lower tail probability, $P\left(B\le \beta :a,b\right)$.
q
Type: System..::..Double%
On exit: the upper tail probability, $P\left(B\ge \beta :a,b\right)$.
pdf
Type: System..::..Double%
On exit: the probability density function, $f\left(B:a,b\right)$.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

The probability density function of the beta distribution with parameters $a$ and $b$ is:
 $fB:a,b=Γa+bΓaΓbBa-11-Bb-1, 0≤B≤1;a,b>0.$
The lower tail probability, $P\left(B\le \beta :a,b\right)$ is defined by
 $PB≤β:a,b=Γa+bΓaΓb∫0βBa-11-Bb-1dB=Iβa,b, 0≤β≤1;a,b>0.$
The function ${I}_{x}\left(a,b\right)$, also known as the incomplete beta function is calculated using (S14CCF not in this release).

# References

Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth

# Error Indicators and Warnings

Note: g01ee may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{x}}<0.0$, or ${\mathbf{x}}>1.0$.
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{a}}\le 0.0$, or ${\mathbf{a}}>{10}^{6}$, or ${\mathbf{b}}\le 0.0$, or ${\mathbf{b}}>{10}^{6}$.
${\mathbf{ifail}}=4$
x is too far out into the tails for the probability to be evaluated exactly. The results returned are $0$ and $1$ as appropriate. These should be a good approximation to the required solution.
${\mathbf{ifail}}=-9000$
An error occured, see message report.

# Accuracy

The accuracy is limited by the error in the incomplete beta function. See [Accuracy] in s14cc for further details.

None.

None.

# Example

This example reads values from a number of beta distributions and computes the associated upper and lower tail probabilities and the corresponding value of the probability density function.

Example program (C#): g01eee.cs

Example program data: g01eee.d

Example program results: g01eee.r