common
Class RoundedLogNormal

java.lang.Object
  extended by common.RoundedLogNormal
All Implemented Interfaces:
java.io.Serializable

public class RoundedLogNormal
extends java.lang.Object
implements java.io.Serializable

Distribution over positive integers for a random variable X = round(Y), where Y has a log normal distribution. This means Z = log(Y) has a normal distribution. A RoundedLogNormal has two parameters, the mean and the variance. For consistency with Hanna's code, we use the mean of Y and the variance of Z.

See Also:
Serialized Form

Constructor Summary
RoundedLogNormal(double mean, double varianceOfLog)
          Creates a RoundedLogNormal distribution where Y has the given mean and log(Y) has the given variance.
 
Method Summary
 double getLogProb(int n)
          Returns the log probability that X=n.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoundedLogNormal

public RoundedLogNormal(double mean,
                        double varianceOfLog)
Creates a RoundedLogNormal distribution where Y has the given mean and log(Y) has the given variance.

Method Detail

getLogProb

public double getLogProb(int n)
Returns the log probability that X=n. Note that X gets the value n if Y is between n - 0.5 and n + 0.5, which means Z is between log(n - 0.5) and log(n + 0.5). So we should integrate the density of Z between those two values. To avoid computing the integral, we approximate this by taking the density of Z at log(n) and multiplying it by log(n + 0.5) - log(n - 0.5).