java.lang.Object
org.bzdev.math.rv.RandomVariable<Double>
org.bzdev.math.rv.DoubleRandomVariable
org.bzdev.math.rv.LogNormalRV
- All Implemented Interfaces:
Cloneable
,RandomVariableOps<Double>
Random variable with a log normal distribution.
a log normal random variable is one whose logarithm is a
Gaussian random variable. The mean and standard deviations
passed to the constructor refer by convention to the mean
and standard deviation of this Gaussian random variable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
getMean()
Get the mean value for the random-variable.double
getMu()
Get the mean value for the logarithm of this random-variable.static double
getMu
(double mean, double sdev) Get the value of mu for a specified mean and standard deviation.double
getSDev()
Get the standard deviation for the random variable.double
getSigma()
Get the standard deviation for the logarithm of this random variable.static double
getSigma
(double mean, double sdev) Get the value of sigma for a specified mean and standard deviation.logNext()
Get the logarithm of the next value.next()
Get the next value for a random variable.double
next
(int n) Get the product of multiple values with the number of values an int.next
(long n) Get the product of multiple values with the number of values a long.toString()
Methods inherited from class org.bzdev.math.rv.DoubleRandomVariable
getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, parallelStream, parallelStream, rangeTestFailed, rangeTestNeeded, setMaximum, setMinimum, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, stream, stream, tightenMaximum, tightenMaximumS, tightenMinimum, tightenMinimumS
Methods inherited from class org.bzdev.math.rv.RandomVariable
clone, getCharacteristics
-
Constructor Details
-
LogNormalRV
public LogNormalRV(double mu, double sigma) Constructor.- Parameters:
mu
- the mean value of the logarithm of this random variablesigma
- the standard deviation of the logarithm of this random variable
-
-
Method Details
-
getMu
public double getMu()Get the mean value for the logarithm of this random-variable. This is equal to the first argument of the constructor.- Returns:
- the mean value
-
getMu
public static double getMu(double mean, double sdev) Get the value of mu for a specified mean and standard deviation. This is intended for cases where you know the mean and standard deviation, but not the mu-sigma parameters used by the constructor.- Parameters:
mean
- the mean valuesdev
- the standard deviation- Returns:
- the corresponding value of mu
- See Also:
-
getSigma
public static double getSigma(double mean, double sdev) Get the value of sigma for a specified mean and standard deviation. This is intended for cases where you know the mean and standard deviation, but not the mu-sigma parameters used by the constructor.- Parameters:
mean
- the mean valuesdev
- the standard deviation- Returns:
- the corresponding value of sigma
- See Also:
-
getSigma
public double getSigma()Get the standard deviation for the logarithm of this random variable. This is equal to the second argument of the constructor.- Returns:
- the standard deviation
-
getMean
public double getMean()Get the mean value for the random-variable.- Returns:
- the mean value
-
getSDev
public double getSDev()Get the standard deviation for the random variable.- Returns:
- the standard deviation
-
next
Description copied from class:RandomVariable
Get the next value for a random variable. In general, each value will be independent of the last.- Specified by:
next
in interfaceRandomVariableOps<Double>
- Specified by:
next
in classRandomVariable<Double>
- Returns:
- the next value
-
logNext
Get the logarithm of the next value. This method is more efficient that usingMath.log(rv.next())
whererv
is the random variable.- Returns:
- the logarithm of the value that would be returned by calling next
-
next
public double next(int n) Get the product of multiple values with the number of values an int. The range check, if any, is applied to the result, not the individual random values that were multiplied. The implementation is more efficient than one that calls next() n times.- Parameters:
n
- the number of values to use- Returns:
- the product of n values of this random variable
-
next
Get the product of multiple values with the number of values a long. The range check, if any, is applied to the result, not the individual random values that were multiplied. The implementation is more efficient than one that calls next() n times.- Parameters:
n
- the number of values to use- Returns:
- the product of n values of this random variable
-
toString
-