nonCentralBetaPdf

Evaluates the noncentral beta probability density function (PDF).

Synopsis

nonCentralBetaPdf (x, shape1, shape2, t_lambda)

Required Arguments

float x (Input)
Argument for which the noncentral beta probability density 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 density associated with a noncentral beta random variable with value 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 PDF for noncentral beta variable X can thus be simply defined in terms of the noncentral F PDF:

\[f_x\left(x|\alpha_1,\alpha_2,\lambda\right) = f_F\left(f|2\alpha_1,2\alpha_2,\lambda\right) \frac{df}{dx}\]

where \(f_x(x|\alpha_1,\alpha_2,\lambda)\) is a noncentral beta PDF with x = x, \(\alpha_1\) = shape1, \(\alpha_2\) = shape2, and noncentrality parameter λ = t_lambda; \(f_F \left( f | 2\alpha_1,2\alpha_2,\lambda\right)\) is a noncentral F PDF with argument f, numerator and denominator degrees of freedom \(2\alpha_1\) and \(2\alpha_2\) respectively, and noncentrality parameter λ; and:

\[\begin{split}\begin{array}{l} f = \frac{\alpha_2}{\alpha_1} \frac{x}{1-x};\phantom{...} x = \frac{\alpha_1 f}{\alpha_1 f + \alpha_2}; \\ \frac{df}{dx} = \frac{\left(\alpha_2 + \alpha_1 f\right)^2}{\alpha_1 \alpha_2} = \frac{\alpha_2}{\alpha_1} \frac{1}{(1-x)^2} \end{array}\end{split}\]

(See documentation for function nonCentralFPdf for a discussion of how the noncentral F PDF 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.nonCentralBetaPdf import nonCentralBetaPdf
from pyimsl.stat.nonCentralFPdf import nonCentralFPdf

f = [0., .4, .8, 3.2, 5.6, 8.8, 14., 18.]
shape1 = 50.
shape2 = 5.
lamb = 10.

print("shape1:   %4.0f" % (shape1))
print("shape2:   %4.0f" % (shape2))
print("lambda:   %4.0f" % (lamb))
print("    x         ncbetpdf      ncbetpdf")
print("              expected")

for i in range(0, 8):
    x = (shape1 * f[i]) / (shape1 * f[i] + shape2)
    dfdx = (shape2 / shape1) / ((1. - x) * (1. - x))
    fpdfv = nonCentralFPdf(f[i], 2. * shape1, 2. * shape2, lamb)
    bpdfvexpect = dfdx * fpdfv
    bpdfv = nonCentralBetaPdf(x, shape1, shape2, lamb)
    print(" %8.4f  %12.4e %12.4e" % (x, bpdfvexpect, bpdfv))

Output

shape1:     50
shape2:      5
lambda:     10
    x         ncbetpdf      ncbetpdf
              expected
   0.0000    0.0000e+00   0.0000e+00
   0.8000    2.4372e-01   2.4372e-01
   0.8889    6.5862e+00   6.5862e+00
   0.9697    4.0237e+00   4.0237e+00
   0.9825    9.1954e-01   9.1954e-01
   0.9888    2.1910e-01   2.1910e-01
   0.9929    4.3665e-02   4.3665e-02
   0.9945    1.7522e-02   1.7522e-02