# NAG CPP Interfacenagcpp::stat::prob_students_t_noncentral (g01gb)

Settings help

CPP Name Style:

## 1Purpose

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

## 2Specification

```#include "g01/nagcpp_g01gb.hpp"
```
`double prob_students_t_noncentral(const double t, const double df, const double delta, OptionalG01GB opt)`
`double prob_students_t_noncentral(const double t, const double df, const double delta)`

## 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}$double Input
On entry: $t$, the deviate from the Student's $t$-distribution with $\nu$ degrees of freedom.
2: $\mathbf{df}$double Input
On entry: $\nu$, the degrees of freedom of the Student's $t$-distribution.
Constraint: ${\mathbf{df}}\ge 1.0$.
3: $\mathbf{delta}$double Input
On entry: $\delta$, the noncentrality parameter of the Students $t$-distribution.
4: $\mathbf{opt}$OptionalG01GB Input/Output
Optional parameter container, derived from Optional.
Container for:
toldouble
This optional parameter may be set using the method OptionalG01GB::tol and accessed via OptionalG01GB::get_tol.
Default: $0.0$
On entry: the absolute accuracy required by you in the results. If prob_students_t_noncentral is entered with tol greater than or equal to $1.0$ or less than (see precision), the value of is used instead.
maxittypes::f77_integer
This optional parameter may be set using the method OptionalG01GB::maxit and accessed via OptionalG01GB::get_maxit.
Default: $100$
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$.

## 6Exceptions and Warnings

Errors or warnings detected by the function:
If on exit $\mathbf{errorid}\ne {\mathbf{0}}$, then prob_students_t_noncentral returns $0.0$.
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
$\mathbf{errorid}=1$
On entry, ${\mathbf{df}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{df}}\ge 1.0$.
$\mathbf{errorid}=2$
On entry, ${\mathbf{maxit}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{maxit}}\ge 1$.
$\mathbf{errorid}=4$
Unable to calculate the probability as it is too close to zero or one.
$\mathbf{errorid}=-99$
An unexpected error has been triggered by this routine.
$\mathbf{errorid}=-399$
Your licence key may have expired or may not have been installed correctly.
$\mathbf{errorid}=-999$
Dynamic memory allocation failed.
Raises: WarningException
$\mathbf{errorid}=3$
One of the series has failed to converge with ${\mathbf{maxit}}=⟨\mathit{value}⟩$
and ${\mathbf{tol}}=⟨\mathit{value}⟩$.
Reconsider the requested tolerance and/or the maximum number of iterations.
$\mathbf{errorid}=4$
The probability is too close to $0$ or $1$.
The returned value should be a reasonable estimate of the true value.

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

Please see the description for the underlying computational routine in this section of the FL Interface documentation.

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 (no CPP interface).
Note that prob_students_t_noncentral 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.1Example Program

Source File Data Results
ex_g01gb.cpp None ex_g01gb.r