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_inv_cdf_students_t (g01fb)


nag_stat_inv_cdf_students_t (g01fb) returns the deviate associated with the given tail probability of Student's tt-distribution with real degrees of freedom.


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


The deviate, tptp associated with the lower tail probability, pp, of the Student's tt-distribution with νν degrees of freedom is defined as the solution to
P(T < tp : ν) = p = (Γ((ν + 1) / 2))/(sqrt(νπ)Γ(ν / 2))(1 + (T2)/ν)(ν + 1) / 2dT,  ν1; ​ < tp < .
P(T<tp:ν)=p=Γ((ν+1)/2) νπΓ(ν/2) -tp (1+T2ν) -(ν+1)/2dT,  ν1; ​-<tp<.
For ν = 1​ or ​2ν=1​ or ​2 the integral equation is easily solved for tptp.
For other values of ν < 3ν<3 a transformation to the beta distribution is used and the result obtained from nag_stat_inv_cdf_beta (g01fe).
For ν3ν3 an inverse asymptotic expansion of Cornish–Fisher type is used. The algorithm is described by Hill (1970).


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


Compulsory Input Parameters

1:     p – double scalar
pp, the probability from the required Student's tt-distribution as defined by tail.
Constraint: 0.0 < p < 1.00.0<p<1.0.
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 supplied probability represents.
tail = 'U'tail='U'
The upper tail probability, i.e., P(Ttp : ν)P(Ttp:ν).
tail = 'L'tail='L'
The lower tail probability, i.e., P(Ttp : ν)P(Ttp:ν).
tail = 'S'tail='S'
The two tail (significance level) probability, i.e., P(T|tp| : ν) + P(T|tp| : ν)P(T|tp|:ν)+P(T-|tp|:ν).
tail = 'C'tail='C'
The two tail (confidence interval) probability, i.e., P(T|tp| : ν)P(T|tp| : ν)P(T|tp|:ν)-P(T-|tp|:ν).
Default: 'L''L'
Constraint: tail = 'U'tail='U', 'L''L', 'S''S' or 'C''C'.

Input Parameters Omitted from the MATLAB Interface


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

Note: nag_stat_inv_cdf_students_t (g01fb) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
If ifail = 1ifail=1, 22 or 33 on exit, then nag_stat_inv_cdf_students_t (g01fb) returns zero.

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,tail'U'tail'U', 'S''S', 'C''C' or 'L''L'.
  ifail = 2ifail=2
On entry,p0.0p0.0,
  ifail = 3ifail=3
On entry,df < 1.0df<1.0.
W ifail = 5ifail=5
Convergence in the calculation of the inverse beta value was not achieved. However, the result should be a reasonable approximation to the correct value.


The results should be accurate to five significant digits, for most parameter values. The error behaviour for various parameter values is discussed in Hill (1970).

Further Comments

The value tptp may be calculated by using the transformation described in Section [Description] and using nag_stat_inv_cdf_beta (g01fe). This function allows you to set the required accuracy.


function nag_stat_inv_cdf_students_t_example
p = 0.01;
df = 20;
[result, ifail] = nag_stat_inv_cdf_students_t(p, df, 'tail', 's')

result =


ifail =


function g01fb_example
p = 0.01;
df = 20;
[result, ifail] = g01fb(p, df, 'tail', 's')

result =


ifail =


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