Function levenesTest

Tests the null hypothesis that the variances of all groups are equal against the alternative that heteroscedasticity exists. data must be either a tuple of ranges or a range of ranges. central is an alias for the measure of central tendency to be used. This can be any function that maps a forward range of numeric types to a numeric type. The commonly used ones are median (default) and mean (less robust). Trimmed mean is sometimes useful, but is currently not implemented in dstats.summary.

TestRes levenesTest(alias central, T...) (
  T data
);

References

Levene, Howard (1960). "Robust tests for equality of variances". in Ingram Olkin, Harold Hotelling et al. Contributions to Probability and Statistics: Essays in Honor of Harold Hotelling. Stanford University Press. pp. 278-292.

Examples

int[] sample1 = [1,2,3,4,5];
int[] sample2 = [100,200,300,400,500];
auto result = levenesTest(sample1, sample2);

// Clearly the variances are different between these two samples.
assert( approxEqual(result.testStat, 10.08));
assert( approxEqual(result.p, 0.01310));