NAG Library Routine Document
g01gbf
(prob_students_t_noncentral)
1
Purpose
g01gbf returns the lower tail probability for the noncentral Student's -distribution, via the routine name.
2
Specification
Fortran Interface
Real (Kind=nag_wp) | :: | g01gbf | Integer, Intent (In) | :: |
maxit | Integer, Intent (Inout) | :: |
ifail | Real (Kind=nag_wp), Intent (In) | :: |
t,
df,
delta,
tol |
|
C Header Interface
#include nagmk26.h
double |
g01gbf_ (
const double *t,
const double *df,
const double *delta,
const double *tol,
const Integer *maxit,
Integer *ifail) |
|
3
Description
The lower tail probability of the noncentral Student's
-distribution with
degrees of freedom and noncentrality parameter
,
, is defined by
with
The probability is computed in one of two ways.
(i) |
When , the relationship to the normal is used:
|
(ii) |
Otherwise the series expansion described in Equation 9 of Amos (1964) is used. This involves the sums of confluent hypergeometric functions, the terms of which are computed using recurrence relationships. |
4
References
Amos D E (1964) Representations of the central and non-central -distributions Biometrika 51 451–458
5
Arguments
- 1: – Real (Kind=nag_wp)Input
-
On entry: , the deviate from the Student's -distribution with degrees of freedom.
- 2: – Real (Kind=nag_wp)Input
-
On entry: , the degrees of freedom of the Student's -distribution.
Constraint:
.
- 3: – Real (Kind=nag_wp)Input
-
On entry: , the noncentrality argument of the Students -distribution.
- 4: – Real (Kind=nag_wp)Input
-
On entry: the absolute accuracy required by you in the results. If
g01gbf is entered with
tol greater than or equal to
or less than
(see
x02ajf), the value of
is used instead.
- 5: – IntegerInput
-
On entry: the maximum number of terms that are used in each of the summations.
Suggested value:
. See
Section 9 for further comments.
Constraint:
.
- 6: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. 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
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
If on exit , then g01gbf returns .
-
On entry, .
Constraint: .
-
On entry, .
Constraint: .
-
One of the series has failed to converge with and . Reconsider the requested tolerance and/or the maximum number of iterations.
-
The probability is too close to or . The returned value should be a reasonable estimate of the true value.
Unable to calculate the probability as it is too close to zero or one.
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.
7
Accuracy
The series described in
Amos (1964) are summed until an estimated upper bound on the contribution of future terms to the probability is less than
tol. There may also be some loss of accuracy due to calculation of gamma functions.
8
Parallelism and Performance
g01gbf is not threaded in any implementation.
The rate of convergence of the series depends, in part, on the quantity . The smaller this quantity the faster the convergence. Thus for large and small the convergence may be slow. If is an integer then one of the series to be summed is of finite length.
If two tail probabilities are required then the relationship of the
-distribution to the
-distribution can be used:
and a call made to
g01gdf.
Note that g01gbf only allows degrees of freedom greater than or equal to although values between and are theoretically possible.
10
Example
This example reads values from, and degrees of freedom for, and noncentrality arguments of the noncentral Student's -distributions, calculates the lower tail probabilities and prints all these values until the end of data is reached.
10.1
Program Text
Program Text (g01gbfe.f90)
10.2
Program Data
Program Data (g01gbfe.d)
10.3
Program Results
Program Results (g01gbfe.r)