|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcommon.Geometric
public class Geometric
A geometric distribution over the natural numbers 0, 1, 2,... It has a single parameter alpha, which equals P(X >= n+1 | X >= n). Thus an alpha close to 1 yields a relatively flat distribution, whereas an alpha close to 0 yields a distribution that decays quickly. The distribution is defined by: P(X = n) = (1 - alpha) alpha^n
Constructor Summary | |
---|---|
Geometric()
Creates a geometric distribution with alpha = 0.5. |
|
Geometric(double alpha)
Creates a geometric distribution with the given alpha parameter. |
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 |
getLogProbGivenUpperBound(int n,
int upper)
Returns the log probability that X = n given that X <= upper. |
double |
getProb(int n)
Returns the probability of the number n. |
double |
getProbGivenUpperBound(int n,
int upper)
Returns the probability that X = n given that X <= upper. |
int |
sample()
Generate iid samples from this distribution |
double |
updateParams()
Sets the parameter alpha 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 Geometric()
public Geometric(double alpha)
Method Detail |
---|
public double getProb(int n)
getProb
in interface IntegerDist
public double getLogProb(int n)
getLogProb
in interface IntegerDist
public double getProbGivenUpperBound(int n, int upper)
public double getLogProbGivenUpperBound(int n, int upper)
public void collectStats(int n)
public double updateParams()
public int sample()
sample
in interface IntegerDist
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |