tCdf

Evaluates the Student’s t cumulative distribution function (CDF).

Synopsis

tCdf (t, df)

Required Arguments

float t (Input)
Argument for which the Student’s t cumulative distribution function is to be evaluated.
float df (Input)
Degrees of freedom. Argument df must be greater than or equal to 1.0.

Return Value

The probability that a Student’s t random variable takes a value less than or equal to the input t.

Description

Function tCdf evaluates the cumulative distribution function of a Student’s t random variable with ν = df degrees of freedom. If \(t^2\geq\nu\), the following identity relating the Student’s t cumulative distribution function, \(F(t,\nu)\) to the incomplete beta ratio function \(I_x (a,b)\) is used:

\[F(t|\nu) = \frac{1}{2} I_x \left(\frac{\nu}{2},\frac{1}{2}\right), t \leq 0, t^2 \geq \nu\]

where

\[x = \frac{v}{t^2+v}\]

and

\[F(t|\nu) = 1 - F(-t,\nu), t> 0, t^2 \geq \nu\]

If \(t^2<\nu\), the solution space is partitioned into four algorithms as follows: If \(\nu\geq 64\) and \(t^2/\nu\leq 0.1\), a Cornish-Fisher expansion is used to evaluate the distribution function. If \(\nu<64\) and an integer and \(|t|<2.0\), a trigonometric series is used (see Abramowitz and Stegun 1964, Equations 26.7.3 and 26.7.4 with some rearrangement). If \(\nu<64\) and an integer and \(|t|\geq 2.0\), a series given by Hill (1970) that converges well for large values of t is used. For the remaining \(t^2<\nu\) cases, \(F(t|\nu)\) is calculated using the identity:

\[F(t|\nu) = I_x \left(\frac{\nu}{2},\frac{\nu}{2}\right)\]

where

\[x = \frac{t + \sqrt{t^2 + \nu}}{2 \sqrt{t^2 + \nu}}\]
../../_images/csch11-figure9.png

Figure 11.9 — Plot of \(F_t(t,6.0)\)

Example

This example finds the probability that a t random variable with 6 degrees of freedom is greater in absolute value than 2.447. The fact that t is symmetric about 0 is used.

from __future__ import print_function
from numpy import *
from pyimsl.stat.tCdf import tCdf

t = 2.447
df = 6.0
pr = 2 * tCdf(-t, df)
print("Pr(|t(6)| > 2.447) = %6.4f\n" % pr)

Output

Pr(|t(6)| > 2.447) = 0.0500