Stats fligner test - CyrilB1531/lodestar GitHub Wiki
Development build. This page describes
main, not a released package. The latest published Lodestar.Stats is 0.5.0 โ read its documentation.
Home โบ Stats โบ Hypothesis tests
Fligner.Test
Compares the spread of two or more groups, scipy.stats.fligner.
public static TestResult Test(double[][] groups)
public static TestResult Test(Center center, double proportionToCut, NanPolicy nanPolicy, double[][] groups)
The centre and the policy come first because the groups are a params array, as for
Levene.Test.
Parameters โ groups are the samples, at least two. center is which centre each group's
deviations are measured from, Center.Median by default as scipy's.
proportionToCut is how much of each end Center.Trimmed drops, 0.05 by default.
nanPolicy is scipy's nan_policy, NanPolicy.Propagate by default.
Returns โ TestResult: the ฯยฒ statistic and its upper-tail p-value on k โ 1 degrees of
freedom. Both are NaN where a group is empty, whatever the trim's size, an infinite value meets an
infinite centre, or a NaN propagates, as scipy answers; and where every deviation ties, which
leaves the scores no variance โ 0/0, where scipy's rounding answers NaN or a finite value by
the groups (decision 0010).
Exceptions โ ArgumentException when there are fewer than two groups, or nanPolicy is
NanPolicy.Raise and a group holds a NaN. ArgumentOutOfRangeException
when proportionToCut is NaN under Center.Trimmed, beside an empty group too, as an
option outside its enumeration is, where scipy answers NaN there; and, where a centre is taken,
when it cuts a count below zero or past a group's middle, as scipy refuses them; one that trims a group to nothing answers NaN. ArgumentOutOfRangeException when an option is outside its enumeration.
Example โ the three bottling machines Levene.Test compares, by ranks.
using Lodestar.Stats;
double[] first = [20.1, 19.8, 20.3, 20.0, 19.9, 20.2, 20.1, 19.7];
double[] second = [20.4, 18.9, 21.2, 19.1, 21.0, 18.7, 20.8, 19.4];
double[] third = [20.0, 20.1, 19.9, 20.2, 19.8, 20.1, 20.0, 19.9];
TestResult result = Fligner.Test(first, second, third);
double statistic = Math.Round(result.Statistic, 6); // => 16.66687
double pValue = Math.Round(result.PValue, 8); // => 0.00024035
Remarks โ the deviations are ranked across every group together, and each rank r becomes the
normal score ฮฆโปยน(r / (2(N + 1)) + 1/2); the statistic compares the groups' mean scores. The
centre is the median by default, as for Levene's test, and scipy's proportiontocut trims by the
same truncating rule.
Applies to โ net10.0, netstandard2.0.
See also โ Levene.Test, Bartlett.Test,
Center.