Class ConfidenceInterval


  • public class ConfidenceInterval
    extends java.lang.Object
    Represents an interval estimate of a population parameter.
    Since:
    3.3
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double confidenceLevel
      The asserted probability that the interval contains the population parameter
      private double lowerBound
      Lower endpoint of the interval
      private double upperBound
      Upper endpoint of the interval
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfidenceInterval​(double lowerBound, double upperBound, double confidenceLevel)
      Create a confidence interval with the given bounds and confidence level.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkParameters​(double lower, double upper, double confidence)
      Verifies that (lower, upper) is a valid non-empty interval and confidence is strictly between 0 and 1.
      double getConfidenceLevel()  
      double getLowerBound()  
      double getUpperBound()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • lowerBound

        private double lowerBound
        Lower endpoint of the interval
      • upperBound

        private double upperBound
        Upper endpoint of the interval
      • confidenceLevel

        private double confidenceLevel
        The asserted probability that the interval contains the population parameter
    • Constructor Detail

      • ConfidenceInterval

        public ConfidenceInterval​(double lowerBound,
                                  double upperBound,
                                  double confidenceLevel)
        Create a confidence interval with the given bounds and confidence level.

        Preconditions:

        • lower must be strictly less than upper
        • confidenceLevel must be strictly between 0 and 1 (exclusive)

        Parameters:
        lowerBound - lower endpoint of the interval
        upperBound - upper endpoint of the interval
        confidenceLevel - coverage probability
        Throws:
        MathIllegalArgumentException - if the preconditions are not met
    • Method Detail

      • getLowerBound

        public double getLowerBound()
        Returns:
        the lower endpoint of the interval
      • getUpperBound

        public double getUpperBound()
        Returns:
        the upper endpoint of the interval
      • getConfidenceLevel

        public double getConfidenceLevel()
        Returns:
        the asserted probability that the interval contains the population parameter
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation of the confidence interval
      • checkParameters

        private void checkParameters​(double lower,
                                     double upper,
                                     double confidence)
        Verifies that (lower, upper) is a valid non-empty interval and confidence is strictly between 0 and 1.
        Parameters:
        lower - lower endpoint
        upper - upper endpoint
        confidence - confidence level