Stats distributions fishersnedecorpdf - CyrilB1531/lodestar GitHub Wiki

Home โ€บ Stats โ€บ Distribution tails

Distributions.FisherSnedecorPdf

The F density.

public static double FisherSnedecorPdf(double f, double numeratorDf, double denominatorDf)

Parameters โ€” f is the point; below zero the density is zero, NaN answers NaN, and +โˆž answers zero, the density's limit at every numerator, where scipy's formula forms โˆž/โˆž past two and answers NaN (decision 0010). numeratorDf and denominatorDf are the two degrees of freedom, each of which must be positive and finite.

Returns โ€” scipy.stats.f.pdf(f, dfn, dfd).

Exceptions โ€” ArgumentOutOfRangeException when either degrees of freedom is not positive, NaN included.

Example โ€” the density at one, for a model with two regressors and twenty residual degrees of freedom.

using Lodestar.Stats;

double atOne = Distributions.FisherSnedecorPdf(1.0, 2.0, 20.0);   // => 0.350493โ€ฆ

Remarks โ€” At zero the density follows the first shape as scipy's does: infinite when numeratorDf < 2, finite at 2, zero above. Where numeratorDf ยท f overflows it holds its digits, FisherSnedecorPdf(1e200, 1e200, 0.5) being 1.95e-251.

Past shapes of a million this is more exact than scipy's. The density reduces to y^a (1 โˆ’ y)^b / (B(a, b) f) with y = dโ‚f/(dโ‚f + dโ‚‚), both y and 1 โˆ’ y formed by division rather than one as one minus the other, and B from Stirling's series. scipy's own density is 5e-7 off at (1e8, 1e8) and 1e-5 at (1e10, 1) against a 60-digit reference, which this one holds to 1e-12.

Applies to โ€” net10.0, netstandard2.0.

See also โ€” Distributions.FisherSnedecorCdf, Distributions.FisherSnedecorSf.