Class AnovaTest

java.lang.Object
cloud.opencode.base.math.stats.inference.AnovaTest

public final class AnovaTest extends Object
One-way Analysis of Variance (ANOVA) F-test implementation. 单因素方差分析(ANOVA)F 检验实现

Tests whether the means of two or more groups are equal. Returns a TestResult with the F-statistic and p-value from the F-distribution.

检验两个或多个组的均值是否相等。 返回包含 F 统计量和来自 F 分布 p 值的 TestResult

All methods are stateless and thread-safe.

所有方法无状态且线程安全。

Since:
JDK 25, opencode-base-math V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • oneWay

      public static TestResult oneWay(double[]... groups)
      Performs a one-way ANOVA F-test. 执行单因素方差分析 F 检验

      H0: all group means are equal. H1: at least one group mean differs.

      H0: 所有组均值相等。H1: 至少一个组均值不同。

      F = MSB / MSW where MSB = SSB / (k-1) and MSW = SSW / (N-k). p-value is computed from the F-distribution with df1 = k-1 and df2 = N-k.

      F = MSB / MSW,其中 MSB = SSB / (k-1),MSW = SSW / (N-k)。 p 值由 df1 = k-1、df2 = N-k 的 F 分布计算。

      Parameters:
      groups - two or more groups, each with at least 2 elements / 两个或更多组,每组至少 2 个元素
      Returns:
      the test result / 检验结果
      Throws:
      MathException - if fewer than 2 groups, any group has fewer than 2 elements, or data contains NaN/Infinity