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 org..
Uses the commons-math F Distribution implementation to estimate exact p-values.
This implementation is based on a description at http://faculty.vassar.edu/lowry/ch13pt1.html
Abbreviations: bg = between groups,
wg = within groups,
ss = sum squared deviations
| Modifier and Type | Class and Description |
|---|---|
| private static class | OneWayAnova.
Convenience class to pass dfbg,dfwg,F values around within OneWayAnova. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public double | Returns: FvalueCollection of double[]
arrays each containing data for one categoryComputes the ANOVA F-value for a collection of |
| public double | Returns: PvalueCollection of double[]
arrays each containing data for one categoryComputes the ANOVA P-value for a collection of |
| public double | Returns: PvalueCollection of SummaryStatistics
each containing data for one categoryif true, allow computation for one catagory
only or for one data element per category allowOneElementData)Computes the ANOVA P-value for a collection of |
| private OneWayAnova. | Returns: computed AnovaStatsCollection of double[] arrays each
containing data for one categoryThis method calls the method that actually does the calculations (except P-value). |
| private OneWayAnova. | Returns: computed AnovaStatsCollection of double[]
arrays each containing data for one categoryif true, allow computation for one catagory
only or for one data element per category allowOneElementData)This method actually does the calculations (except P-value). |
| public boolean | Returns: true if the null hypothesis can be rejected with confidence 1 - alphaCollection of double[]
arrays each containing data for one categorysignificance level of the test alpha)Performs an ANOVA test, evaluating the null hypothesis that there is no difference among the means of the data categories. |
| OneWayAnova | back to summary |
|---|---|
| public OneWayAnova() Default constructor. | |
| anovaFValue | back to summary |
|---|---|
| public double anovaFValue(final Collection<double[]> categoryData) throws NullArgumentException, DimensionMismatchException Computes the ANOVA F-value for a collection of Preconditions:
This implementation computes the F statistic using the definitional formula F = msbg/mswgwhere msbg = between group mean square mswg = within group mean squareare as defined here
| |
| anovaPValue | back to summary |
|---|---|
| public double anovaPValue(final Collection<double[]> categoryData) throws NullArgumentException, DimensionMismatchException, ConvergenceException, MaxCountExceededException Computes the ANOVA P-value for a collection of Preconditions:
This implementation uses the
p = 1 - cumulativeProbability(F)where F is the F value and cumulativeProbability
is the commons-math implementation of the F distribution.
| |
| anovaPValue | back to summary |
|---|---|
| public double anovaPValue(final Collection<SummaryStatistics> categoryData, final boolean allowOneElementData) throws NullArgumentException, DimensionMismatchException, ConvergenceException, MaxCountExceededException Computes the ANOVA P-value for a collection of Preconditions:
This implementation uses the
p = 1 - cumulativeProbability(F)where F is the F value and cumulativeProbability
is the commons-math implementation of the F distribution.
| |
| anovaStats | back to summary |
|---|---|
| private OneWayAnova. This method calls the method that actually does the calculations (except P-value).
| |
| anovaStats | back to summary |
|---|---|
| private OneWayAnova. This method actually does the calculations (except P-value).
| |
| anovaTest | back to summary |
|---|---|
| public boolean anovaTest(final Collection<double[]> categoryData, final double alpha) throws NullArgumentException, DimensionMismatchException, OutOfRangeException, ConvergenceException, MaxCountExceededException Performs an ANOVA test, evaluating the null hypothesis that there is no difference among the means of the data categories. Preconditions:
This implementation uses the
p = 1 - cumulativeProbability(F)where F is the F value and cumulativeProbability
is the commons-math implementation of the F distribution.
True is returned iff the estimated p-value is less than alpha.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int | dfbg
Degrees of freedom in numerator (between groups). |
| private final int | dfwg
Degrees of freedom in denominator (within groups). |
| private final double | F
Statistic. |
| Access | Constructor and Description |
|---|---|
| private | AnovaStats(int
degrees of freedom in numerator (between groups) dfbg, int degrees of freedom in denominator (within groups) dfwg, double statistic F)Constructor |
| dfbg | back to summary |
|---|---|
| private final int dfbg Degrees of freedom in numerator (between groups). | |
| dfwg | back to summary |
|---|---|
| private final int dfwg Degrees of freedom in denominator (within groups). | |
| F | back to summary |
|---|---|
| private final double F Statistic. | |
| AnovaStats | back to summary |
|---|---|
| private AnovaStats(int dfbg, int dfwg, double F) Constructor
| |