# NAG CL Interfaceg01hcc (prob_​bivariate_​students_​t)

## 1Purpose

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

## 2Specification

 #include
 double g01hcc (Nag_TailProbability tail, const double a[], const double b[], Integer df, double rho, NagError *fail)
The function may be called by the names: g01hcc, nag_stat_prob_bivariate_students_t or nag_bivariate_students_t.

## 3Description

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

## 5Arguments

1: $\mathbf{tail}$Nag_TailProbability Input
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 double Input
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 double Input
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}$Integer Input
On entry: $\nu$, the degrees of freedom of the bivariate Student's $t$-distribution.
Constraint: ${\mathbf{df}}\ge 1$.
5: $\mathbf{rho}$double Input
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 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
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 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
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$.

## 7Accuracy

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

## 8Parallelism and Performance

g01hcc is not threaded in any implementation.

None.

## 10Example

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

### 10.1Program Text

Program Text (g01hcce.c)

### 10.2Program Data

Program Data (g01hcce.d)

### 10.3Program Results

Program Results (g01hcce.r)