﻿ g01gb Method
g01gb returns the lower tail probability for the noncentral Student's $t$-distribution.

Syntax

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

Parameters

t
Type: System..::..Double
On entry: $t$, the deviate from the Student's $t$-distribution with $\nu$ degrees of freedom.
df
Type: System..::..Double
On entry: $\nu$, the degrees of freedom of the Student's $t$-distribution.
Constraint: ${\mathbf{df}}\ge 1.0$.
delta
Type: System..::..Double
On entry: $\delta$, the noncentrality parameter of the Students $t$-distribution.
tol
Type: System..::..Double
On entry: the absolute accuracy required by you in the results. If g01gb is entered with tol greater than or equal to $1.0$ or less than  (see x02aj), then the value of  is used instead.
maxit
Type: System..::..Int32
On entry: the maximum number of terms that are used in each of the summations.
Suggested value: $100$. See [Further Comments] for further comments.
Constraint: ${\mathbf{maxit}}\ge 1$.
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

g01gb returns the lower tail probability for the noncentral Student's $t$-distribution.

Description

The lower tail probability of the noncentral Student's $t$-distribution with $\nu$ degrees of freedom and noncentrality parameter $\delta$, $P\left(T\le t:\nu \text{;}\delta \right)$, is defined by
 $PT≤t:ν;δ=Cν∫0∞12π∫-∞αu-δe-x2/2dxuν-1e-u2/2du, ν>0.0$
with
 $Cν=1Γ12ν2ν-2/2, α=tν.$
The probability is computed in one of two ways.
(i) When $t=0.0$, the relationship to the normal is used:
 $PT≤t:ν;δ=12π∫δ∞e-u2/2du.$
(ii) Otherwise the series expansion described in Equation 9 of Amos (1964) is used. This involves the sums of confluent hypergeometric functions, the terms of which are computed using recurrence relationships.

References

Amos D E (1964) Representations of the central and non-central $t$-distributions Biometrika 51 451–458

Error Indicators and Warnings

Errors or warnings detected by the method:
If on exit ${\mathbf{ifail}}\ne {0}$, then g01gb returns $0.0$.
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{df}}<1.0$.
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{maxit}}<1$.
${\mathbf{ifail}}=3$
One of the series has failed to converge. Reconsider the requested tolerance and/or maximum number of iterations.
${\mathbf{ifail}}=4$
The probability is too small to calculate accurately.
${\mathbf{ifail}}=-9000$
An error occured, see message report.

Accuracy

The series described in Amos (1964) are summed until an estimated upper bound on the contribution of future terms to the probability is less than tol. There may also be some loss of accuracy due to calculation of gamma functions.

Parallelism and Performance

None.

The rate of convergence of the series depends, in part, on the quantity ${t}^{2}/\left({t}^{2}+\nu \right)$. The smaller this quantity the faster the convergence. Thus for large $t$ and small $\nu$ the convergence may be slow. If $\nu$ is an integer then one of the series to be summed is of finite length.
If two tail probabilities are required then the relationship of the $t$-distribution to the $F$-distribution can be used:
 $F=T2,λ=δ2,ν1=1 and ν2=ν,$
and a call made to g01gd.
Note that g01gb only allows degrees of freedom greater than or equal to $1$ although values between $0$ and $1$ are theoretically possible.

Example

This example reads values from, and degrees of freedom for, and noncentrality parameters of the noncentral Student's $t$-distributions, calculates the lower tail probabilities and prints all these values until the end of data is reached.

Example program (C#): g01gbe.cs

Example program data: g01gbe.d

Example program results: g01gbe.r