NAG FL Interface
g01hcf (prob_​bivariate_​students_​t)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

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

2 Specification

Fortran Interface
Function g01hcf ( tail, a, b, df, rho, ifail)
Real (Kind=nag_wp) :: g01hcf
Integer, Intent (In) :: df
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: a(2), b(2), rho
Character (1), Intent (In) :: tail
C Header Interface
#include <nag.h>
double  g01hcf_ (const char *tail, const double a[], const double b[], const Integer *df, const double *rho, Integer *ifail, const Charlen length_tail)
The routine may be called by the names g01hcf or nagf_stat_prob_bivariate_students_t.

3 Description

Let the vector random variable X = (X1,X2) T follow a bivariate Student's t-distribution with degrees of freedom ν and correlation ρ, then the probability density function is given by
f(X:ν,ρ) = 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 f(X:ν,ρ) dX2 dX1 .  
The upper tail probability is defined by:
P( X1 a1 , X2 a2 :ν,ρ) = a1 a2 f(X:ν,ρ) dX2 dX1 .  
The central probability is defined by:
P( a1 X1 b1 , a2 X2 b2 :ν,ρ) = a1 b1 a2 b2 f(X:ν,ρ) dX2 dX1 .  
Calculations use the Dunnett and Sobel (1954) method, as described by Genz (2004).

4 References

Dunnett 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: tail Character(1) Input
On entry: indicates which probability is to be returned.
tail='L'
The lower tail probability is returned.
tail='U'
The upper tail probability is returned.
tail='C'
The central probability is returned.
Constraint: tail='L', 'U' or 'C'.
2: a(2) Real (Kind=nag_wp) array Input
On entry: if tail='C' or 'U', the lower bounds a1 and a2.
If tail='L', a is not referenced.
3: b(2) Real (Kind=nag_wp) array Input
On entry: if tail='C' or 'L', the upper bounds b1 and b2.
If tail='U', b is not referenced.
Constraint: if tail='C', ai<bi, for i=1,2.
4: df Integer Input
On entry: ν, the degrees of freedom of the bivariate Student's t-distribution.
Constraint: df1.
5: rho Real (Kind=nag_wp) Input
On entry: ρ, the correlation of the bivariate Student's t-distribution.
Constraint: -1.0rho1.0.
6: 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 -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry 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 on exit, ifail0, then g01hcf returns zero.
ifail=1
On entry, tail=value.
Constraint: tail='L', 'U' or 'C'.
ifail=3
On entry, b(i)a(i) for central probability, for some i=1,2.
ifail=4
On entry, df=value.
Constraint: df1.
ifail=5
On entry, rho=value.
Constraint: -1.0rho1.0.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

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.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g01hcf is not threaded in any implementation.

9 Further Comments

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 (g01hcfe.f90)

10.2 Program Data

Program Data (g01hcfe.d)

10.3 Program Results

Program Results (g01hcfe.r)