flignerKilleenTest

Performs the Fligner-Killeen test for equality of variances across two or more groups.

The null hypothesis is that all groups have equal variances (homoscedasticity). This is a non-parametric test that computes absolute deviations from group medians, ranks them across all groups, transforms the ranks to normal scores, and then tests whether the group mean scores differ. It is the most robust of the three variance homogeneity tests in kstats (along with leveneTest and bartlettTest), especially for data from heavy-tailed distributions. The test statistic follows a chi-squared distribution with k - 1 degrees of freedom under the null hypothesis.

Example:

val g1 = doubleArrayOf(10.0, 11.0, 12.0, 9.0, 10.0)
val g2 = doubleArrayOf(5.0, 15.0, 10.0, 20.0, 0.0)
val result = flignerKilleenTest(g1, g2)
result.statistic // chi-squared test statistic
result.pValue // p-value from chi-squared distribution
result.degreesOfFreedom // k - 1

Return

a TestResult containing the chi-squared statistic, p-value, and degrees of freedom (k - 1).

Parameters

groups

two or more groups of observations, each with at least 2 elements.