NAG Library Routine Document

g01hdf (prob_multi_students_t)


    1  Purpose
    7  Accuracy


g01hdf returns a probability associated with a multivariate Student's t-distribution.


Fortran Interface
Function g01hdf ( n, tail, a, b, nu, delta, iscov, rc, ldrc, epsabs, epsrel, numsub, nsampl, fmax, errest, ifail)
Real (Kind=nag_wp):: g01hdf
Integer, Intent (In):: n, iscov, ldrc, numsub, nsampl, fmax
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: a(n), b(n), nu, delta(n), epsabs, epsrel
Real (Kind=nag_wp), Intent (Inout):: rc(ldrc,n)
Real (Kind=nag_wp), Intent (Out):: errest
Character (1), Intent (In):: tail(n)
C Header Interface
#include nagmk26.h
double  g01hdf_ (const Integer *n, const char tail[], const double a[], const double b[], const double *nu, const double delta[], const Integer *iscov, double rc[], const Integer *ldrc, const double *epsabs, const double *epsrel, const Integer *numsub, const Integer *nsampl, const Integer *fmax, double *errest, Integer *ifail, const Charlen length_tail)


A random vector xn that follows a Student's t-distribution with ν degrees of freedom and covariance matrix Σ has density:
Γ ν+n / 2 Γ ν/2 νn/2 πn/2 Σ 1/2 1+ 1ν xT Σ-1x ν+n / 2 ,  
and probability p given by:
p = Γ ν+n / 2 Γ ν/2 Σ πνn a1 b1 a2 b2 an bn 1+ xT Σ-1x/ν - ν+n/2 dx .  
The method of calculation depends on the dimension n and degrees of freedom ν. The method of Dunnet and Sobel is used in the bivariate case if ν is a whole number. A Plackett transform followed by quadrature method is adopted in other bivariate cases and trivariate cases. In dimensions higher than three a number theoretic approach to evaluating multidimensional integrals is adopted.
Error estimates are supplied as the published accuracy in the Dunnet and Sobel case, a Monte–Carlo standard error for multidimensional integrals, and otherwise the quadrature error estimate.
A parameter δ allows for non-central probabilities. The number theoretic method is used if any δ is nonzero.
In cases other than the central bivariate with whole ν, g01hdf attempts to evaluate probabilities within a requested accuracy maxεa,εr×I, for an approximate integral value I, absolute accuracy εa and relative accuracy εr.


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 and Bretz F (2002) Methods for the computation of multivariate t-probabilities Journal of Computational and Graphical Statistics (11) 950–971


1:     n – IntegerInput
On entry: n, the number of dimensions.
Constraint: 1<n1000.
2:     tailn – Character(1) arrayInput
On entry: defines the calculated probability, set taili to:
If the ith lower limit ai is negative infinity.
If the ith upper limit bi is infinity.
If both ai and bi are finite.
Constraint: taili='L', 'U' or 'C', for i=1,2,,n.
3:     an – Real (Kind=nag_wp) arrayInput
On entry: ai, for i=1,2,,n, the lower integral limits of the calculation.
If taili='L', ai is not referenced and the ith lower limit of integration is -.
4:     bn – Real (Kind=nag_wp) arrayInput
On entry: bi, for i=1,2,,n, the upper integral limits of the calculation.
If taili='U', bi is not referenced and the ith upper limit of integration is .
Constraint: if taili='C', bi>ai.
5:     nu – Real (Kind=nag_wp)Input
On entry: ν, the degrees of freedom.
Constraint: nu>0.0.
6:     deltan – Real (Kind=nag_wp) arrayInput
On entry: deltai the noncentrality parameter for the ith dimension, for i=1,2,,n; set deltai=0 for the central probability.
7:     iscov – IntegerInput
On entry: set iscov=1 if the covariance matrix is supplied and iscov=2 if the correlation matrix is supplied.
Constraint: iscov=1 or 2.
8:     rcldrcn – Real (Kind=nag_wp) arrayInput/Output
On entry: the lower triangle of either the covariance matrix (if iscov=1) or the correlation matrix (if iscov=2). In either case the array elements corresponding to the upper triangle of the matrix need not be set.
On exit: the strict upper triangle of rc contains the correlation matrix used in the calculations.
9:     ldrc – IntegerInput
On entry: the first dimension of the array rc as declared in the (sub)program from which g01hdf is called.
Constraint: ldrcn.
10:   epsabs – Real (Kind=nag_wp)Input
On entry: εa, the absolute accuracy requested in the approximation. If epsabs is negative, the absolute value is used.
Suggested value: 0.0.
11:   epsrel – Real (Kind=nag_wp)Input
On entry: εr, the relative accuracy requested in the approximation. If epsrel is negative, the absolute value is used.
Suggested value: 0.001.
12:   numsub – IntegerInput
On entry: if quadrature is used, the number of sub-intervals used by the quadrature algorithm; otherwise numsub is not referenced.
Suggested value: 350.
Constraint: if referenced, numsub>0.
13:   nsampl – IntegerInput
On entry: if quadrature is used, nsampl is not referenced; otherwise nsampl is the number of samples used to estimate the error in the approximation.
Suggested value: 8.
Constraint: if referenced,nsampl>0.
14:   fmax – IntegerInput
On entry: if a number theoretic approach is used, the maximum number of evaluations for each integrand function.
Suggested value: 1000×n.
Constraint: if referenced,fmax1.
15:   errest – Real (Kind=nag_wp)Output
On exit: an estimate of the error in the calculated probability.
16:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ 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 argument, the recommended value is 0. 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).

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:
On entry, n=value.
Constraint: 1<n1000.
On entry, tailk=value.
Constraint: tailk='L', 'U' or 'C'.
On entry, k=value.
Constraint: bk>ak for a central probability.
On entry, nu=value.
Constraint: degrees of freedom nu>0.0.
On entry, iscov=value.
Constraint: iscov=1 or 2.
On entry, the information supplied in rc is invalid.
On entry, ldrc=value and n=value.
Constraint: ldrcn.
On entry, numsub=value.
Constraint: numsub1.
On entry, nsampl=value.
Constraint: nsampl1.
On entry, fmax=value.
Constraint: fmax1.
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.


An estimate of the error in the calculation is given by the value of errest on exit.

Parallelism and Performance

g01hdf is not threaded in any implementation.

Further Comments



This example prints two probabilities from the Student's t-distribution.

Program Text

Program Text (g01hdfe.f90)

Program Data

Program Data (g01hdfe.d)

Program Results

Program Results (g01hdfe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017