G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentG01GBF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

G01GBF returns the lower tail probability for the noncentral Student's $t$-distribution, via the routine name.

## 2  Specification

 FUNCTION G01GBF ( T, DF, DELTA, TOL, MAXIT, IFAIL)
 REAL (KIND=nag_wp) G01GBF
 INTEGER MAXIT, IFAIL REAL (KIND=nag_wp) T, DF, DELTA, TOL

## 3  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/2dx uν-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.

## 4  References

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

## 5  Parameters

1:     T – REAL (KIND=nag_wp)Input
On entry: $t$, the deviate from the Student's $t$-distribution with $\nu$ degrees of freedom.
2:     DF – REAL (KIND=nag_wp)Input
On entry: $\nu$, the degrees of freedom of the Student's $t$-distribution.
Constraint: ${\mathbf{DF}}\ge 1.0$.
3:     DELTA – REAL (KIND=nag_wp)Input
On entry: $\delta$, the noncentrality parameter of the Students $t$-distribution.
4:     TOL – REAL (KIND=nag_wp)Input
On entry: the absolute accuracy required by you in the results. If G01GBF is entered with TOL greater than or equal to $1.0$ or less than  (see X02AJF), then the value of  is used instead.
5:     MAXIT – INTEGERInput
On entry: the maximum number of terms that are used in each of the summations.
Suggested value: $100$. See Section 8 for further comments.
Constraint: ${\mathbf{MAXIT}}\ge 1$.
6:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
If on exit ${\mathbf{IFAIL}}\ne {\mathbf{0}}$, then G01GBF 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.

## 7  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.

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 G01GDF.
Note that G01GBF only allows degrees of freedom greater than or equal to $1$ although values between $0$ and $1$ are theoretically possible.

## 9  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.

### 9.1  Program Text

Program Text (g01gbfe.f90)

### 9.2  Program Data

Program Data (g01gbfe.d)

### 9.3  Program Results

Program Results (g01gbfe.r)