|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math.distribution.AbstractDistribution
org.apache.commons.math.distribution.AbstractIntegerDistribution
org.apache.commons.math.distribution.ZipfDistributionImpl
public class ZipfDistributionImpl
Implementation for the ZipfDistribution.
| Field Summary |
|---|
| Fields inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
|---|
randomData |
| Constructor Summary | |
|---|---|
ZipfDistributionImpl(int numberOfElements,
double exponent)
Create a new Zipf distribution with the given number of elements and exponent. |
|
| Method Summary | |
|---|---|
protected double |
calculateNumericalMean()
Use this method to actually calculate the mean for the specific distribution. |
protected double |
calculateNumericalVariance()
Use this method to actually calculate the variance for the specific distribution. |
double |
cumulativeProbability(int x)
The probability distribution function P(X <= x) for a
Zipf distribution. |
protected int |
getDomainLowerBound(double p)
Access the domain value lower bound, based on p, used to
bracket a PDF root. |
protected int |
getDomainUpperBound(double p)
Access the domain value upper bound, based on p, used to
bracket a PDF root. |
double |
getExponent()
Get the exponent characterising the distribution. |
int |
getNumberOfElements()
Get the number of elements (e.g. corpus size) for the distribution. |
int |
getSupportLowerBound()
Access the lower bound of the support. |
int |
getSupportUpperBound()
Access the upper bound of the support. |
double |
probability(int x)
The probability mass function P(X = x) for a Zipf distribution. |
| Methods inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
|---|
cumulativeProbability, cumulativeProbability, cumulativeProbability, inverseCumulativeProbability, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, probability, reseedRandomGenerator, sample, sample |
| Methods inherited from class org.apache.commons.math.distribution.AbstractDistribution |
|---|
getNumericalMean, getNumericalVariance, isSupportConnected |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.commons.math.distribution.IntegerDistribution |
|---|
cumulativeProbability, inverseCumulativeProbability, reseedRandomGenerator, sample, sample |
| Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution |
|---|
probability |
| Methods inherited from interface org.apache.commons.math.distribution.Distribution |
|---|
cumulativeProbability, cumulativeProbability, getNumericalMean, getNumericalVariance, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive |
| Constructor Detail |
|---|
public ZipfDistributionImpl(int numberOfElements,
double exponent)
numberOfElements - Number of elements.exponent - Exponent.
NotStrictlyPositiveException - if numberOfElements <= 0
or exponent <= 0.| Method Detail |
|---|
public int getNumberOfElements()
getNumberOfElements in interface ZipfDistributionpublic double getExponent()
getExponent in interface ZipfDistributionpublic double probability(int x)
P(X = x) for a Zipf distribution.
probability in interface IntegerDistributionx - Value at which the probability density function is evaluated.
x.public double cumulativeProbability(int x)
P(X <= x) for a
Zipf distribution.
cumulativeProbability in interface IntegerDistributioncumulativeProbability in class AbstractIntegerDistributionx - Value at which the PDF is evaluated.
x.protected int getDomainLowerBound(double p)
p, used to
bracket a PDF root.
getDomainLowerBound in class AbstractIntegerDistributionp - Desired probability for the critical value.
P(X < 'lower bound') < p.protected int getDomainUpperBound(double p)
p, used to
bracket a PDF root.
getDomainUpperBound in class AbstractIntegerDistributionp - Desired probability for the critical value
P(X < 'upper bound') > p.public int getSupportLowerBound()
getSupportLowerBound in class AbstractIntegerDistributionpublic int getSupportUpperBound()
getSupportUpperBound in class AbstractIntegerDistributionprotected double calculateNumericalMean()
AbstractDistribution.getNumericalMean()
(which implements caching) to actually get the mean.
For number of elements N and exponent s, the mean is
Hs1 / Hs where
Hs1 = generalizedHarmonic(N, s - 1)Hs = generalizedHarmonic(N, s)
calculateNumericalMean in class AbstractDistributionprotected double calculateNumericalVariance()
AbstractDistribution.getNumericalVariance()
(which implements caching) to actually get the variance.
For number of elements N and exponent s, the mean is
(Hs2 / Hs) - (Hs1^2 / Hs^2) where
Hs2 = generalizedHarmonic(N, s - 2)Hs1 = generalizedHarmonic(N, s - 1)Hs = generalizedHarmonic(N, s)
calculateNumericalVariance in class AbstractDistribution
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||