oneWayAnova
Performs a one-way analysis of variance (ANOVA) test.
The null hypothesis is that all group means are equal. ANOVA partitions the total variation in the data into variation between groups and variation within groups, then compares these using an F-test. A significant result indicates that at least one group mean differs from the others, but does not identify which one.
Example:
val group1 = doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0)
val group2 = doubleArrayOf(6.0, 7.0, 8.0, 9.0, 10.0)
val group3 = doubleArrayOf(11.0, 12.0, 13.0, 14.0, 15.0)
val result = oneWayAnova(group1, group2, group3)
result.fStatistic // F-statistic
result.pValue // p-value (< 0.001 for clearly different groups)
result.dfBetween // 2 (three groups minus one)
result.dfWithin // 12 (fifteen observations minus three groups)Content copied to clipboard
Return
an AnovaResult containing the F-statistic, p-value, and the full ANOVA table decomposition (degrees of freedom, sums of squares, mean squares).
Parameters
groups
two or more groups of observations, each with at least 2 elements.