gov.sandia.cognition.statistics.distribution
Class LogNormalDistribution

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.AbstractDistribution<NumberType>
          extended by gov.sandia.cognition.statistics.AbstractClosedFormUnivariateDistribution<Double>
              extended by gov.sandia.cognition.statistics.AbstractClosedFormSmoothUnivariateDistribution
                  extended by gov.sandia.cognition.statistics.distribution.LogNormalDistribution
All Implemented Interfaces:
Vectorizable, ClosedFormComputableDistribution<Double>, ClosedFormDistribution<Double>, ClosedFormUnivariateDistribution<Double>, ComputableDistribution<Double>, Distribution<Double>, DistributionWithMean<Double>, EstimableDistribution<Double,LogNormalDistribution>, SmoothUnivariateDistribution, UnivariateDistribution<Double>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
LogNormalDistribution.CDF, LogNormalDistribution.PDF

@PublicationReference(author="Wikipedia",
                      title="Log-normal distribution",
                      type=WebPage,
                      year=2009,
                      url="http://en.wikipedia.org/wiki/Log-normal_distribution")
public class LogNormalDistribution
extends AbstractClosedFormSmoothUnivariateDistribution
implements EstimableDistribution<Double,LogNormalDistribution>

Log-Normal distribution PDF and CDF implementations. The Log-Normal distribution is related to a UnivariateGaussian where the natural logarithm of the random variable is normally distributed. This turns up in application areas that are the product of some random variables, where each random variable is i.i.d. and normally distributed. Stock market returns are the classic example of a Log-Normal distribution.

Since:
2.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Nested Class Summary
static class LogNormalDistribution.CDF
          CDF of the Log-Normal Distribution
static class LogNormalDistribution.MaximumLikelihoodEstimator
          Maximum Likelihood Estimator of a log-normal distribution.
static class LogNormalDistribution.PDF
          PDF of a Log-normal distribution
static class LogNormalDistribution.WeightedMaximumLikelihoodEstimator
          Maximum Likelihood Estimator from weighted data
 
Field Summary
static double DEFAULT_LOG_NORMAL_MEAN
          Default log normal mean, 0.0.
static double DEFAULT_LOG_NORMAL_VARIANCE
          Default log normal variance, 1.0.
static double SQRT2PI
          Constant value of Math.sqrt(2*Math.PI)
 
Constructor Summary
LogNormalDistribution()
          Default constructor.
LogNormalDistribution(double logNormalMean, double logNormalVariance)
          Creates a new instance of LogNormalDistribution
LogNormalDistribution(LogNormalDistribution other)
          Copy Constructor
 
Method Summary
 void convertFromVector(Vector parameters)
          Sets the parameters of the distribution from a 2-dimensional Vector with ( logNormalMean logNormalVariance )
 Vector convertToVector()
          Returns a 2-dimensional Vector with ( logNormalMean logNormalVariance )
 LogNormalDistribution.CDF getCDF()
          Gets the CDF of a scalar distribution.
 LogNormalDistribution.MaximumLikelihoodEstimator getEstimator()
          Gets an estimator associated with this distribution.
 double getLogNormalMean()
          Getter for logNormalMean
 double getLogNormalVariance()
          Getter for logNormalVariance
 Double getMaxSupport()
          Gets the minimum support (domain or input) of the distribution.
 Double getMean()
          Gets the arithmetic mean, or "first central moment" or "expectation", of the distribution.
 Double getMinSupport()
          Gets the minimum support (domain or input) of the distribution.
 LogNormalDistribution.PDF getProbabilityFunction()
          Gets the distribution function associated with this Distribution, either the PDF or PMF.
 double getVariance()
          Gets the variance of the distribution.
 ArrayList<Double> sample(Random random, int numSamples)
          Draws multiple random samples from the distribution.
 void setLogNormalMean(double logNormalMean)
          Setter for logNormalMean
 void setLogNormalVariance(double logNormalVariance)
          Setter for logNormalVariance
 String toString()
           
 
Methods inherited from class gov.sandia.cognition.statistics.AbstractClosedFormUnivariateDistribution
clone
 
Methods inherited from class gov.sandia.cognition.statistics.AbstractDistribution
sample
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.statistics.Distribution
sample
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 
Methods inherited from interface gov.sandia.cognition.math.matrix.Vectorizable
clone
 

Field Detail

DEFAULT_LOG_NORMAL_MEAN

public static final double DEFAULT_LOG_NORMAL_MEAN
Default log normal mean, 0.0.

See Also:
Constant Field Values

DEFAULT_LOG_NORMAL_VARIANCE

public static final double DEFAULT_LOG_NORMAL_VARIANCE
Default log normal variance, 1.0.

See Also:
Constant Field Values

SQRT2PI

public static final double SQRT2PI
Constant value of Math.sqrt(2*Math.PI)

Constructor Detail

LogNormalDistribution

public LogNormalDistribution()
Default constructor.


LogNormalDistribution

public LogNormalDistribution(double logNormalMean,
                             double logNormalVariance)
Creates a new instance of LogNormalDistribution

Parameters:
logNormalMean - Mean of the underlying distribution, (-infinity,+infinity)
logNormalVariance - Variance of the underlying distribution, (0,infinity)

LogNormalDistribution

public LogNormalDistribution(LogNormalDistribution other)
Copy Constructor

Parameters:
other - LogNormalDistribution to copy
Method Detail

convertToVector

public Vector convertToVector()
Returns a 2-dimensional Vector with ( logNormalMean logNormalVariance )

Specified by:
convertToVector in interface Vectorizable
Returns:
2-dimensional Vector with ( logNormalMean logNormalVariance )

convertFromVector

public void convertFromVector(Vector parameters)
Sets the parameters of the distribution from a 2-dimensional Vector with ( logNormalMean logNormalVariance )

Specified by:
convertFromVector in interface Vectorizable
Parameters:
parameters - 2-dimensional Vector with ( logNormalMean logNormalVariance )

getLogNormalMean

public double getLogNormalMean()
Getter for logNormalMean

Returns:
Mean of the underlying distribution, (-infinity,+infinity)

setLogNormalMean

public void setLogNormalMean(double logNormalMean)
Setter for logNormalMean

Parameters:
logNormalMean - Mean of the underlying distribution, (-infinity,+infinity)

getLogNormalVariance

public double getLogNormalVariance()
Getter for logNormalVariance

Returns:
Variance of the underlying distribution, (0,infinity)

setLogNormalVariance

public void setLogNormalVariance(double logNormalVariance)
Setter for logNormalVariance

Parameters:
logNormalVariance - Variance of the underlying distribution, (0,infinity)

getMean

public Double getMean()
Description copied from interface: DistributionWithMean
Gets the arithmetic mean, or "first central moment" or "expectation", of the distribution.

Specified by:
getMean in interface DistributionWithMean<Double>
Specified by:
getMean in interface SmoothUnivariateDistribution
Returns:
Mean of the distribution.

getVariance

public double getVariance()
Description copied from interface: UnivariateDistribution
Gets the variance of the distribution. This is sometimes called the second central moment by more pedantic people, which is equivalent to the square of the standard deviation.

Specified by:
getVariance in interface UnivariateDistribution<Double>
Returns:
Variance of the distribution.

sample

public ArrayList<Double> sample(Random random,
                                int numSamples)
Description copied from interface: Distribution
Draws multiple random samples from the distribution. It is generally more efficient to use this multiple-sample method than multiple calls of the single-sample method. (But not always.)

Specified by:
sample in interface Distribution<Double>
Parameters:
random - Random-number generator to use in order to generate random numbers.
numSamples - Number of samples to draw from the distribution.
Returns:
Samples drawn according to this distribution.

getCDF

public LogNormalDistribution.CDF getCDF()
Description copied from interface: UnivariateDistribution
Gets the CDF of a scalar distribution.

Specified by:
getCDF in interface ClosedFormUnivariateDistribution<Double>
Specified by:
getCDF in interface SmoothUnivariateDistribution
Specified by:
getCDF in interface UnivariateDistribution<Double>
Returns:
CDF of the scalar distribution.

getProbabilityFunction

public LogNormalDistribution.PDF getProbabilityFunction()
Description copied from interface: ComputableDistribution
Gets the distribution function associated with this Distribution, either the PDF or PMF.

Specified by:
getProbabilityFunction in interface ComputableDistribution<Double>
Specified by:
getProbabilityFunction in interface SmoothUnivariateDistribution
Returns:
Distribution function associated with this Distribution.

toString

public String toString()
Overrides:
toString in class Object

getMinSupport

public Double getMinSupport()
Description copied from interface: UnivariateDistribution
Gets the minimum support (domain or input) of the distribution.

Specified by:
getMinSupport in interface UnivariateDistribution<Double>
Returns:
Minimum support.

getMaxSupport

public Double getMaxSupport()
Description copied from interface: UnivariateDistribution
Gets the minimum support (domain or input) of the distribution.

Specified by:
getMaxSupport in interface UnivariateDistribution<Double>
Returns:
Minimum support.

getEstimator

public LogNormalDistribution.MaximumLikelihoodEstimator getEstimator()
Description copied from interface: EstimableDistribution
Gets an estimator associated with this distribution.

Specified by:
getEstimator in interface EstimableDistribution<Double,LogNormalDistribution>
Returns:
A distribution estimator associated for this distribution.