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.

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.

alias central = median


1 int[] sample1 = [1,2,3,4,5];
2 int[] sample2 = [100,200,300,400,500];
3 auto result = levenesTest(sample1, sample2);
5 // Clearly the variances are different between these two samples.
6 assert( approxEqual(result.testStat, 10.08));
7 assert( approxEqual(result.p, 0.01310));