Package io.bhagat.math.statistics
Class NormalDistribution
- java.lang.Object
-
- io.bhagat.math.statistics.Distribution<java.lang.Double>
-
- io.bhagat.math.statistics.DoubleDistribution
-
- io.bhagat.math.statistics.NormalDistribution
-
public class NormalDistribution extends DoubleDistribution
An object that uses the equation for a normal distribute to calculate values- Author:
- Bhagat
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.bhagat.math.statistics.DoubleDistribution
DoubleDistribution.DoubleSimulation
-
Nested classes/interfaces inherited from class io.bhagat.math.statistics.Distribution
Distribution.InvalidInputException
-
-
Field Summary
Fields Modifier and Type Field Description private Function<java.lang.Double,java.lang.Double>distributionFunctionthe function for the normal distributionprivate doublemeanthe meanprivate doublestandardDeviationthe standard deviation
-
Constructor Summary
Constructors Constructor Description NormalDistribution(double mean, double standardDeviation)Constructs a new normal distributionNormalDistribution(QuantitativeDataList list)fits a normal distribution to a quantitative data list
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleDistribution.DoubleSimulationcreateSimulation()creates the simulation represented by this distributiondoubleexperimentalProbability(double lowerBound, double upperBound, int iterations)finds the probability of the value to be in an interval using repeated simulationsdoubleexperimentalProbability(Interval interval, int iterations)finds the probability of the value to be in an interval using repeated simulationsFunction<java.lang.Double,java.lang.Double>getDistribution()doublegetMean()doublegetStandardDeviation()doubleprobability(double lowerBound, double upperBound)finds the probability of the value to be in [lowerBound, upperBound] using calculusdoubleprobability(Interval interval)finds the probability of the value to be in an interval using calculusdoubleprobability(java.lang.Double x)finds the probability that a number x is returned-
Methods inherited from class io.bhagat.math.statistics.DoubleDistribution
zScore
-
-
-
-
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 / centerstandardDeviation- 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
-
createSimulation
public DoubleDistribution.DoubleSimulation createSimulation()
creates the simulation represented by this distribution- Specified by:
createSimulationin classDoubleDistribution- Returns:
- the simulation object
-
probability
public double probability(java.lang.Double x) throws Distribution.InvalidInputExceptionfinds the probability that a number x is returned- Specified by:
probabilityin classDistribution<java.lang.Double>- Parameters:
x- the number- Returns:
- the probability
- Throws:
Distribution.InvalidInputException
-
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 boundupperBound- 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 intervalupperBound- the upper bound for the intervaliterations- 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 intervaliterations- the number of iterations for the simulation- Returns:
- the calculated probability
-
getMean
public double getMean()
- Specified by:
getMeanin classDoubleDistribution- Returns:
- the mean
-
getStandardDeviation
public double getStandardDeviation()
- Specified by:
getStandardDeviationin classDoubleDistribution- Returns:
- the standardDeviation
-
getDistribution
public Function<java.lang.Double,java.lang.Double> getDistribution()
- Returns:
- the distribution
-
-