﻿ g01eb Method
g01eb returns the lower tail, upper tail or two tail probability for the Student's $t$-distribution with real degrees of freedom.

# Syntax

C#
```public static double g01eb(
string tail,
double t,
double df,
out int ifail
)```
Visual Basic
```Public Shared Function g01eb ( _
tail As String, _
t As Double, _
df As Double, _
<OutAttribute> ByRef ifail As Integer _
) As Double```
Visual C++
```public:
static double g01eb(
String^ tail,
double t,
double df,
[OutAttribute] int% ifail
)```
F#
```static member g01eb :
tail : string *
t : float *
df : float *
ifail : int byref -> float
```

#### Parameters

tail
Type: System..::..String
On entry: indicates which tail the returned probability should represent.
${\mathbf{tail}}=\text{"U"}$
The upper tail probability is returned, i.e., $P\left(T\ge t:\nu \right)$.
${\mathbf{tail}}=\text{"S"}$
The two tail (significance level) probability is returned, i.e., $P\left(T\ge \left|t\right|:\nu \right)+P\left(T\le -\left|t\right|:\nu \right)$.
${\mathbf{tail}}=\text{"C"}$
The two tail (confidence interval) probability is returned, i.e., $P\left(T\le \left|t\right|:\nu \right)-P\left(T\le -\left|t\right|:\nu \right)$.
${\mathbf{tail}}=\text{"L"}$
The lower tail probability is returned, i.e., $P\left(T\le t:\nu \right)$.
Constraint: ${\mathbf{tail}}=\text{"U"}$, $\text{"S"}$, $\text{"C"}$ or $\text{"L"}$.
t
Type: System..::..Double
On entry: $t$, the value of the Student's $t$ variate.
df
Type: System..::..Double
On entry: $\nu$, the degrees of freedom of the Student's $t$-distribution.
Constraint: ${\mathbf{df}}\ge 1.0$.
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]).

#### Return Value

g01eb returns the lower tail, upper tail or two tail probability for the Student's $t$-distribution with real degrees of freedom.

# Description

The lower tail probability for the Student's $t$-distribution with $\nu$ degrees of freedom, $P\left(T\le t:\nu \right)$ is defined by:
 $PT≤t:ν=Γν+1/2πνΓν/2∫-∞t1+T2ν-ν+1/2dT, ν≥1.$
Computationally, there are two situations:
(i) when $\nu <20$, a transformation of the beta distribution, ${P}_{\beta }\left(B\le \beta :a,b\right)$ is used
 $PT≤t:ν=12PβB≤νν+t2:ν/2,12 when ​t<0.0$
or
 $PT≤t:ν=12+12PβB≥νν+t2:ν/2,12 when ​t>0.0;$
(ii) when $\nu \ge 20$, an asymptotic normalizing expansion of the Cornish–Fisher type is used to evaluate the probability, see Hill (1970).

# References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth
Hill G W (1970) Student's $t$-distribution Comm. ACM 13(10) 617–619

# Error Indicators and Warnings

Errors or warnings detected by the method:
If ${\mathbf{ifail}}\ne {0}$, then g01eb returns $0.0$.
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{tail}}\ne \text{"U"}$, $\text{"S"}$, $\text{"C"}$ or $\text{"L"}$.
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{df}}<1.0$.
${\mathbf{ifail}}=-9000$
An error occured, see message report.

# Accuracy

The computed probability should be accurate to five significant places for reasonable probabilities but there will be some loss of accuracy for very low probabilities (less than ${10}^{-10}$), see Hastings and Peacock (1975).

# Parallelism and Performance

None.

The probabilities could also be obtained by using the appropriate transformation to a beta distribution (see Abramowitz and Stegun (1972)) and using g01ee. This method allows you to set the required accuracy.

# Example

This example reads values from, and degrees of freedom for Student's $t$-distributions along with the required tail. The probabilities are calculated and printed until the end of data is reached.

Example program (C#): g01ebe.cs

Example program data: g01ebe.d

Example program results: g01ebe.r