Class SingleSampleTTest
java.lang.Object
org.moeaframework.util.statistics.IntervalRatioStatisticalTest
org.moeaframework.util.statistics.SingleSampleTTest
- All Implemented Interfaces:
StatisticalTest
The Single-Sample t test determines if the population's mean equals some specified value.
- Null Hypothesis: The population's mean equals X.
- Alternative Hypothesis: The population's mean does not equal X.
Assumptions:
- Samples are randomly selected from the population
- The distribution of the underlying population 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
ConstructorDescriptionSingleSampleTTest
(double mean) Constructs a single-sample T test with the specified mean. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double value) Adds a new observation with the specified value.void
addAll
(double[] values) Adds several new observations with the specified values.double
getMean()
Returns the value being tested against the population mean.org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
Returns the descriptive statistics for the recorded data.boolean
test
(double alpha) Returnstrue
if the null hypothesis is rejected;false
otherwise.Methods inherited from class org.moeaframework.util.statistics.IntervalRatioStatisticalTest
add, addAll, categorize, getNumberOfGroups, getStatistics
-
Constructor Details
-
SingleSampleTTest
public SingleSampleTTest(double mean) Constructs a single-sample T test with the specified mean.- Parameters:
mean
- the value being tested against the population mean
-
-
Method Details
-
getMean
public double getMean()Returns the value being tested against the population mean.- Returns:
- the value being tested against the population mean
-
add
public void add(double value) Adds a new observation with the specified value.- Parameters:
value
- the value of the new observation
-
addAll
public void addAll(double[] values) Adds several new observations with the specified values.- Parameters:
values
- the values of the new observations
-
getStatistics
public org.apache.commons.math3.stat.descriptive.DescriptiveStatistics getStatistics()Returns the descriptive statistics for the recorded data.- 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)
-