org.jscience.mathematics.statistics
Class NormalDistribution

java.lang.Object
  extended by org.jscience.mathematics.statistics.Distribution
      extended by org.jscience.mathematics.statistics.NormalDistribution
All Implemented Interfaces:
java.io.Serializable

public class NormalDistribution
extends Distribution
implements java.io.Serializable

This class encapsulates the normal distribution with specified parameters.

See Also:
Serialized Form

Field Summary
static double SQRT2PI
          DOCUMENT ME!
 
Fields inherited from class org.jscience.mathematics.statistics.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
NormalDistribution()
          This default constructor creates a new standard normal distribution (with location parameter 0 and scale parameter 1).
NormalDistribution(double m, double s)
          This general constructor creates a new normal distribution with specified parameter values.
 
Method Summary
 double getCDF(double x)
          This method computes the cumulative distribution function.
 double getCentralMoment(int n)
          This method computes the central moment of a specifed order.
 double getDensity(double x)
          This method defines the probability density function.
 double getLocation()
          This method returns the location parameter.
 double getMaxDensity()
          This method returns the maximum value of the density function.
 double getMean()
          This method returns the mean, which is the same as the location parameter.
 double getMedian()
          This method returns the median, which is the same as the location parameter.
 double getMGF(double t)
          This method returns the moment generating function.
 double getMoment(double a, int n)
          This method computes the moment of a specified order about a specified point.
 double getScale()
          This method gets the scale parameter.
 double getVariance()
          This method returns the variance of the distribution.
 void setLocation(double m)
          This method sets the location parameter.
 void setParameters(double m, double s)
          This method sets the parameters and defines the default domain.
 void setScale(double s)
          This method sets the scale parameter.
 double simulate()
          This method simulates a value from the distribution.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class org.jscience.mathematics.statistics.Distribution
getDomain, getFailureRate, getMoment, getPGF, getQuantile, getSD, getType, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SQRT2PI

public static final double SQRT2PI
DOCUMENT ME!

Constructor Detail

NormalDistribution

public NormalDistribution(double m,
                          double s)
This general constructor creates a new normal distribution with specified parameter values.

Parameters:
m - the location parameter
s - the scale parameter

NormalDistribution

public NormalDistribution()
This default constructor creates a new standard normal distribution (with location parameter 0 and scale parameter 1).

Method Detail

setParameters

public void setParameters(double m,
                          double s)
This method sets the parameters and defines the default domain.

Parameters:
m - the location parameter
s - the scale parameter

getDensity

public double getDensity(double x)
This method defines the probability density function.

Specified by:
getDensity in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the probability density at x

getMaxDensity

public double getMaxDensity()
This method returns the maximum value of the density function.

Overrides:
getMaxDensity in class Distribution
Returns:
the maximum value of the probability density function

getMedian

public double getMedian()
This method returns the median, which is the same as the location parameter.

Overrides:
getMedian in class Distribution
Returns:
the median

getMean

public double getMean()
This method returns the mean, which is the same as the location parameter.

Overrides:
getMean in class Distribution
Returns:
the mean

getVariance

public double getVariance()
This method returns the variance of the distribution.

Overrides:
getVariance in class Distribution
Returns:
the variance

getCentralMoment

public double getCentralMoment(int n)
This method computes the central moment of a specifed order.

Parameters:
n - the order
Returns:
the central moment of order n

getMoment

public double getMoment(double a,
                        int n)
This method computes the moment of a specified order about a specified point.

Overrides:
getMoment in class Distribution
Parameters:
a - the center
n - the order
Returns:
the moment of order n about a

getMGF

public double getMGF(double t)
This method returns the moment generating function.

Overrides:
getMGF in class Distribution
Parameters:
t - a real number
Returns:
the moment generating function at t

simulate

public double simulate()
This method simulates a value from the distribution.

Overrides:
simulate in class Distribution
Returns:
a simulated value from the distribution

getLocation

public double getLocation()
This method returns the location parameter.

Returns:
the location parameter

setLocation

public void setLocation(double m)
This method sets the location parameter.

Parameters:
m - the location parameter

getScale

public double getScale()
This method gets the scale parameter.

Returns:
the scale parameter

setScale

public void setScale(double s)
This method sets the scale parameter.

Parameters:
s - the scale parameter

getCDF

public double getCDF(double x)
This method computes the cumulative distribution function.

Overrides:
getCDF in class Distribution
Parameters:
x - a number in the domain of the distribution
Returns:
the cumulative probability at x

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class Distribution
Returns:
a string giving the name of the distribution and the values of the parameters