Class OneWayAnova
- java.lang.Object
-
- org.apache.commons.statistics.inference.OneWayAnova
-
public final class OneWayAnova extends Object
Implements one-way ANOVA (analysis of variance) statistics.Tests for differences between two or more categories of univariate data (for example, the body mass index of accountants, lawyers, doctors and computer programmers). When two categories are given, this is equivalent to the
TTest
.This implementation computes the F statistic using the definitional formula:
\[ F = \frac{\text{between-group variability}}{\text{within-group variability}} \]
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OneWayAnova.Result
Result for the one-way ANOVA.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
statistic(Collection<double[]> data)
Computes the F statistic for an ANOVA test for a collection of category data, evaluating the null hypothesis that there is no difference among the means of the data categories.OneWayAnova.Result
test(Collection<double[]> data)
Performs an ANOVA test for a collection of category data, evaluating the null hypothesis that there is no difference among the means of the data categories.static OneWayAnova
withDefaults()
Return an instance using the default options.
-
-
-
Method Detail
-
withDefaults
public static OneWayAnova withDefaults()
Return an instance using the default options.- Returns:
- default instance
-
statistic
public double statistic(Collection<double[]> data)
Computes the F statistic for an ANOVA test for a collection of category data, evaluating the null hypothesis that there is no difference among the means of the data categories.Special cases:
- Parameters:
data
- Category summary data.- Returns:
- F statistic
- Throws:
IllegalArgumentException
- if the number of categories is less than two; a contained category does not have at least one value; or all categories have only one value (zero degrees of freedom within groups)
-
test
public OneWayAnova.Result test(Collection<double[]> data)
Performs an ANOVA test for a collection of category data, evaluating the null hypothesis that there is no difference among the means of the data categories.Special cases:
- Parameters:
data
- Category summary data.- Returns:
- test result
- Throws:
IllegalArgumentException
- if the number of categories is less than two; a contained category does not have at least one value; or all categories have only one value (zero degrees of freedom within groups)
-
-