hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_prob_students_t (g01eb)

Purpose

nag_stat_prob_students_t (g01eb) returns the lower tail, upper tail or two tail probability for the Student's tt-distribution with real degrees of freedom.

Syntax

[result, ifail] = g01eb(t, df, 'tail', tail)
[result, ifail] = nag_stat_prob_students_t(t, df, 'tail', tail)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 23: tail now optional (default 'l')
.

Description

The lower tail probability for the Student's tt-distribution with νν degrees of freedom, P(Tt : ν)P(Tt:ν) is defined by:
t
P(Tt : ν) = ( Γ ((ν + 1) / 2) )/( sqrt(πν) Γ(ν / 2) )[1 + (T2)/ν] (ν + 1) / 2 dT,  ν1.
P (Tt:ν) = Γ ( (ν+1) / 2 ) πν Γ(ν/2) - t [ 1+ T2ν ] -(ν+1) / 2 dT ,   ν1 .
Computationally, there are two situations:
(i) when ν < 20ν<20, a transformation of the beta distribution, Pβ(Bβ : a,b)Pβ(Bβ:a,b) is used
P (Tt : ν) = (1/2) Pβ (Bν/(ν + t2) : ν / 2,(1/2))   when ​ t < 0.0
P (Tt:ν) = 12 Pβ ( B ν ν+t2 : ν/2, 12 )   when ​ t<0.0
or
P (Tt : ν) = (1/2) + (1/2) Pβ (B(ν)/(ν + t2) : ν / 2,(1/2))   when ​ t > 0.0 ;
P (Tt:ν) = 12 + 12 Pβ ( B ν ν+t2 : ν/2, 12 )   when ​ t>0.0 ;
(ii) when ν20ν20, an asymptotic normalizing expansion of the Cornish–Fisher type is used to evaluate the probability, see Hill (1970).

References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth
Hill G W (1970) Student's tt-distribution Comm. ACM 13(10) 617–619

Parameters

Compulsory Input Parameters

1:     t – double scalar
tt, the value of the Student's tt variate.
2:     df – double scalar
νν, the degrees of freedom of the Student's tt-distribution.
Constraint: df1.0df1.0.

Optional Input Parameters

1:     tail – string (length ≥ 1)
Indicates which tail the returned probability should represent.
tail = 'U'tail='U'
The upper tail probability is returned, i.e., P(Tt : ν)P(Tt:ν).
tail = 'S'tail='S'
The two tail (significance level) probability is returned,
i.e., P(T|t| : ν) + P(T|t| : ν)P(T|t|:ν)+P(T-|t|:ν).
tail = 'C'tail='C'
The two tail (confidence interval) probability is returned,
i.e., P(T|t| : ν)P(T|t| : ν)P(T|t|:ν)-P(T-|t|:ν).
tail = 'L'tail='L'
The lower tail probability is returned, i.e., P(Tt : ν)P(Tt:ν).
Default: 'L''L'
Constraint: tail = 'U'tail='U', 'S''S', 'C''C' or 'L''L'.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
If ifail0ifail0, then nag_stat_prob_students_t (g01eb) returns 0.00.0.
  ifail = 1ifail=1
On entry,tail'U'tail'U', 'S''S', 'C''C' or 'L''L'.
  ifail = 2ifail=2
On entry,df < 1.0df<1.0.

Accuracy

The computed probability should be accurate to five significant places for reasonable probabilities but there will be some loss of accuracy for very low probabilities (less than 101010-10), see Hastings and Peacock (1975).

Further Comments

The probabilities could also be obtained by using the appropriate transformation to a beta distribution (see Abramowitz and Stegun (1972)) and using nag_stat_prob_beta (g01ee). This function allows you to set the required accuracy.

Example

function nag_stat_prob_students_t_example
t = 0.85;
df = 20;
[result, ifail] = nag_stat_prob_students_t(t, df)
 

result =

    0.7973


ifail =

                    0


function g01eb_example
t = 0.85;
df = 20;
[result, ifail] = g01eb(t, df)
 

result =

    0.7973


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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