Skip to main content

F-distribution

Name

UxHwDoubleFDist, UxHwFloatFDist Create an F-distribution.

Synopsis

#include <uxhw.h>

double UxHwDoubleFDist(double d1, double d2);
float UxHwFloatFDist(float d1, float d2);

Description

The UxHwDoubleFDist() function, on architectures that associate distributional information with floating-point values, creates an F distribution with parameters d1 and d2 and associates it with its return value. The particle return value is the mean value of an F-distribution with parameters d1 and d2. The probability density function of the F-distribution is

f(x;d1,d2)={f(x)=1B(d12,d22)(d1d2)d12xd121(1+d1d2x)d1+d22x0,0x<0.f(x;d_1,d_2)= \begin{cases} f(x) = \frac{1}{B\left(\frac{d_1}{2},\frac{d_2}{2}\right)} \left(\frac{d_1}{d_2}\right)^{\frac{d_1}{2}} x^{\frac{d_1}{2} - 1} \left(1+\frac{d_1}{d_2} \, x \right)^{-\frac{d_1+d_2}{2}} & x\ge 0, \\ 0 & x < 0. \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

  • d1 The parameter (d1d_1) of the F-distribution.
  • d2 The parameter (d2d_2) of the F-distribution.

Return Values

The UxHwDoubleFDist() function returns the mean of samples of a F-distribution with parameters d1 and d2. If d1<=0or d2<=2, the function returns NaN.

  Examples

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

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

return 0;
}