# NAG CL Interfaceg01fbc (inv_​cdf_​students_​t)

## 1Purpose

g01fbc returns the deviate associated with the given tail probability of Student's $t$-distribution with real degrees of freedom.

## 2Specification

 #include
 double g01fbc (Nag_TailProbability tail, double p, double df, NagError *fail)
The function may be called by the names: g01fbc, nag_stat_inv_cdf_students_t or nag_deviates_students_t.

## 3Description

The deviate, ${t}_{p}$ associated with the lower tail probability, $p$, of the Student's $t$-distribution with $\nu$ degrees of freedom is defined as the solution to
 $PT
For the integral equation is easily solved for ${t}_{p}$.
For other values of $\nu <3$ a transformation to the beta distribution is used and the result obtained from g01fec.
For $\nu \ge 3$ an inverse asymptotic expansion of Cornish–Fisher type is used. The algorithm is described by Hill (1970).

## 4References

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

## 5Arguments

1: $\mathbf{tail}$Nag_TailProbability Input
On entry: indicates which tail the supplied probability represents.
${\mathbf{tail}}=\mathrm{Nag_UpperTail}$
The upper tail probability, i.e., $P\left(T\ge {t}_{p}:\nu \right)$.
${\mathbf{tail}}=\mathrm{Nag_LowerTail}$
The lower tail probability, i.e., $P\left(T\le {t}_{p}:\nu \right)$.
${\mathbf{tail}}=\mathrm{Nag_TwoTailSignif}$
The two tail (significance level) probability, i.e., $P\left(T\ge \left|{t}_{p}\right|:\nu \right)+P\left(T\le -\left|{t}_{p}\right|:\nu \right)$.
${\mathbf{tail}}=\mathrm{Nag_TwoTailConfid}$
The two tail (confidence interval) probability, i.e., $P\left(T\le \left|{t}_{p}\right|:\nu \right)-P\left(T\le -\left|{t}_{p}\right|:\nu \right)$.
Constraint: ${\mathbf{tail}}=\mathrm{Nag_UpperTail}$, $\mathrm{Nag_LowerTail}$, $\mathrm{Nag_TwoTailSignif}$ or $\mathrm{Nag_TwoTailConfid}$.
2: $\mathbf{p}$double Input
On entry: $p$, the probability from the required Student's $t$-distribution as defined by tail.
Constraint: $0.0<{\mathbf{p}}<1.0$.
3: $\mathbf{df}$double Input
On entry: $\nu$, the degrees of freedom of the Student's $t$-distribution.
Constraint: ${\mathbf{df}}\ge 1.0$.
4: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

On any of the error conditions listed below except ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_SOL_NOT_CONV g01fbc returns $0.0$.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REAL_ARG_GE
On entry, ${\mathbf{p}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{p}}<1.0$.
NE_REAL_ARG_LE
On entry, ${\mathbf{p}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{p}}>0.0$.
NE_REAL_ARG_LT
On entry, ${\mathbf{df}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{df}}\ge 1.0$.
NE_SOL_NOT_CONV
The solution has failed to converge. However, the result should be a reasonable approximation.

## 7Accuracy

The results should be accurate to five significant digits, for most argument values. The error behaviour for various argument values is discussed in Hill (1970).

## 8Parallelism and Performance

g01fbc is not threaded in any implementation.

The value ${t}_{p}$ may be calculated by using the transformation described in Section 3 and using g01fec. This function allows you to set the required accuracy.

### 9.1Internal Changes

Internal changes have been made to this function as follows:
• At Mark 27: The algorithm underlying this function has been altered to improve the accuracy in cases where ${\mathbf{df}}<3$.
For details of all known issues which have been reported for the NAG Library please refer to the Known Issues.

## 10Example

This example reads the probability, the tail that probability represents and the degrees of freedom for a number of Student's $t$-distributions and computes the corresponding deviates.

### 10.1Program Text

Program Text (g01fbce.c)

### 10.2Program Data

Program Data (g01fbce.d)

### 10.3Program Results

Program Results (g01fbce.r)