non_central_beta_pdf
Evaluates the noncentral beta probability density function (PDF).
Synopsis
#include <imsls.h>
float imsls_f_non_central_beta_pdf (float x, float shape1, float shape2, float lambda)
The type double function is imsls_d_non_central_beta_pdf.
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 lambda (Input)
Noncentrality parameter. 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α1 degrees of freedom, and Y is a chi-square random variable with 2α2 degrees of freedom which is statistically independent of Z, then
is a noncentral beta-distributed random variable and
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:
where is a noncentral beta PDF with x = x, α1= shape1, α2 = shape2, and noncentrality parameter λ = lambda; is a noncentral F PDF with argument f, numerator and denominator degrees of freedom 2α1 and 2α2 respectively, and noncentrality parameter λ; and:
(See documentation for function imsls_f_non_central_F_pdf 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 lambda = 10.
#include <imsls.h>
#include <stdio.h>
int main()
{
int i;
float f[] = {0., .4, .8, 3.2, 5.6, 8.8, 14., 18.};
float x, shape1 = 50., shape2 = 5., lambda =10.;
float bpdfv, fpdfv, bpdfvexpect, dfdx;
printf ("shape1: %4.0f\n", shape1);
printf ("shape2: %4.0f\n", shape2);
printf ("lambda: %4.0f\n\n", lambda);
printf (" x ncbetpdf(x) ncbetpdf(x)\n");
printf (" expected\n");
for (i=0; i<8; i++) {
x = (shape1*f[i]) / (shape1*f[i] + shape2);
dfdx = (shape2/shape1) / ((1. - x) * (1. - x));
fpdfv = imsls_f_non_central_F_pdf
(f[i], 2.*shape1, 2.*shape2, lambda);
bpdfvexpect = dfdx * fpdfv;
bpdfv = imsls_f_non_central_beta_pdf
(x, shape1, shape2, lambda);
printf (" %8.4f %12.4e %12.4e\n",
x, bpdfvexpect, bpdfv);
}
}
Output
shape1: 50
shape2: 5
lambda: 10
x ncbetpdf(x) ncbetpdf(x)
expected
0.0000 0.0000e+000 0.0000e+000
0.8000 2.4372e-001 2.4372e-001
0.8889 6.5862e+000 6.5862e+000
0.9697 4.0237e+000 4.0237e+000
0.9825 9.1954e-001 9.1954e-001
0.9888 2.1910e-001 2.1910e-001
0.9929 4.3665e-002 4.3665e-002
0.9945 1.7522e-002 1.7522e-002