g01 Chapter Contents
g01 Chapter Introduction
NAG C Library Manual

NAG Library Function Documentnag_prob_non_central_students_t (g01gbc)

1  Purpose

nag_prob_non_central_students_t (g01gbc) returns the lower tail probability for the noncentral Student's $t$-distribution.

2  Specification

 #include #include
 double nag_prob_non_central_students_t (double t, double df, double delta, double tol, Integer max_iter, NagError *fail)

3  Description

The lower tail probability of the noncentral Student's $t$-distribution with $\nu$ degrees of freedom and noncentrality parameter $\delta$, $P\left(T\le t:\nu \text{;}\delta \right)$, is defined by
 $PT≤t:ν;δ=Cν∫0∞ 12π∫-∞ αu-δe-x2/2dx uν-1e-u2/2du, ν>0.0$
with
 $Cν=1Γ 12ν 2ν- 2/2 , α=tν.$
The probability is computed in one of two ways.
(i) When $t=0.0$, the relationship to the normal is used:
 $PT≤t:ν;δ=12π∫δ∞e-u2/2du.$
(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 $t$-distributions Biometrika 51 451–458

5  Arguments

1:     tdoubleInput
On entry: $t$, the deviate from the Student's $t$-distribution with $\nu$ degrees of freedom.
2:     dfdoubleInput
On entry: $\nu$, the degrees of freedom of the Student's $t$-distribution.
Constraint: ${\mathbf{df}}\ge 1.0$.
On entry: $\delta$, the noncentrality argument of the Students $t$-distribution.
4:     toldoubleInput
On entry: the absolute accuracy required by you in the results. If nag_prob_non_central_students_t (g01gbc) is entered with tol greater than or equal to $1.0$ or less than  (see nag_machine_precision (X02AJC)), then the value of  is used instead.
5:     max_iterIntegerInput
On entry: the maximum number of terms that are used in each of the summations.
Suggested value: $100$. See Section 8 for further comments.
Constraint: ${\mathbf{max_iter}}\ge 1$.
6:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_INT_ARG_LT
On entry, ${\mathbf{max_iter}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{max_iter}}\ge 1$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_PROB_LIMIT
The probability is too close to $0$ or $1$.
NE_PROBABILITY
The probability is too small to calculate accurately.
NE_REAL_ARG_LT
On entry, ${\mathbf{df}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{df}}\ge 1.0$.
NE_SERIES
One of the series has failed to converge with ${\mathbf{max_iter}}=〈\mathit{\text{value}}〉$ and ${\mathbf{tol}}=〈\mathit{\text{value}}〉$. Reconsider the requested tolerance and/or the maximum number of iterations.

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.

The rate of convergence of the series depends, in part, on the quantity ${t}^{2}/\left({t}^{2}+\nu \right)$. The smaller this quantity the faster the convergence. Thus for large $t$ and small $\nu$ the convergence may be slow. If $\nu$ 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 $t$-distribution to the $F$-distribution can be used:
 $F=T2,λ=δ2,ν1=1 and ν2=ν,$
and a call made to nag_prob_non_central_f_dist (g01gdc).
Note that nag_prob_non_central_students_t (g01gbc) only allows degrees of freedom greater than or equal to $1$ although values between $0$ and $1$ are theoretically possible.

9  Example

This example reads values from, and degrees of freedom for, and noncentrality arguments of the noncentral Student's $t$-distributions, calculates the lower tail probabilities and prints all these values until the end of data is reached.

9.1  Program Text

Program Text (g01gbce.c)

9.2  Program Data

Program Data (g01gbce.d)

9.3  Program Results

Program Results (g01gbce.r)