G01HCF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentG01HCF

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

G01HCF returns probabilities for the bivariate Student's $t$-distribution, via the routine name.

## 2  Specification

 FUNCTION G01HCF ( TAIL, A, B, DF, RHO, IFAIL)
 REAL (KIND=nag_wp) G01HCF
 INTEGER DF, IFAIL REAL (KIND=nag_wp) A(2), B(2), RHO CHARACTER(1) TAIL

## 3  Description

Let the vector random variable $X={\left({X}_{1},{X}_{2}\right)}^{\mathrm{T}}$ follow a bivariate Student's $t$-distribution with degrees of freedom $\nu$ and correlation $\rho$, then the probability density function is given by
 $fX:ν,ρ = 1 2π 1-ρ2 1 + X12 + X22 - 2 ρ X1 X2 ν 1-ρ2 -ν/2-1 .$
The lower tail probability is defined by:
 $P X1 ≤ b1 , X2 ≤ b2 :ν,ρ = ∫ -∞ b1 ∫ -∞ b2 fX:ν,ρ dX2 dX1 .$
The upper tail probability is defined by:
 $P X1 ≥ a1 , X2 ≥ a2 :ν,ρ = ∫ a1 ∞ ∫ a2 ∞ fX:ν,ρ dX2 dX1 .$
The central probability is defined by:
 $P a1 ≤ X1 ≤ b1 , a2 ≤ X2 ≤ b2 :ν,ρ = ∫ a1 b1 ∫ a2 b2 fX:ν,ρ dX2 dX1 .$
Calculations use the Dunnet and Sobel (1954) method, as described by Genz (2004).

## 4  References

Dunnet C W and Sobel M (1954) A bivariate generalization of Student's $t$-distribution, with tables for certain special cases Biometrika 41 153–169
Genz A (2004) Numerical computation of rectangular bivariate and trivariate Normal and $t$ probabilities Statistics and Computing 14 151–160

## 5  Parameters

1:     TAIL – CHARACTER(1)Input
On entry: indicates which probability is to be returned.
${\mathbf{TAIL}}=\text{'L'}$
The lower tail probability is returned.
${\mathbf{TAIL}}=\text{'U'}$
The upper tail probability is returned.
${\mathbf{TAIL}}=\text{'C'}$
The central probability is returned.
Constraint: ${\mathbf{TAIL}}=\text{'L'}$, $\text{'U'}$ or $\text{'C'}$.
2:     A($2$) – REAL (KIND=nag_wp) arrayInput
On entry: if ${\mathbf{TAIL}}=\text{'C'}$ or $\text{'U'}$, the lower bounds ${a}_{1}$ and ${a}_{2}$.
If ${\mathbf{TAIL}}=\text{'L'}$, A is not referenced.
3:     B($2$) – REAL (KIND=nag_wp) arrayInput
On entry: if ${\mathbf{TAIL}}=\text{'C'}$ or $\text{'L'}$, the upper bounds ${b}_{1}$ and ${b}_{2}$.
If ${\mathbf{TAIL}}=\text{'U'}$, B is not referenced.
Constraint: if ${\mathbf{TAIL}}=\text{'C'}$, ${a}_{i}<{b}_{i}$, for $\mathit{i}=1,2$.
4:     DF – INTEGERInput
On entry: $\nu$, the degrees of freedom of the bivariate Student's $t$-distribution.
Constraint: ${\mathbf{DF}}\ge 1$.
5:     RHO – REAL (KIND=nag_wp)Input
On entry: $\rho$, the correlation of the bivariate Student's $t$-distribution.
Constraint: $-1.0\le {\mathbf{RHO}}\le 1.0$.
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 0$, then G01HCF returns zero.
${\mathbf{IFAIL}}=1$
On entry, TAIL is not valid.
${\mathbf{IFAIL}}=3$
On entry, ${\mathbf{B}}\left(i\right)\le {\mathbf{A}}\left(i\right)$ for central probability, for some $i=1,2$.
${\mathbf{IFAIL}}=4$
On entry, ${\mathbf{DF}}<1$.
${\mathbf{IFAIL}}=5$
On entry, ${\mathbf{RHO}}<-1.0$ or ${\mathbf{RHO}}>1.0$.

## 7  Accuracy

Accuracy of the algorithm implemented here is discussed in comparison with algorithms based on a generalized Placket formula by Genz (2004), who recommends the Dunnet and Sobel method. This implementation should give a maximum absolute error of the order of ${10}^{-16}$.

None.

## 9  Example

This example calculates the bivariate Student's $t$ probability given the choice of tail and degrees of freedom, correlation and bounds.

### 9.1  Program Text

Program Text (g01hcfe.f90)

### 9.2  Program Data

Program Data (g01hcfe.d)

### 9.3  Program Results

Program Results (g01hcfe.r)

G01HCF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual