blog.distrib
Class NatNumDistribWithTail

java.lang.Object
  extended by blog.AbstractCondProbDistrib
      extended by blog.distrib.NatNumDistribWithTail
All Implemented Interfaces:
CondProbDistrib

public class NatNumDistribWithTail
extends AbstractCondProbDistrib

A mixture of an explicit distribution over the first k natural numbers 0,...,(k-1), and a geometric distribution over the numbers greater than or equal to k. This distribution takes three parameters: a column vector of k probabilities for the first k numbers, the probability lambda that the value is less than k, and the success parameter alpha of the geometric distribution.


Constructor Summary
NatNumDistribWithTail(double[] pi, double lambda, double alpha)
          Creates a NatNumDistribWithTail with the given array of probabilities for the multinomial distribution, and the given lambda and alpha values.
NatNumDistribWithTail(java.util.List params)
          Creates a new NatNumDistribWithTail with the following three parameters: a k-by-1 matrix specifying a probability distribution over the first k natural numbers the probability of generating a number less than k the success probability of the geometric distribution for values greater than or equal to k
 
Method Summary
 double getLogProb(int n)
          Returns the log probability of a non-negative integer n under this distribution.
 double getProb(int n)
          Returns the probability of a non-negative integer n under this distribution.
 double getProb(java.util.List args, java.lang.Object childValue)
          Returns the probability of the given value, which should be a non-negative Integer.
 int sampleVal()
          Returns a sample from this distribution.
 java.lang.Object sampleVal(java.util.List args, Type childType)
          Returns an Integer sampled from this distribution.
 
Methods inherited from class blog.AbstractCondProbDistrib
getLogProb, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NatNumDistribWithTail

public NatNumDistribWithTail(double[] pi,
                             double lambda,
                             double alpha)
Creates a NatNumDistribWithTail with the given array of probabilities for the multinomial distribution, and the given lambda and alpha values. k is set to the size of the probability array.

Parameters:
pi - an array of double values specifying a probability distribution over the first pi.length natural numbers
lambda - the probability P(X < pi.length)
alpha - the success probability of the geometric distribution: P(X >= n+1 | X >= n) for n >= pi.length

NatNumDistribWithTail

public NatNumDistribWithTail(java.util.List params)
Creates a new NatNumDistribWithTail with the following three parameters:
  1. a k-by-1 matrix specifying a probability distribution over the first k natural numbers
  2. the probability of generating a number less than k
  3. the success probability of the geometric distribution for values greater than or equal to k

Method Detail

getProb

public double getProb(int n)
Returns the probability of a non-negative integer n under this distribution. Throws an exception if n is negative.


getLogProb

public double getLogProb(int n)
Returns the log probability of a non-negative integer n under this distribution. Throws an exception if n is negative.


getProb

public double getProb(java.util.List args,
                      java.lang.Object childValue)
Returns the probability of the given value, which should be a non-negative Integer. Expects no arguments.


sampleVal

public int sampleVal()
Returns a sample from this distribution.


sampleVal

public java.lang.Object sampleVal(java.util.List args,
                                  Type childType)
Returns an Integer sampled from this distribution. Expects no arguments.