nonCentralFPdf¶
Evaluates the noncentral F probability density function (PDF).
Synopsis¶
nonCentralFPdf (f, dfNumerator, dfDenominator, t_lambda)
Required Arguments¶
- float
f
(Input) - Argument for which the noncentral F probability density function is to be evaluated. f must be non-negative.
- 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_ambda
must be non-negative.
Return Value¶
The probability density associated with a noncentral F random variable
with value f
.
Description¶
If X is a noncentral chi-square random variable with noncentrality parameter λ and \(\nu_1\) degrees of freedom, and Y is a chi-square random variable with \(\nu_2\) degrees of freedom which is statistically independent of X, then
is a noncentral F-distributed random variable whose PDF is given by
where
and \(\Gamma(\cdot)\) is the gamma function, \(\nu_1\) =
dfNumerator
, \(\nu_2\) = dfDenominator
, λ= t_lambda
, and f
= f
.
With a noncentrality parameter of zero, the noncentral F distribution is the same as the F distribution.
The efficiency of the calculation of the above series is enhanced by:
- calculating each term \(\Phi_k\) in the series recursively in terms of either the term \(\Phi_{k-1}\) preceding it or the term \(\Phi_{k+1}\) following it, and.
- initializing the sum with the largest series term and adding the subsequent terms in order of decreasing magnitude
Special cases:
Example¶
This example traces out a portion of a noncentral F distribution with
parameters dfNumerator
= 100, dfDenominator
= 10, and t_lambda
=
10.
from __future__ import print_function
from numpy import *
from pyimsl.stat.nonCentralFPdf import nonCentralFPdf
f = [0., .4, .8, 3.2, 5.6, 8.8, 14., 18.]
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 pdf(f)")
for i in range(0, 8):
pdfv = nonCentralFPdf(f[i], df_numerator, df_denominator, lamb)
print(" %5.1f %12.4e" % (f[i], pdfv))
Output¶
df_numerator: 100
df_denominator: 10
lambda: 10
f pdf(f)
0.0 0.0000e+00
0.4 9.7488e-02
0.8 8.1312e-01
3.2 3.6948e-02
5.6 2.8302e-03
8.8 2.7661e-04
14.0 2.1963e-05
18.0 5.3483e-06