nonCentralBetaInverseCdf

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

Synopsis

nonCentralBetaInverseCdf (p, shape1, shape2, t_lambda)

Required Arguments

float p (Input)
Probability for which the inverse of the noncentral beta cumulative distribution function is to be evaluated. p must be non-negative and less than or equal to 1.
float shape1 (Input)
First shape parameter of the noncentral beta distribution. shape1 must be positive.
float shape2 (Input)
Second shape parameter of the noncentral beta distribution. shape2 must be positive.
float t_lambda (Input)
Noncentrality parameter. t_lambda must be non-negative.

Return Value

If the probability that a noncentral beta random variable takes a value less than or equal to x is p, then x is the return value of the noncentral beta inverse CDF evaluated at p.

Description

The noncentral beta distribution is a generalization of the beta distribution. If Z is a noncentral chi-square random variable with noncentrality parameter λ and \(2\alpha_1\) degrees of freedom, and Y is a chi‑square random variable with \(2\alpha_2\) degrees of freedom which is statistically independent of Z, then

\[X = \frac{Z}{Z+Y} = \frac{\alpha_1 F}{\alpha_1 F + \alpha_2}\]

is a noncentral beta-distributed random variable and

\[F = \frac{\alpha_2 Z}{\alpha_1 Y} = \frac{\alpha_2 X}{\alpha_1 (1-X)}\]

is a noncentral F-distributed random variable. The CDF for noncentral beta variable X can thus be simply defined in terms of the noncentral F CDF:

\[p = F_x\left(x|\alpha_1,\alpha_2,\lambda\right) = F_F\left(f|2\alpha_1,2\alpha_2,\lambda\right)\]

where \(F_x(x | \alpha_1,\alpha_2,\lambda)\) is a noncentral beta CDF with x = x, \(\alpha_1\) = shape1, \(\alpha_2\) = shape2, and noncentrality parameter λ = t_lambda; \(F_F(f | 2\alpha_1,2\alpha_2,\lambda)\) is a noncentral F CDF with argument f , numerator and denominator degrees of freedom \(2\alpha_1\) and \(2\alpha_2\) respectively, and noncentrality parameter λ; p = the probability that \(F<f\) = the probability that \(X< x\); and

\[f = \frac{\alpha_2}{\alpha_1} \frac{x}{1-x};\phantom{...} x = \frac{\alpha_1 f}{\alpha_1 f + \alpha_2}\]

(See documentation for function nonCentralFCdf for a discussion of how the noncentral F CDF is defined and calculated.) The correspondence between the arguments of function nonCentralBetaInverseCdf and the variables in the above equations is as follows: \(\alpha_1\) = shape1, \(\alpha_2\) = shape2, λ = t_lambda, and p = p.

Function nonCentralBetaInverseCdf evaluates

\[x = F_x^{-1}\left(p|\alpha_1,\alpha_2,\lambda\right)\]

by first evaluating

\[f = F_F^{-1}\left(p|2\alpha_1,2\alpha_2,\lambda\right)\]

and then solving for x using

\[x = \frac{\alpha_1 f}{\alpha_1 f + \alpha_2}\]

(See documentation for function nonCentralFInverseCdf for a discussion of how the inverse noncentral F CDF is calculated.)

Example

This example traces out a portion of an inverse noncentral beta distribution with parameters shape1 = 50, shape2 = 5, and t_lambda = 10.

from __future__ import print_function
from numpy import *
from pyimsl.stat.nonCentralBetaCdf import nonCentralBetaCdf
from pyimsl.stat.nonCentralBetaInverseCdf import nonCentralBetaInverseCdf

f = [0., .4, .8, 1.2, 1.6, 2.0, 2.8, 4.0]
shape1 = 50.
shape2 = 5.
lamb = 10.

print("shape1:   %4.0f" % (shape1))
print("shape2:   %4.0f" % (shape2))
print("lambda:   %4.0f" % (lamb))
print("       x          p = cdf(x     cdfinv(p)")

for i in range(0, 8):
    x = (shape1 * f[i]) / (shape1 * f[i] + shape2)
    p = nonCentralBetaCdf(x, shape1, shape2, lamb)
    bcdfinv = nonCentralBetaInverseCdf(p, shape1, shape2, lamb)
    print(" %12.4e  %12.4e  %12.4e" % (x, p, bcdfinv))

Output

shape1:     50
shape2:      5
lambda:     10
       x          p = cdf(x     cdfinv(p)
   0.0000e+00    0.0000e+00    0.0000e+00
   8.0000e-01    4.8879e-03    8.0000e-01
   8.8889e-01    2.0263e-01    8.8889e-01
   9.2308e-01    5.2114e-01    9.2308e-01
   9.4118e-01    7.3385e-01    9.4118e-01
   9.5238e-01    8.5041e-01    9.5238e-01
   9.6552e-01    9.4713e-01    9.6552e-01
   9.7561e-01    9.8536e-01    9.7561e-01