# NAG FL Interfaceg01ebf (prob_​students_​t)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

g01ebf returns the lower tail, upper tail or two tail probability for the Student's $t$-distribution with real degrees of freedom.

## 2Specification

Fortran Interface
 Function g01ebf ( tail, t, df,
 Real (Kind=nag_wp) :: g01ebf Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: t, df Character (1), Intent (In) :: tail
#include <nag.h>
 double g01ebf_ (const char *tail, const double *t, const double *df, Integer *ifail, const Charlen length_tail)
The routine may be called by the names g01ebf or nagf_stat_prob_students_t.

## 3Description

The lower tail probability for the Student's $t$-distribution with $\nu$ degrees of freedom, $P\left(T\le t:\nu \right)$ is defined by:
 $P (T≤t:ν) = Γ ((ν+1)/2) πν Γ(ν/2) ∫ -∞ t [1+T2ν] -(ν+1) / 2 dT , ν≥1 .$
Computationally, there are two situations:
1. (i)when $\nu <20$, a transformation of the beta distribution, ${P}_{\beta }\left(B\le \beta :a,b\right)$ is used
 $P (T≤t:ν) = 12 Pβ (B≤ ν ν+t2 :ν/2,12) when ​ t<0.0$
or
 $P (T≤t:ν) = 12 + 12 Pβ (B≥ ν ν+t2 :ν/2,12) when ​ t>0.0 ;$
2. (ii)when $\nu \ge 20$, an asymptotic normalizing expansion of the Cornish–Fisher type is used to evaluate the probability, see Hill (1970).

## 4References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
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}$Character(1) Input
On entry: indicates which tail the returned probability should represent.
${\mathbf{tail}}=\text{'U'}$
The upper tail probability is returned, i.e., $P\left(T\ge t:\nu \right)$.
${\mathbf{tail}}=\text{'S'}$
The two tail (significance level) probability is returned, i.e., $P\left(T\ge |t|:\nu \right)+P\left(T\le -|t|:\nu \right)$.
${\mathbf{tail}}=\text{'C'}$
The two tail (confidence interval) probability is returned, i.e., $P\left(T\le |t|:\nu \right)-P\left(T\le -|t|:\nu \right)$.
${\mathbf{tail}}=\text{'L'}$
The lower tail probability is returned, i.e., $P\left(T\le t:\nu \right)$.
Constraint: ${\mathbf{tail}}=\text{'U'}$, $\text{'S'}$, $\text{'C'}$ or $\text{'L'}$.
2: $\mathbf{t}$Real (Kind=nag_wp) Input
On entry: $t$, the value of the Student's $t$ variate.
3: $\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$.
4: $\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 ${\mathbf{ifail}}\ne {\mathbf{0}}$, then g01ebf returns $0.0$.
${\mathbf{ifail}}=1$
On entry, ${\mathbf{tail}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{tail}}=\text{'L'}$, $\text{'U'}$, $\text{'S'}$ or $\text{'C'}$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{df}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{df}}\ge 1.0$.
${\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 computed probability should be accurate to five significant places for reasonable probabilities but there will be some loss of accuracy for very low probabilities (less than ${10}^{-10}$), see Hastings and Peacock (1975).

## 8Parallelism and Performance

g01ebf is not threaded in any implementation.

The probabilities could also be obtained by using the appropriate transformation to a beta distribution (see Abramowitz and Stegun (1972)) and using g01eef. This routine allows you to set the required accuracy.

## 10Example

This example reads values from, and degrees of freedom for Student's $t$-distributions along with the required tail. The probabilities are calculated and printed until the end of data is reached.

### 10.1Program Text

Program Text (g01ebfe.f90)

### 10.2Program Data

Program Data (g01ebfe.d)

### 10.3Program Results

Program Results (g01ebfe.r)