F-distribution: add density-function (through HasDensity<Double>-interface)
---------------------------------------------------------------------------

                 Key: MATH-330
                 URL: https://issues.apache.org/jira/browse/MATH-330
             Project: Commons Math
          Issue Type: Improvement
            Reporter: Mikkel Meyer Andersen
            Priority: Minor


I've added the density function for the F-distribution.

Tested from R with:
> df(1, 1, 1)
[1] 0.1591549
> df(1, 5, 2)
[1] 0.3080008
> df(1, 100, 1)
[1] 0.2407659
> df(1, 50, 200)
[1] 1.777891

The result with this new density-function:
FDistributionImpl F1 = new FDistributionImpl(1, 1);
FDistributionImpl F2 = new FDistributionImpl(5, 2);
FDistributionImpl F3 = new FDistributionImpl(100, 1);
FDistributionImpl F4 = new FDistributionImpl(50, 200);

F1.density(1.0); // gives 0.1591549430918953
F2.density(1.0); // gives 0.308000821694066
F3.density(1.0); // gives 0.2407658969285279
F4.density(1.0); // gives 1.7778909151036544

Some numeric instability may occur because it's the log density that's 
calculated, and then the result is the exponential function applied to this 
result.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to