Class LogNormalRV

All Implemented Interfaces:
Cloneable, RandomVariableOps<Double>

public class LogNormalRV extends DoubleRandomVariable
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 Details

    • LogNormalRV

      public LogNormalRV(double mu, double sigma)
      Constructor.
      Parameters:
      mu - the mean value of the logarithm of this random variable
      sigma - 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 value
      sdev - 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 value
      sdev - 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

      public Double 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 interface RandomVariableOps<Double>
      Specified by:
      next in class RandomVariable<Double>
      Returns:
      the next value
    • logNext

      public Double logNext()
      Get the logarithm of the next value. This method is more efficient that using Math.log(rv.next()) where rv 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

      public Double next(long n)
      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

      public String toString()
      Overrides:
      toString in class Object