nonCentralFInverseCdf

Evaluates the inverse of the noncentral F cumulative distribution function (CDF).

Synopsis

nonCentralFInverseCdf (p, dfNumerator, dfDenominator, t_lambda)

Required Arguments

float p (Input)
Probability for which the inverse of the noncentral F cumulative distribution function is to be evaluated. p must be non-negative and less than one.
float dfNumerator (Input)
Numerator degrees of freedom of the noncentral F distribution. dfNumerator must be positive.
float dfDenominator (Input)
Denominator degrees of freedom of the noncentral F distribution. dfDenominator must be positive.
float t_lambda (Input)
Noncentrality parameter. t_lambda must be non-negative.

Return Value

The inverse of the noncentral F distribution function evaluated at p. The probability that a noncentral F random variable takes a value less than or equal to nonCentralFInverseCdf is p.

Description

If X is a noncentral chi-square random variable with noncentrality parameter λ and ν1 degrees of freedom, and Y is a chi-square random variable with ν2 degrees of freedom that is statistically independent of X, then

F=(X/ν1)/(Y/ν2)

is a noncentral F-distributed random variable whose cumulative distribution function p=CDF(f,ν1,ν2,λ) is defined as the probability p that Ff and is evaluated using function nonCentralFCdf (f, dfNumerator, dfDenominator, t_lambda), where ν1 = dfNumerator, ν2 = dfDenominator, λ = t_lambda, and p = p.

Function nonCentralFInverseCdf evaluates

f=CDF1(p|ν1,ν1,λ)

Function nonCentralFInverseCdf uses bisection and modified regula falsi search algorithms to invert the distribution function CDF(f|ν1,ν2,λ). For sufficiently small p, an accurate approximation of CDF1(p|ν1,ν2,λ) can be used which requires no such inverse search algorithms.

Example

This example traces out a portion of a noncentral F cumulative distribution function with parameters dfNumerator = 100, dfDenominator = 10, and t_lambda = 10 and for each value of f prints f, p==CDF(f), and CDF1(p).

from __future__ import print_function
from numpy import *
from pyimsl.stat.nonCentralFCdf import nonCentralFCdf
from pyimsl.stat.nonCentralFInverseCdf import nonCentralFInverseCdf

f = [0., .4, .8, 1.2, 1.6, 2.0, 2.8, 4.0]
df_numerator = 100.
df_denominator = 10.
lamb = 10.

print("df_numerator:   %4.0f" % (df_numerator))
print("df_denominator: %4.0f" % (df_denominator))
print("lambda:         %4.0f\n" % (lamb))
print("    f     p = cdf(f)   cdfinv(p)\n")

for i in range(0, 8):
    cdfv = nonCentralFCdf(f[i], df_numerator, df_denominator, lamb)
    cdfiv = nonCentralFInverseCdf(cdfv, df_numerator, df_denominator, lamb)
    print(" %5.1f  %12.4e %7.3f" % (f[i], cdfv, cdfiv))

Output

df_numerator:    100
df_denominator:   10
lambda:           10

    f     p = cdf(f)   cdfinv(p)

   0.0    0.0000e+00   0.000
   0.4    4.8879e-03   0.400
   0.8    2.0263e-01   0.800
   1.2    5.2114e-01   1.200
   1.6    7.3385e-01   1.600
   2.0    8.5041e-01   2.000
   2.8    9.4713e-01   2.800
   4.0    9.8536e-01   4.000