Class NormalDistribution


  • public class NormalDistribution
    extends DoubleDistribution
    An object that uses the equation for a normal distribute to calculate values
    Author:
    Bhagat
    • Field Detail

      • mean

        private double mean
        the mean
      • standardDeviation

        private double standardDeviation
        the standard deviation
      • distributionFunction

        private Function<java.lang.Double,​java.lang.Double> distributionFunction
        the function for the normal distribution
    • Constructor Detail

      • NormalDistribution

        public NormalDistribution​(double mean,
                                  double standardDeviation)
        Constructs a new normal distribution
        Parameters:
        mean - the mean / center
        standardDeviation - the spread of the data
      • NormalDistribution

        public NormalDistribution​(QuantitativeDataList list)
        fits a normal distribution to a quantitative data list
        Parameters:
        list - the list
    • Method Detail

      • probability

        public double probability​(double lowerBound,
                                  double upperBound)
        finds the probability of the value to be in [lowerBound, upperBound] using calculus
        Parameters:
        lowerBound - the lower bound
        upperBound - the upper bound
        Returns:
        the probability
      • probability

        public double probability​(Interval interval)
        finds the probability of the value to be in an interval using calculus
        Parameters:
        interval - the interval
        Returns:
        the probability
      • experimentalProbability

        public double experimentalProbability​(double lowerBound,
                                              double upperBound,
                                              int iterations)
        finds the probability of the value to be in an interval using repeated simulations
        Parameters:
        lowerBound - the lower bound for the interval
        upperBound - the upper bound for the interval
        iterations - the number of iterations for the simulation
        Returns:
        the calculated probability
      • experimentalProbability

        public double experimentalProbability​(Interval interval,
                                              int iterations)
        finds the probability of the value to be in an interval using repeated simulations
        Parameters:
        interval - the interval
        iterations - the number of iterations for the simulation
        Returns:
        the calculated probability
      • getDistribution

        public Function<java.lang.Double,​java.lang.Double> getDistribution()
        Returns:
        the distribution