nonCentralBetaCdf

Evaluates the noncentral beta cumulative distribution function (CDF).

Synopsis

nonCentralBetaCdf (x, shape1, shape2, t_lambda)

Required Arguments

float x (Input)
Argument for which the noncentral beta cumulative distribution function is to be evaluated. x 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

The probability that a noncentral beta random variable takes a value less than or equal to x.

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

\[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 λ; 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.)

With a noncentrality parameter of zero, the noncentral beta distribution is the same as the beta distribution.

Example

This example traces out a portion of a 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.nonCentralFCdf import nonCentralFCdf

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         ncbetcdf      ncbetcdf")
print("              expected")

for i in range(0, 8):
    x = (shape1 * f[i]) / (shape1 * f[i] + shape2)
    fcdfv = nonCentralFCdf(f[i], 2. * shape1, 2. * shape2, lamb)
    bcdfvexpect = fcdfv
    bcdfv = nonCentralBetaCdf(x, shape1, shape2, lamb)
    print(" %8.4f  %12.4e %12.4e" % (x, bcdfvexpect, bcdfv))

Output

shape1:     50
shape2:      5
lambda:     10
    x         ncbetcdf      ncbetcdf
              expected
   0.0000    0.0000e+00   0.0000e+00
   0.8000    4.8879e-03   4.8879e-03
   0.8889    2.0263e-01   2.0263e-01
   0.9231    5.2114e-01   5.2114e-01
   0.9412    7.3385e-01   7.3385e-01
   0.9524    8.5041e-01   8.5041e-01
   0.9655    9.4713e-01   9.4713e-01
   0.9756    9.8536e-01   9.8536e-01