Class SingleSampleTTest

java.lang.Object
org.moeaframework.util.statistics.IntervalRatioStatisticalTest
org.moeaframework.util.statistics.SingleSampleTTest
All Implemented Interfaces:
StatisticalTest

public class SingleSampleTTest extends IntervalRatioStatisticalTest
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:

  1. Samples are randomly selected from the population
  2. The distribution of the underlying population is normal

References:

  1. Sheskin, D.J. "Handbook of Parametric and Nonparametric Statistical Procedures, Third Edition." Chapman & Hall/CRC. 2004.
  • 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
    • test

      public boolean test(double alpha)
      Returns true 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)