blog.distrib
Class Poisson

java.lang.Object
  extended by blog.AbstractCondProbDistrib
      extended by blog.distrib.Poisson
All Implemented Interfaces:
CondProbDistrib, java.io.Serializable

public class Poisson
extends AbstractCondProbDistrib
implements java.io.Serializable

A Poisson distribution with mean and variance lambda. This is a distribution over non-negative integers. The probability of n is exp(-lambda) lambda^n / n!. This is a slightly modified version of Poisson.java in the common directory, tailored to implement the CondProbDistrib interface.

See Also:
Serialized Form

Constructor Summary
Poisson(java.util.List params)
          Creates a new Poisson distribution with the specifies lambda parameter.
 
Method Summary
 double getLogProb(java.util.List args, java.lang.Object value)
          Returns the log probability of the integer n under this distribution.
 double getProb(java.util.List args, java.lang.Object value)
          Returns the probability of the integer n under this distribution.
 java.lang.Object sampleVal(java.util.List args, Type childType)
          Returns an integer sampled according to this distribution.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Poisson

public Poisson(java.util.List params)
Creates a new Poisson distribution with the specifies lambda parameter.

Method Detail

getProb

public double getProb(java.util.List args,
                      java.lang.Object value)
Returns the probability of the integer n under this distribution.

Specified by:
getProb in interface CondProbDistrib

getLogProb

public double getLogProb(java.util.List args,
                         java.lang.Object value)
Returns the log probability of the integer n under this distribution.

Specified by:
getLogProb in interface CondProbDistrib
Overrides:
getLogProb in class AbstractCondProbDistrib

sampleVal

public java.lang.Object sampleVal(java.util.List args,
                                  Type childType)
Returns an integer sampled according to this distribution. This implementation takes time proportional to the magnitude of the integer returned. I got the algorithm from Anuj Kumar's course page for IEOR E4404 at Columbia University, specifically the file:
http://www.columbia.edu/~ak2108/ta/summer2003/poisson1.c

Specified by:
sampleVal in interface CondProbDistrib

toString

public java.lang.String toString()
Overrides:
toString in class AbstractCondProbDistrib