All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sdsu.algorithms.data.Zipf

java.lang.Object
   |
   +----sdsu.algorithms.data.ProbabilityDistribution
           |
           +----sdsu.algorithms.data.DiscreteProbability
                   |
                   +----sdsu.algorithms.data.NoInverseDistribution
                           |
                           +----sdsu.algorithms.data.Zipf

public class Zipf
extends NoInverseDistribution
The Zipfian distribution models the frequency of the word usage in written English and the population of U.S. cities (amoung other things). When ranked by frequency, the frequency of the i'th is proportional to the frquency of the first item divided by i. Reference: Handbook of Algorithms and Data Structures, G. H. Gonnet, Addison-Wesley, 1984, pp 203.

Version:
1.0 11 June 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Index

 o Zipf(int)
Returns a Zipf distribution.

Method Index

 o density(double)
Returns the probability of an item in the sample space will occur.
 o mean()
Returns the mean of the Bernoulli distribution
 o variance()
Returns the variance of the probability distribution

Constructors

 o Zipf
 public Zipf(int populationSize)
Returns a Zipf distribution.

Parameters:
populationSize - number of elements in the sample space.
Throws: OutOfBoundsException
thrown if populationSize is not greater than zero.

Methods

 o density
 public double density(double sampleSpaceItem) throws OutOfBoundsException
Returns the probability of an item in the sample space will occur. sampleSpaceItem must be either 0 or 1.

Parameters:
sampleSpaceItem - an integer value in the interval [1, populationSize]. Is cast to int in density.
Throws: OutOfBoundsException
thrown if sampleSpaceItem is not either 0 or 1.
Overrides:
density in class ProbabilityDistribution
 o mean
 public double mean()
Returns the mean of the Bernoulli distribution

Overrides:
mean in class ProbabilityDistribution
 o variance
 public double variance()
Returns the variance of the probability distribution

Overrides:
variance in class ProbabilityDistribution

All Packages  Class Hierarchy  This Package  Previous  Next  Index