|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcommon.MultinomialWithTail
public class MultinomialWithTail
A mixture of a multinomial over the first k natural numbers 0,...,(k-1), and a geometric distribution over the numbers >= k. The parameter k is fixed at construction. The one free parameter is lambda = P(X < k).
| Constructor Summary | |
|---|---|
MultinomialWithTail(double[] pi,
double lambda,
double alpha)
Creates a MultinomialWithTail with the given array of probabilities for the multinomial distribution, and the given lambda and alpha values. |
|
MultinomialWithTail(int k)
Creates a MultinomialWithTail with the given k. |
|
| Method Summary | |
|---|---|
void |
collectStats(int n)
Records an occurrence of the number n, for use in updating parameters. |
double |
getLogProb(int n)
Returns the log probability of the number n. |
double |
getProb(int n)
Return probability of n |
int |
sample()
Generates iid samples from this distribution |
double |
updateParams()
Sets the parameter lambda to the value that maximizes the likelihood of the numbers passed to collectStats since the last call to updateParams. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultinomialWithTail(int k)
public MultinomialWithTail(double[] pi,
double lambda,
double alpha)
pi - an array of double values specifying a probability
distribution over the first pi.length natural numberslambda - the probability P(X < pi.length)alpha - the parameter of the geometric distribution:
P(X >= n+1 | X >= n) for n >= pi.length| Method Detail |
|---|
public double getLogProb(int n)
getLogProb in interface IntegerDistpublic double getProb(int n)
getProb in interface IntegerDistpublic void collectStats(int n)
public int sample()
sample in interface IntegerDistpublic double updateParams()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||