Class TwoSampleTTest
java.lang.Object
org.moeaframework.util.statistics.IntervalRatioStatisticalTest
org.moeaframework.util.statistics.TwoSampleTTest
- All Implemented Interfaces:
StatisticalTest
The Two-Sample t test determines if the mean of two populations are different. The independent flag in the
constructor is used to choose between the unpaired (independent) and paired (dependent) test.
- Null Hypothesis: The two population means are equal.
- Alternative Hypothesis: The two population means are not equal.
Assumptions:
- Samples are randomly selected from the corresponding population
- The distribution of the underlying populations is normal
References:
- Sheskin, D.J. "Handbook of Parametric and Nonparametric Statistical Procedures, Third Edition." Chapman & Hall/CRC. 2004.
-
Field Summary
Fields inherited from class org.moeaframework.util.statistics.IntervalRatioStatisticalTest
data, numberOfGroups
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double value, int group) Adds a new observation with the specified value and group.void
addAll
(double[] values, int group) Adds several new observations to the specified group.org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
getStatistics
(int group) Returns the descriptive statistics for the given group.boolean
test
(double alpha) Returnstrue
if the null hypothesis is rejected;false
otherwise.Methods inherited from class org.moeaframework.util.statistics.IntervalRatioStatisticalTest
categorize, getNumberOfGroups
-
Constructor Details
-
TwoSampleTTest
public TwoSampleTTest(boolean independent) Constructs a two sample T test.- Parameters:
independent
- uses the unpaired T test iftrue
; the paired T test iffalse
-
-
Method Details
-
add
public void add(double value, int group) Description copied from class:IntervalRatioStatisticalTest
Adds a new observation with the specified value and group.- Overrides:
add
in classIntervalRatioStatisticalTest
- Parameters:
value
- the value of the new observationgroup
- the group to which the new observation belongs
-
addAll
public void addAll(double[] values, int group) Description copied from class:IntervalRatioStatisticalTest
Adds several new observations to the specified group.- Overrides:
addAll
in classIntervalRatioStatisticalTest
- Parameters:
values
- the values of the new observationsgroup
- the group to which the new observations belong
-
getStatistics
public org.apache.commons.math3.stat.descriptive.DescriptiveStatistics getStatistics(int group) Description copied from class:IntervalRatioStatisticalTest
Returns the descriptive statistics for the given group.- Overrides:
getStatistics
in classIntervalRatioStatisticalTest
- Parameters:
group
- the group- Returns:
- the descriptive statistics
-
test
public boolean test(double alpha) Returnstrue
if the null hypothesis is rejected;false
otherwise. The meaning of the null hypothesis and alternative hypothesis depends on the specific test.The prespecified level of confidence, alpha, can be used for either one-tailed or two-tailed (directional or non-directional) distributions, depending on the specific test. Some tests may only support specific values for alpha.
- Parameters:
alpha
- the prespecified level of confidence- Returns:
true
if the null hypothesis is rejected;false
otherwise- See Also:
-
TestUtils.tTest(double[], double[], double)
TestUtils.pairedTTest(double[], double[], double)
-