Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_multi_students_t (g01hd)

## Purpose

nag_multi_students_t (g01hd) returns a probability associated with a multivariate Student's t$t$-distribution.

## Syntax

[result, rc, errest, ifail] = g01hd(tail, a, b, nu, delta, iscov, rc, 'n', n, 'epsabs', epsabs, 'epsrel', epsrel, 'numsub', numsub, 'nsampl', nsampl, 'fmax', fmax)
[result, rc, errest, ifail] = nag_multi_students_t(tail, a, b, nu, delta, iscov, rc, 'n', n, 'epsabs', epsabs, 'epsrel', epsrel, 'numsub', numsub, 'nsampl', nsampl, 'fmax', fmax)

## Description

A random vector xn$x\in {ℝ}^{n}$ that follows a Student's t$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 ) , $Γ ( (ν+n) / 2 ) Γ (ν/2) νn/2 πn/2 |Σ| 1/2 [ 1+ 1ν xT Σ-1x ] (ν+n) / 2 ,$
and probability p$p$ given by:
 b1 b2 bn p = ( Γ ((ν + n) / 2) )/( Γ (ν / 2) sqrt( |Σ| (πν)n ) ) ∫ ∫ ⋯ ∫ (1 + xTΣ − 1x / ν) − (ν + n) / 2 dx. a1 a2 an
$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$n$ and degrees of freedom ν$\nu$. The method of Dunnet and Sobel 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 Dunnet and Sobel 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$, nag_multi_students_t (g01hd) attempts to evaluate probabilities within a requested accuracy max (εa,εr × I)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\epsilon }_{a},{\epsilon }_{r}×I\right)$, for an approximate integral value I$I$, absolute accuracy εa${\epsilon }_{a}$ and relative accuracy εr${\epsilon }_{r}$.

## References

Dunnet C W and Sobel M (1954) A bivariate generalization of Student's t$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$t$-probabilities Journal of Computational and Graphical Statistics (11) 950–971

## Parameters

### Compulsory Input Parameters

1:     tail(n) – cell array of strings
n, the dimension of the array, must satisfy the constraint 1 < n1000$1<{\mathbf{n}}\le 1000$.
Defines the calculated probability, set tail(i)${\mathbf{tail}}\left(i\right)$ to:
tail(i) = 'L'${\mathbf{tail}}\left(i\right)=\text{'L'}$
If the i$i$th lower limit ai${a}_{i}$ is negative infinity.
tail(i) = 'U'${\mathbf{tail}}\left(i\right)=\text{'U'}$
If the i$i$th upper limit bi${b}_{i}$ is infinity.
tail(i) = 'C'${\mathbf{tail}}\left(i\right)=\text{'C'}$
If both ai${a}_{i}$ and bi${b}_{i}$ are finite.
Constraint: tail(i) = 'L'${\mathbf{tail}}\left(\mathit{i}\right)=\text{'L'}$, 'U'$\text{'U'}$ or 'C'$\text{'C'}$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
2:     a(n) – double array
n, the dimension of the array, must satisfy the constraint 1 < n1000$1<{\mathbf{n}}\le 1000$.
ai${a}_{\mathit{i}}$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,n$, the lower integral limits of the calculation.
If tail(i) = 'L'${\mathbf{tail}}\left(i\right)=\text{'L'}$, a(i)${\mathbf{a}}\left(i\right)$ is not referenced and the i$i$th lower limit of integration is $-\infty$.
3:     b(n) – double array
n, the dimension of the array, must satisfy the constraint 1 < n1000$1<{\mathbf{n}}\le 1000$.
bi${b}_{\mathit{i}}$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,n$, the upper integral limits of the calculation.
If tail(i) = 'U'${\mathbf{tail}}\left(i\right)=\text{'U'}$, b(i)${\mathbf{b}}\left(i\right)$ is not referenced and the i$i$th upper limit of integration is $\infty$.
Constraint: if tail(i) = 'C'${\mathbf{tail}}\left(i\right)=\text{'C'}$, b(i) > a(i)${\mathbf{b}}\left(i\right)>{\mathbf{a}}\left(i\right)$.
4:     nu – double scalar
ν$\nu$, the degrees of freedom.
Constraint: nu > 0.0${\mathbf{nu}}>0.0$.
5:     delta(n) – double array
n, the dimension of the array, must satisfy the constraint 1 < n1000$1<{\mathbf{n}}\le 1000$.
delta(i)${\mathbf{delta}}\left(\mathit{i}\right)$ the noncentrality parameter for the i$\mathit{i}$th dimension, for i = 1,2,,n$\mathit{i}=1,2,\dots ,{\mathbf{n}}$; set delta(i) = 0${\mathbf{delta}}\left(i\right)=0$ for the central probability.
6:     iscov – int64int32nag_int scalar
Set iscov = 1${\mathbf{iscov}}=1$ if the covariance matrix is supplied and iscov = 2${\mathbf{iscov}}=2$ if the correlation matrix is supplied.
Constraint: iscov = 1${\mathbf{iscov}}=1$ or 2$2$.
7:     rc(ldrc,n) – double array
ldrc, the first dimension of the array, must satisfy the constraint ldrcn$\mathit{ldrc}\ge {\mathbf{n}}$.
The lower triangle of either the covariance matrix (if iscov = 1${\mathbf{iscov}}=1$) or the correlation matrix (if iscov = 2${\mathbf{iscov}}=2$). In either case the array elements corresponding to the upper triangle of the matrix need not be set.

### Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The dimension of the arrays tail, a, b, delta and the first dimension of the array rc and the second dimension of the array rc. (An error is raised if these dimensions are not equal.)
n$n$, the number of dimensions.
Constraint: 1 < n1000$1<{\mathbf{n}}\le 1000$.
2:     epsabs – double scalar
εa${\epsilon }_{a}$, the absolute accuracy requested in the approximation. If epsabs is negative, the absolute value is used.
Default: 0.0$0.0$
3:     epsrel – double scalar
εr${\epsilon }_{r}$, the relative accuracy requested in the approximation. If epsrel is negative, the absolute value is used.
Default: 0.001$0.001$
4:     numsub – int64int32nag_int scalar
If quadrature is used, the number of sub-intervals used by the quadrature algorithm; otherwise numsub is not referenced.
Default: 350$350$
Constraint: if referenced, numsub > 0${\mathbf{numsub}}>0$.
5:     nsampl – int64int32nag_int scalar
If quadrature is used, nsampl is not referenced; otherwise nsampl is the number of samples used to estimate the error in the approximation.
Default: 8$8$
Constraint: if referenced, nsampl > 0${\mathbf{nsampl}}>0$.
6:     fmax – int64int32nag_int scalar
If a number theoretic approach is used, the maximum number of evaluations for each integrand function.
Default: 1000 × n$1000×{\mathbf{n}}$
Constraint: if referenced, fmax1${\mathbf{fmax}}\ge 1$.

ldrc

### Output Parameters

1:     result – double scalar
The result of the function.
2:     rc(ldrc,n) – double array
ldrcn$\mathit{ldrc}\ge {\mathbf{n}}$.
The strict upper triangle of rc contains the correlation matrix used in the calculations.
3:     errest – double scalar
An estimate of the error in the calculated probability.
4:     ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).

## Error Indicators and Warnings

Errors or warnings detected by the function:
ifail = 1${\mathbf{ifail}}=1$
Constraint: 1 < n1000$1<{\mathbf{n}}\le 1000$.
ifail = 2${\mathbf{ifail}}=2$
Constraint: tail(k) = 'L'${\mathbf{tail}}\left(\mathit{k}\right)=\text{'L'}$, 'U'$\text{'U'}$ or 'C'$\text{'C'}$.
ifail = 4${\mathbf{ifail}}=4$
Constraint: b(k) > a(k)${\mathbf{b}}\left(k\right)>{\mathbf{a}}\left(k\right)$ for a central probability.
ifail = 5${\mathbf{ifail}}=5$
Constraint: degrees of freedom nu > 0.0${\mathbf{nu}}>0.0$.
ifail = 8${\mathbf{ifail}}=8$
Constraint: iscov = 1${\mathbf{iscov}}=1$ or 2$2$.
ifail = 9${\mathbf{ifail}}=9$
On entry, the information supplied in rc is invalid.
ifail = 10${\mathbf{ifail}}=10$
Constraint: ldrcn$\mathit{ldrc}\ge {\mathbf{n}}$.
ifail = 12${\mathbf{ifail}}=12$
Constraint: numsub1${\mathbf{numsub}}\ge 1$.
ifail = 13${\mathbf{ifail}}=13$
Constraint: nsampl1${\mathbf{nsampl}}\ge 1$.
ifail = 14${\mathbf{ifail}}=14$
Constraint: fmax1${\mathbf{fmax}}\ge 1$.

## Accuracy

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

None.

## Example

```function nag_multi_students_t_example
iscov  = int64(1);

% Example 1
nu = 10;
tail = {'u'; 'u'; 'u'; 'u'; 'u'};
a = [-0.1; -0.1; -0.1; -0.1; -0.1];
b = [888; 888; 888; 888; 888];
delta = [0; 0; 0; 0; 0];
rc = [1.00, 0.75, 0.75, 0.75, 0.75;
0.75, 1.00, 0.75, 0.75, 0.75;
0.75, 0.75, 1.00, 0.75, 0.75;
0.75, 0.75, 0.75, 1.00, 0.75;
0.75, 0.75, 0.75, 0.75, 1.00];

% Calculate probability
[result, rc, errest, ifail] = ...
nag_multi_students_t(tail, a, b, nu, delta, iscov, rc);

fprintf('\nExample 1:\n');
fprintf('Probability:   %24.8e\nError estimate:%24.2e\n', result, errest);

% Example 2
nu = 3;
tail = {'l'; 'l'; 'l'; 'l'; 'l'};
a = [888; 888; 888; 888; 888];
b = [-0.1; -0.1; -0.1; -0.1; -0.1];
delta = [1; 2; 3; 3; 3];
rc = [1.00, 0.75, 0.75, 0.75, 0.75;
0.75, 1.00, 0.75, 0.75, 0.75;
0.75, 0.75, 1.00, 0.75, 0.75;
0.75, 0.75, 0.75, 1.00, 0.75;
0.75, 0.75, 0.75, 0.75, 1.00];

% Calculate probability
[result, rc, errest, ifail] = ...
nag_multi_students_t(tail, a, b, nu, delta, iscov, rc);

fprintf('\nExample 2:\n');
fprintf('Probability:   %24.8e\nError estimate:%24.2e\n', result, errest);
```
```

Example 1:
Probability:             3.01642215e-01
Error estimate:                1.09e-05

Example 2:
Probability:             8.62903029e-05
Error estimate:                1.62e-07

```
```function g01hd_example
iscov  = int64(1);

% Example 1
nu = 10;
tail = {'u'; 'u'; 'u'; 'u'; 'u'};
a = [-0.1; -0.1; -0.1; -0.1; -0.1];
b = [888; 888; 888; 888; 888];
delta = [0; 0; 0; 0; 0];
rc = [1.00, 0.75, 0.75, 0.75, 0.75;
0.75, 1.00, 0.75, 0.75, 0.75;
0.75, 0.75, 1.00, 0.75, 0.75;
0.75, 0.75, 0.75, 1.00, 0.75;
0.75, 0.75, 0.75, 0.75, 1.00];

% Calculate probability
[result, rc, errest, ifail] = ...
g01hd(tail, a, b, nu, delta, iscov, rc);

fprintf('\nExample 1:\n');
fprintf('Probability:   %24.8e\nError estimate:%24.2e\n', result, errest);

% Example 2
nu = 3;
tail = {'l'; 'l'; 'l'; 'l'; 'l'};
a = [888; 888; 888; 888; 888];
b = [-0.1; -0.1; -0.1; -0.1; -0.1];
delta = [1; 2; 3; 3; 3];
rc = [1.00, 0.75, 0.75, 0.75, 0.75;
0.75, 1.00, 0.75, 0.75, 0.75;
0.75, 0.75, 1.00, 0.75, 0.75;
0.75, 0.75, 0.75, 1.00, 0.75;
0.75, 0.75, 0.75, 0.75, 1.00];

% Calculate probability
[result, rc, errest, ifail] = ...
g01hd(tail, a, b, nu, delta, iscov, rc);

fprintf('\nExample 2:\n');
fprintf('Probability:   %24.8e\nError estimate:%24.2e\n', result, errest);
```
```

Example 1:
Probability:             3.01642215e-01
Error estimate:                1.09e-05

Example 2:
Probability:             8.62903029e-05
Error estimate:                1.62e-07

```

Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013