LogNormal Class Reference

This class simulates a "Log %Normal distribution". More...

#include <LogNormal.h>

Inheritance diagram for LogNormal:

Normal

List of all members.

Public Member Functions

 LogNormal (double mean=znSqrtEC, double variance=znEC *(znEC-1))
 Creates a new instance of the Log Normal random number generator, initializes the range of the numbers and internal variables.
 LogNormal (double mean, double variance, RNG &r)
 Creates a new log normal random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the range of the numbers and internal variables.
double mean () const
 Returns the current mean value logMean of the random numbers distribution.
double variance () const
 Returns the current variance logVariance of the random numbers distribution.
void mean (double newMean)
 Sets the current mean value logMean of the distribution to the new value "newMean" and prepares internal variables for the future random number generation.
void variance (double newVar)
 Sets the current variance logVariance of the distribution to the new value "newVar" and prepares internal variables for the future random number generation.
double operator() ()
 Returns a log normally distributed random number for a distribution with mean value logMean and variance logVariance.
double p (const double &) const
 Returns the probability for the occurrence of "x" for a log normal distribution with given mean value logMean and variance logVariance.
double operator() (double mean, double variance)
 Returns a log normally distributed random number for a distribution with mean value "mean" and variance "variance".

Protected Attributes

double logMean
 The mean value $\mu$ of the Log Normal distribution.
double logVariance


Detailed Description

This class simulates a "Log %Normal distribution".

This class is derived from class Normal and the random values returned by it are of type "double", simulating the Log Normal distribution given by the equation:

$ f_{log}(x) = \frac{1}{\sqrt{2 \pi \sigma^2 x}} \cdot exp \left(- \frac{(ln x - \mu)^2}{2 \sigma^2}\right) $

where $x > 0$ and the log normal distribution results from the normal (gaussian) distribution $f_n(x)$ by $f_{log}(x) = \frac{1}{x}f_n(ln x)$.
$\mu$ is the mean value or peak of the distribution curve, stored in logMean and $\sigma$ is the distribution's standard deviation, with the variance $V(x) = \sigma^2$ stored in logVariance.
A special form of calculation is used to save time. For details please refer to "Simulation, Modelling & Analysis" by Law & Kelton, pp. 260.
Below you can see the Log Normal distribution for the standard values $\mbox{mean} = \sqrt{e}$ and $\mbox{standard deviation} = e(e-1)$:

logNormal.png

Author:
M. Kreutz
Date:
1995-01-01
Changes:
none
Status:
stable

Constructor & Destructor Documentation

LogNormal::LogNormal ( double  mean = znSqrtEC,
double  variance = znEC * ( znEC - 1 ) 
)

Creates a new instance of the Log Normal random number generator, initializes the range of the numbers and internal variables.

Creates a new instance of the Log Normal random number generator, initializes the range of the numbers and internal variables.

The mean value logMean and the variance logVariance of the distribution are initialized.
Internal variables are also initialized to speed up the generation of future random numbers.
For this instance, the default pseudo random number generator as member of class RandomVar is used.

Parameters:
mean the mean value of the log normal distribution, the default is $\sqrt{e}$
variance the variance of the log normal distribution, the default is $e(e-1)$
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

LogNormal::LogNormal ( double  mean,
double  variance,
RNG r 
)

Creates a new log normal random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the range of the numbers and internal variables.

Creates a new log normal random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the range of the numbers and internal variables.

Each instance of a log normal random number generator is based on a generator, that is defined in class RNG and returns uniformally pseudo random numbers of the interval (0,1). By default, this is a global generator named RNG::globalRng and included as member in class RandomVar.
Here another pseudo random number generator r is used instead.
Additionally to defining the used pseudo random number generator, the mean value and the variance of the distribution and internal variables are initialized.

Parameters:
mean the mean value logMean of the log normal distribution
variance the variance logVariance of the log normal distribution
r the pseudo random number generator that is used
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable


Member Function Documentation

double LogNormal::mean (  )  const [inline]

Returns the current mean value logMean of the random numbers distribution.

Returns:
the mean value $\mu$ as stored in logMean
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Reimplemented from Normal.

double LogNormal::variance (  )  const [inline]

Returns the current variance logVariance of the random numbers distribution.

Returns:
the variance $V(X)=\sigma^2$ as stored in logVariance
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Reimplemented from Normal.

void LogNormal::mean ( double  newMean  ) 

Sets the current mean value logMean of the distribution to the new value "newMean" and prepares internal variables for the future random number generation.

Sets the current mean value logMean of the distribution to the new value "newMean" and prepares internal variables for the future random number generation.

Parameters:
newMean the new mean value for the distribution
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Reimplemented from Normal.

void LogNormal::variance ( double  newVariance  ) 

Sets the current variance logVariance of the distribution to the new value "newVar" and prepares internal variables for the future random number generation.

Sets the current variance logVariance of the distribution to the new value "newVar" and prepares internal variables for the future random number generation.

The variance $V(X)=\sigma^2$ is set to the new value "newVar".

Parameters:
newVariance the new variance of the distribution
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Reimplemented from Normal.

double LogNormal::operator() (  )  [virtual]

Returns a log normally distributed random number for a distribution with mean value logMean and variance logVariance.

Returns a log normally distributed random number for a distribution with mean value logMean and variance logVariance.

To create a random number a special method (see class description) based on the Box-Müller method is used.

Returns:
a log normally distributed random number
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable
See also:
class Normal

Reimplemented from Normal.

double LogNormal::p ( const double &  x  )  const [virtual]

Returns the probability for the occurrence of "x" for a log normal distribution with given mean value logMean and variance logVariance.

Returns the probability for the occurrence of "x" for a log normal distribution with given mean value logMean and variance logVariance.

Parameters:
x the value $x > 0$ for which the occurrence probability will be returned
Returns:
the occurrence probability for x or "0" if $x \leq 0$
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Reimplemented from Normal.

double LogNormal::operator() ( double  mean,
double  variance 
)

Returns a log normally distributed random number for a distribution with mean value "mean" and variance "variance".

Returns a log normally distributed random number for a distribution with mean value "mean" and variance "variance".

This method performs the inverse transformation of the original uniformally distributed random numbers of the interval (0,1) created by the used pseudo random number generator to the type of the log normal distribution.
To create such a transformed random number, a special method (see class description) based on the Box-Müller method is used.

Returns:
a log normally distributed random number
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable
See also:
class Normal

Reimplemented from Normal.


Member Data Documentation

double LogNormal::logVariance [protected]

The variance $V(X)=\sigma^2$ of the distribution, where $\sigma$ is the distribution's standard deviation.


The documentation for this class was generated from the following files:

Generated on Thu Aug 28 18:34:48 2008 for Dolphin by  doxygen 1.5.6