nonCentralTPdf

Evaluates the noncentral Student’s t probability density function.

Synopsis

nonCentralTPdf (t, df, delta)

Required Arguments

float t (Input)
Argument for which the noncentral Student’s t probability density function is to be evaluated.
float df (Input)
Number of degrees of freedom of the noncentral Student’s t distribution. df must be greater than 0.
float delta (Input)
Noncentrality parameter.

Return Value

The probability density associated with a noncentral Student’s t random variable with value t.

Description

If w is a normally distributed random variable with unit variance and mean δ and u is a chi-square random variable with ν degrees of freedom that is statistically independent of w, then

\[T = w / \sqrt{u/v}\]

is a noncentral t-distributed random variable with ν degrees of freedom and noncentrality parameter δ, that is,with ν = df, and δ = delta. The probability density function for the noncentral t-distribution is:

\[f(t|v,\delta) = \frac{v^{v/2} e^{-\delta^2/2}} {\sqrt{\pi}\mathit{\Gamma}(v/2)\left(v+t^2\right)^{(v+1)/2}} \sum_{i=0}^{\infty} \phi_i\]

where

\[\phi_i = \frac {\mathit{\Gamma}((v+i+1)/2)[\delta t]^i \left(2/\left(v+t^2\right)\right)^{i/2}} {i!}\]

and t = t.

For \(\delta=0\), the PDF reduces to the (central) Student’s t PDF:

\[f(t|v,0) = \frac {\mathit{\Gamma}((v+1)/2)\left(1+\left(t^2/v\right)\right)^{-(v+1)/2}} {\sqrt{v \pi} \mathit{\Gamma} (v/2)}\]

and, for \(t=0\), the PDF becomes:

\[f(0|v,\delta) = \frac {\mathit{\Gamma}((v+1)/2) e^{-\delta^2/2}} {\sqrt{v \pi} \mathit{\Gamma}(v/2)}\]

Example

This example calculates the noncentral Student’s t PDF for a distribution with 2 degrees of freedom and noncentrality parameter \(\delta=10\).

from __future__ import print_function
from pyimsl.stat.nonCentralTPdf import nonCentralTPdf

t = [-.5, 1.5, 3.5, 7.5, 51.5, 99.5]
df = 2.
delta = 10.

print("\n df: %4.0f;  delta: %4.0f\n" % (df, delta))
print("    t       pdf(t)")

for i in range(0, 6):
    pdfv = nonCentralTPdf(t[i], df, delta)
    print(" %5.1f  %12.4e" % (t[i], pdfv))

Output

 df:    2;  delta:   10

    t       pdf(t)
  -0.5    1.6399e-24
   1.5    7.4417e-10
   3.5    2.8972e-03
   7.5    7.8853e-02
  51.5    1.4215e-03
  99.5    2.0290e-04