Package com.imsl.stat
Class NormalDistribution
java.lang.Object
com.imsl.stat.NormalDistribution
- All Implemented Interfaces:
Distribution,ProbabilityDistribution,Serializable
Evaluates the normal (Gaussian) probability density for a given set of data.
NormalDistribution evaluates the normal probability density
of a given set of data, xData. If parameters are not supplied,
the eval method fits the normal probability density function
to the data by first calculating the mean and standard deviation of
xData. The normal probability density function is defined as:
$$
f(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{\frac{{-(x - \mu)}^2}{{2 \sigma}^2}}
$$ where \(\mu\) and \(\sigma\)
are the mean and standard deviation.
The DataMining package class NaiveBayesClassifier
uses NormalDistribution as the default method to train
continuous data.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]eval(double[] xData) Fits a normal (Gaussian) probability distribution toxDataand returns the probability density at each value.double[]Evaluates a normal (Gaussian) probability distribution with the given parameters at each point inxDataand returns the probability density at each value.doubleEvaluates a normal (Gaussian) probability density at a given pointxData.doublegetMean()Returns the population mean ofxData.Object[]Returns the current parameters of the normal probability density function.doubleReturns the population standard deviation.
-
Constructor Details
-
NormalDistribution
public NormalDistribution()
-
-
Method Details
-
eval
public double[] eval(double[] xData) Fits a normal (Gaussian) probability distribution toxDataand returns the probability density at each value.- Specified by:
evalin interfaceDistribution- Parameters:
xData- adoublearray representing the points at which the normal probability distribution function is to be evaluated- Returns:
- a
doublearray representing the normal probability density at each value inxData
-
eval
Evaluates a normal (Gaussian) probability distribution with the given parameters at each point inxDataand returns the probability density at each value.- Specified by:
evalin interfaceProbabilityDistribution- Parameters:
xData- adoublearray representing the points at which the normal probability distribution function is to be evaluatedparameters- anObjectarray representing the parameters used to evaluate the normal probability density function, see methodgetParameters- Returns:
- a
doublearray representing the normal probability density of each value inxData
-
eval
Evaluates a normal (Gaussian) probability density at a given pointxData.- Specified by:
evalin interfaceProbabilityDistribution- Parameters:
xData- adoublecontaining the point at which the normal probability density function is to be evaluatedparameters- anObjectarray representing the parameters used to evaluate the normal probability density, see methodgetParameters- Returns:
- a
doublerepresenting the normal probability density atxData
-
getParameters
Returns the current parameters of the normal probability density function.- Specified by:
getParametersin interfaceProbabilityDistribution- Returns:
- an
Objectarray containing the parameters resulting from the last invocation of the (Distribution)evalmethod with the following signature,double[] eval(double[] xData). ThisObjectarray can be used as input to theevalmethods that require anObjectarray of distribution parameters as input.
-
getMean
public double getMean()Returns the population mean ofxData.- Returns:
- a
doublerepresenting the population mean ofxData
-
getStandardDeviation
public double getStandardDeviation()Returns the population standard deviation.- Returns:
- a
doublerepresenting the population standard devation ofxData
-