# NAG FL Interfaceg01gbf (prob_​students_​t_​noncentral)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

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

## 2Specification

Fortran Interface
 Function g01gbf ( t, df, tol,
 Real (Kind=nag_wp) :: g01gbf Integer, Intent (In) :: maxit Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: t, df, delta, tol
#include <nag.h>
 double g01gbf_ (const double *t, const double *df, const double *delta, const double *tol, const Integer *maxit, Integer *ifail)
The routine may be called by the names g01gbf or nagf_stat_prob_students_t_noncentral.

## 3Description

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
 $P(T≤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.
1. (i)When $t=0.0$, the relationship to the normal is used:
 $P(T≤t:ν;δ)=12π∫δ∞e-u2/2du.$
2. (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.

## 4References

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

## 5Arguments

1: $\mathbf{t}$Real (Kind=nag_wp) Input
On entry: $t$, the deviate from the Student's $t$-distribution with $\nu$ degrees of freedom.
2: $\mathbf{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: $\mathbf{delta}$Real (Kind=nag_wp) Input
On entry: $\delta$, the noncentrality parameter of the Students $t$-distribution.
4: $\mathbf{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), the value of is used instead.
5: $\mathbf{maxit}$Integer Input
On entry: the maximum number of terms that are used in each of the summations.
Suggested value: $100$. See Section 9 for further comments.
Constraint: ${\mathbf{maxit}}\ge 1$.
6: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ 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).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-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}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{df}}\ge 1.0$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{maxit}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{maxit}}\ge 1$.
${\mathbf{ifail}}=3$
One of the series has failed to converge with ${\mathbf{maxit}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{tol}}=⟨\mathit{\text{value}}⟩$. Reconsider the requested tolerance and/or the maximum number of iterations.
${\mathbf{ifail}}=4$
The probability is too close to $0$ or $1$. The returned value should be a reasonable estimate of the true value.
Unable to calculate the probability as it is too close to zero or one.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

## 7Accuracy

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.

## 8Parallelism and Performance

g01gbf is not threaded in any implementation.

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.

## 10Example

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.

### 10.1Program Text

Program Text (g01gbfe.f90)

### 10.2Program Data

Program Data (g01gbfe.d)

### 10.3Program Results

Program Results (g01gbfe.r)