Class HypothesisTest

    • Constructor Detail

      • HypothesisTest

        protected HypothesisTest​(double[]... samples)
        Construct an instance of HypothesisTest from the samples.
        Parameters:
        samples - an array of samples
    • Method Detail

      • statistics

        public abstract double statistics()
        Get the test statistics.
        Returns:
        the test statistics
        See Also:
        Wikipedia: Test statistic
      • pValue

        public abstract double pValue()
        Get the p-value for the test statistics.
        Returns:
        the p-value
        See Also:
        Wikipedia: P-value
      • nGroups

        public int nGroups()
        Get the number of groups of observations.
        Returns:
        the number of groups of observations
      • nObs

        public int nObs()
        Get the total number of observations.
        Returns:
        the total number of observations
      • isNullRejected

        public boolean isNullRejected​(double alpha)
        Use the p-value to check whether the null hypothesis can be rejected for a given significance level. That is, the probability of making the observations under the null is small.
        Parameters:
        alpha - a significance level of test
        Returns:
        true if the hypothesis is rejected due to p-value < α
      • getNullHypothesis

        public abstract String getNullHypothesis()
        Get a description of the null hypothesis.
        Returns:
        the null hypothesis description
        See Also:
        Wikipedia: Null hypothesis
      • getAlternativeHypothesis

        public abstract String getAlternativeHypothesis()
        Get the description of the alternative hypothesis.
        Returns:
        the alternative hypothesis description
        See Also:
        Wikipedia: Alternative hypothesis
      • oneSidedPvalue

        public static double oneSidedPvalue​(ProbabilityDistribution F,
                                            double x)
        The one-sided p-value is the probability of observing a test statistic at least as extreme as the one observed. For a continuous distribution, it is given by the complementary cumulative distribution function (survival function). For a discrete distribution, we need to add also the probability of observing the critical value.
        Parameters:
        F - a univariate distribution
        x - the critical value
        Returns:
        the p-value for the critical value