

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object com.aliasi.stats.AbstractDiscreteDistribution com.aliasi.stats.ZipfDistribution
public class ZipfDistribution
The ZipfDistribution
class provides a finite
distribution parameterized by a positive integer number of outcomes
with outcome probability inversely proportional to the rank of
the outcome (ordered by probablity). Many natural language
phenomena such as unigram word probabilities and namedentity
probabilities follow roughly a Zipf distribution.
The Zipf probability distribution
Zipf_{n}
with n
outcomes is defined by assigning a probability to the
rank r
outcome, for 1<=r<=n
, by:
Zipf_{n}(r) = (1/r)/Z_{n}
where Z_{n}
is the normalizing factor
for a Zipf distribution with n
outcomes:
Z_{n}
= Σ_{1<=j<=n}
1/j
The Zipf distribution class provides a method for returning the entropy of the Zipf distribution. It also provides a static method for returning a Zipf distribution's probabilities in rank order. This latter method is useful for comparing observed distributions to that expected from a Zipf distribution.
For more information, see:
Constructor Summary  

ZipfDistribution(int numOutcomes)
Construct a Constant Zipf distribution with the specified number of outcomes. 
Method Summary  

long 
maxOutcome()
Returns the maximum outcome, which is just the number of outcomes. 
long 
minOutcome()
Returns one, the minimum outcome in a Zipf distribution. 
int 
numOutcomes()
Returns the number of nonzero outcomes for this Zipf distribution. 
double 
probability(long rank)
Returns the probability of the outcome at the specified rank. 
static double[] 
zipfDistribution(int numOutcomes)
Returns the array of probabilities indexed by rank for the Zipf distribution with the specified number of outcomes. 
Methods inherited from class com.aliasi.stats.AbstractDiscreteDistribution 

cumulativeProbability, cumulativeProbabilityGreater, cumulativeProbabilityLess, entropy, log2Probability, mean, variance 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Constructor Detail 

public ZipfDistribution(int numOutcomes)
numOutcomes
 Number of outcomes for the distribution.
IllegalArgumentException
 If the number of outcomes
specified is not positive.Method Detail 

public long minOutcome()
minOutcome
in interface DiscreteDistribution
minOutcome
in class AbstractDiscreteDistribution
public long maxOutcome()
maxOutcome
in interface DiscreteDistribution
maxOutcome
in class AbstractDiscreteDistribution
public int numOutcomes()
public double probability(long rank)
0.0
for nonpositive ranks or
ranks greater than the number of ranks in this distribution.
probability
in interface DiscreteDistribution
probability
in class AbstractDiscreteDistribution
rank
 Rank of outcome.
public static double[] zipfDistribution(int numOutcomes)
numOutcomes
 Number of outcomes.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 