g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_bivariate_students_t (g01hcc)

## 1  Purpose

nag_bivariate_students_t (g01hcc) returns probabilities for the bivariate Student's $t$-distribution.

## 2  Specification

 #include #include
 double nag_bivariate_students_t (Nag_TailProbability tail, const double a[], const double b[], Integer df, double rho, NagError *fail)

## 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).
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  Arguments

1:    $\mathbf{tail}$Nag_TailProbabilityInput
On entry: indicates which probability is to be returned.
${\mathbf{tail}}=\mathrm{Nag_LowerTail}$
The lower tail probability is returned.
${\mathbf{tail}}=\mathrm{Nag_UpperTail}$
The upper tail probability is returned.
${\mathbf{tail}}=\mathrm{Nag_Central}$
The central probability is returned.
Constraint: ${\mathbf{tail}}=\mathrm{Nag_LowerTail}$, $\mathrm{Nag_UpperTail}$ or $\mathrm{Nag_Central}$.
2:    $\mathbf{a}\left[2\right]$const doubleInput
On entry: if ${\mathbf{tail}}=\mathrm{Nag_Central}$ or $\mathrm{Nag_UpperTail}$, the lower bounds ${a}_{1}$ and ${a}_{2}$.
If ${\mathbf{tail}}=\mathrm{Nag_LowerTail}$, a is not referenced.
3:    $\mathbf{b}\left[2\right]$const doubleInput
On entry: if ${\mathbf{tail}}=\mathrm{Nag_Central}$ or $\mathrm{Nag_LowerTail}$, the upper bounds ${b}_{1}$ and ${b}_{2}$.
If ${\mathbf{tail}}=\mathrm{Nag_UpperTail}$, b is not referenced.
Constraint: if ${\mathbf{tail}}=\mathrm{Nag_Central}$, ${a}_{i}<{b}_{i}$, for $\mathit{i}=1,2$.
4:    $\mathbf{df}$IntegerInput
On entry: $\nu$, the degrees of freedom of the bivariate Student's $t$-distribution.
Constraint: ${\mathbf{df}}\ge 1$.
5:    $\mathbf{rho}$doubleInput
On entry: $\rho$, the correlation of the bivariate Student's $t$-distribution.
Constraint: $-1.0\le {\mathbf{rho}}\le 1.0$.
6:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{df}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{df}}\ge 1$.
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 3.6.6 in the Essential Introduction for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.
NE_REAL
On entry, ${\mathbf{rho}}=〈\mathit{\text{value}}〉$.
Constraint: $-1.0\le {\mathbf{rho}}\le 1.0$.
NE_REAL_2
On entry, ${\mathbf{b}}\left[i-1\right]\le {\mathbf{a}}\left[i-1\right]$ for central probability, for some $i=1,2$.

## 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}$.

Not applicable.

None.

## 10  Example

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

### 10.1  Program Text

Program Text (g01hcce.c)

### 10.2  Program Data

Program Data (g01hcce.d)

### 10.3  Program Results

Program Results (g01hcce.r)