Skip to main content

Beta Distribution

Name

UxHwDoubleBetaDist, UxHwFloatBetaDist Create a Beta distribution.

Synopsis

#include <uxhw.h>

double UxHwDoubleBetaDist(double a, double b);
float UxHwFloatBetaDist(float a, float b);

Description

The UxHwDoubleBetaDist() function, on architectures that associate distributional information with floating-point values, creates a Beta distribution with parameters a and b and associates it with its return value. The particle return value is the mean value of a Beta distribution with parameters a and b. The probability density function of the Beta distribution is

f(x;a,b)={xa1(1x)b1B(a,b)x[0,1],0else.f(x;a,b)= \begin{cases} \frac{x^{a-1} (1-x)^{b-1}}{B(a,b)} & x\in [0,1], \\ 0 & \mathrm{else}. \end{cases}

where B(a,b)=Γ(a)Γ(b)Γ(a+b)B(a,b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)} is the Beta function and Γ\Gamma is the Gamma function.

Parameters

  • a The shape parameter (aa) of the Beta distribution.
  • b The shape parameter (bb) of the Beta distribution.

Return Values

The UxHwDoubleBetaDist() function returns the mean of samples of a Beta distribution with parameter a and b. If a <= 0 or b <= 0 , the function returns NaN.

  Examples

#include <stdio.h>
#include <uxhw.h>

int
main(void)
{
double value = UxHwDoubleBetaDist(1.0,2.0);
printf("value = %lf\n", value);

return 0;
}