I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 3.74
sub units 6.12
+
0
MathsSpecialGamma

beta reg

viewed 1945 times and licensed 121 times
The regularized incomplete Beta integral
Controller: CodeCogs

Dependents

Info

Interface

C++
Excel

Overview

These function compute the regularized incomplete beta integral of the arguments, evaluated from zero to x. This is occasionally also called the beta function ratio, given that it returns the probability that a random variable drawn from a beta distribution with parameters a and b will be less that or equal to x.

This ratio (or regularization) function is calculated by dividing the incomplete beta integral by the complete beta integral, i.e.

If the incomplete beta integral is defined by: and the complete beta integral is defined by: where \inline  \Gamma is the Maths/Special/Gamma/Gamma function.

Therefore the regularized beta integral is: where \inline B_x(a,b).

All the functions are only valid in the range 0 <= x <= 1. In this implementation a and b are restricted to positive values.

The integral from x to 1 may be obtained by the symmetry relation, i.e.
1 - beta_reg( x, a, b )  =  beta_reg( 1-x, a, b ).

Example:

The following example evaluates the upper regularized incomplete beta integral for 10 points equally spaced in the interval from 0 to 1.
#include <stdio.h>
#include <codecogs/maths/special/gamma/beta_reg.h>
void main()
{
  for (double x=0; x<1; x+=0.1)
  {
    double y = Maths::Special::Gamma::beta_reg(x, 2, 1, true);
    printf("beta_reg(2, %.1lf, 1, true) = %lf\n", x,y);
  }
}
Output:
beta_reg(2, 0.0, 1, true) = 1.000000
beta_reg(2, 0.1, 1, true) = 0.990000
beta_reg(2, 0.2, 1, true) = 0.960000
beta_reg(2, 0.3, 1, true) = 0.910000
beta_reg(2, 0.4, 1, true) = 0.840000
beta_reg(2, 0.5, 1, true) = 0.750000
beta_reg(2, 0.6, 1, true) = 0.640000
beta_reg(2, 0.7, 1, true) = 0.510000
beta_reg(2, 0.8, 1, true) = 0.360000
beta_reg(2, 0.9, 1, true) = 0.190000
beta_reg(2, 1.0, 1, true) = 0.000000

Fraction Exp

 
doublefraction_expdoublex
doublea
doubleb
boolinverse = false )
Computes using continued fraction expansion that main term need to compute the incomplete Beta integral at the extremes.

Methodolgy

Parameters

xupper limit of integration. (0<x<1)
afirst shape argument, must be positive.
bsecond shape argument, must be positive.
inversecomputes the fraction expansion \inline  x/(1-x)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.


BetaLower Reg Pow

 
doublebetaLower_reg_powdoublex
doublea
doubleb )
Power series for the regularized incomplete beta integral,\inline B_x(a,b), Use when \inline  b x is little and x is not too close to 1.

Parameters

xupper limit of integration (0<x<1)
afirst shape argument, must be positive
bsecond shape argument, must be positive

Authors

Stephen L.Moshier. Copyright 1984, 1987, 1989, 1992, 2000
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.


Beta Reg

 
doublebeta_regdoublex
doublea
doubleb
boolupper = false )
Computes the regularize beta integral using a variety of method depending on the input values:
  • When b*x<=1 and x<0.95 then the function is calculated using the power series expansion defined in betaLower_reg_pow.
  • If x is greater than the mean of the beta function, i.e. Then the values of a and b are reversed and the calculation proceeds as before only with x=1-x.
  • A second attempt is then made to use the power series expansion within the range b*x<=1 and x<0.95.
  • Failing this a fractional expansion is used within the tails of this function.

Parameters

xthe value at which to evaluate the function, must be in range 0..1
athe 1st number of degrees of freedom, must be strictly positive
bthe 2nd number of degrees of freedom, must be strictly positive
upperDefault value = false

Authors

Stephen L.Moshier. Copyright 1984, 1987, 1989, 1992, 2000
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.