NAG FL Interfaceg01hdf (prob_​multi_​students_​t)

▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

1Purpose

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

2Specification

Fortran Interface
 Function g01hdf ( n, tail, a, b, nu, rc, ldrc, fmax,
 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)
#include <nag.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)
The routine may be called by the names g01hdf or nagf_stat_prob_multi_students_t.

3Description

A random vector $x\in {ℝ}^{n}$ that follows a Student's $t$-distribution with $\nu$ degrees of freedom and covariance matrix $\Sigma$ 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 $\nu$. The method of Dunnett and Sobel (1954) is used in the bivariate case if $\nu$ 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 Dunnett and Sobel (1954) case, a Monte Carlo standard error for multidimensional integrals, and otherwise the quadrature error estimate.
A parameter $\delta$ allows for non-central probabilities. The number theoretic method is used if any $\delta$ is nonzero.
In cases other than the central bivariate with whole $\nu$, g01hdf attempts to evaluate probabilities within a requested accuracy $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\epsilon }_{a},{\epsilon }_{r}×I\right)$, for an approximate integral value $I$, absolute accuracy ${\epsilon }_{a}$ and relative accuracy ${\epsilon }_{r}$.

4References

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

5Arguments

1: $\mathbf{n}$Integer Input
On entry: $n$, the number of dimensions.
Constraint: $1<{\mathbf{n}}\le 1000$.
2: $\mathbf{tail}\left({\mathbf{n}}\right)$Character(1) array Input
On entry: defines the calculated probability, set ${\mathbf{tail}}\left(i\right)$ to:
${\mathbf{tail}}\left(i\right)=\text{'L'}$
If the $i$th lower limit ${a}_{i}$ is negative infinity.
${\mathbf{tail}}\left(i\right)=\text{'U'}$
If the $i$th upper limit ${b}_{i}$ is infinity.
${\mathbf{tail}}\left(i\right)=\text{'C'}$
If both ${a}_{i}$ and ${b}_{i}$ are finite.
Constraint: ${\mathbf{tail}}\left(\mathit{i}\right)=\text{'L'}$, $\text{'U'}$ or $\text{'C'}$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
3: $\mathbf{a}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Input
On entry: ${a}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$, the lower integral limits of the calculation.
If ${\mathbf{tail}}\left(i\right)=\text{'L'}$, ${\mathbf{a}}\left(i\right)$ is not referenced and the $i$th lower limit of integration is $-\infty$.
4: $\mathbf{b}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Input
On entry: ${b}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n$, the upper integral limits of the calculation.
If ${\mathbf{tail}}\left(i\right)=\text{'U'}$, ${\mathbf{b}}\left(i\right)$ is not referenced and the $i$th upper limit of integration is $\infty$.
Constraint: if ${\mathbf{tail}}\left(i\right)=\text{'C'}$, ${\mathbf{b}}\left(i\right)>{\mathbf{a}}\left(i\right)$.
5: $\mathbf{nu}$Real (Kind=nag_wp) Input
On entry: $\nu$, the degrees of freedom.
Constraint: ${\mathbf{nu}}>0.0$.
6: $\mathbf{delta}\left({\mathbf{n}}\right)$Real (Kind=nag_wp) array Input
On entry: ${\mathbf{delta}}\left(\mathit{i}\right)$ the noncentrality parameter for the $\mathit{i}$th dimension, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$; set ${\mathbf{delta}}\left(i\right)=0$ for the central probability.
7: $\mathbf{iscov}$Integer Input
On entry: set ${\mathbf{iscov}}=1$ if the covariance matrix is supplied and ${\mathbf{iscov}}=2$ if the correlation matrix is supplied.
Constraint: ${\mathbf{iscov}}=1$ or $2$.
8: $\mathbf{rc}\left({\mathbf{ldrc}},{\mathbf{n}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: the lower triangle of either the covariance matrix (if ${\mathbf{iscov}}=1$) or the correlation matrix (if ${\mathbf{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: $\mathbf{ldrc}$Integer Input
On entry: the first dimension of the array rc as declared in the (sub)program from which g01hdf is called.
Constraint: ${\mathbf{ldrc}}\ge {\mathbf{n}}$.
10: $\mathbf{epsabs}$Real (Kind=nag_wp) Input
On entry: ${\epsilon }_{a}$, the absolute accuracy requested in the approximation. If epsabs is negative, the absolute value is used.
Suggested value: $0.0$.
11: $\mathbf{epsrel}$Real (Kind=nag_wp) Input
On entry: ${\epsilon }_{r}$, the relative accuracy requested in the approximation. If epsrel is negative, the absolute value is used.
Suggested value: $0.001$.
12: $\mathbf{numsub}$Integer Input
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, ${\mathbf{numsub}}>0$.
13: $\mathbf{nsampl}$Integer Input
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,${\mathbf{nsampl}}>0$.
14: $\mathbf{fmax}$Integer Input
On entry: if a number theoretic approach is used, the maximum number of evaluations for each integrand function.
Suggested value: $1000×{\mathbf{n}}$.
Constraint: if referenced,${\mathbf{fmax}}\ge 1$.
15: $\mathbf{errest}$Real (Kind=nag_wp) Output
On exit: an estimate of the error in the calculated probability.
16: $\mathbf{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 $-\mathbf{1}$ 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).

6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: $1<{\mathbf{n}}\le 1000$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{tail}}\left(k\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{tail}}\left(\mathit{k}\right)=\text{'L'}$, $\text{'U'}$ or $\text{'C'}$.
${\mathbf{ifail}}=4$
On entry, $k=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{b}}\left(k\right)>{\mathbf{a}}\left(k\right)$ for a central probability.
${\mathbf{ifail}}=5$
On entry, ${\mathbf{nu}}=⟨\mathit{\text{value}}⟩$.
Constraint: degrees of freedom ${\mathbf{nu}}>0.0$.
${\mathbf{ifail}}=8$
On entry, ${\mathbf{iscov}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{iscov}}=1$ or $2$.
${\mathbf{ifail}}=9$
On entry, the information supplied in rc is invalid.
${\mathbf{ifail}}=10$
On entry, ${\mathbf{ldrc}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ldrc}}\ge {\mathbf{n}}$.
${\mathbf{ifail}}=12$
On entry, ${\mathbf{numsub}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{numsub}}\ge 1$.
${\mathbf{ifail}}=13$
On entry, ${\mathbf{nsampl}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nsampl}}\ge 1$.
${\mathbf{ifail}}=14$
On entry, ${\mathbf{fmax}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{fmax}}\ge 1$.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{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.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7Accuracy

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

8Parallelism and Performance

g01hdf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g01hdf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

None.

10Example

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

10.1Program Text

Program Text (g01hdfe.f90)

10.2Program Data

Program Data (g01hdfe.d)

10.3Program Results

Program Results (g01hdfe.r)