Class Zipf

  • All Implemented Interfaces:
    java.io.Serializable , jline.lang.Copyable

    
    public class Zipf
    extends DiscreteDistribution
                        

    A Zipf-like probability distribution

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Zipf(double s, int n) Construct a Zipf-like distribution
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static double genHarmonic(double s, int n) Generate harmonic numbers to normalize a Zipf-like distribution on n items with shape s
      static void main(Array<String> args)
      double evalCDF(double t) Evaluates the cumulative distribution function at t
      Matrix evalPMF()
      Matrix evalPMF(List<Double> t) Evaluates the probability mass function at t
      double getMean() Computes the distribution mean
      double getSCV() Computes the squared coefficient of variation == variance/mean^2
      double getSkewness() Gets the skewness of this distribution.
      double evalLST(double s) Evaluates the Laplace-Stieltjes Transform at s.
      Array<double> sample(int n, Random random) Generates samples from the Zipf distribution using the specified random generator.
      Array<double> sample(int n) Gets n samples from the distribution
      MatrixCell getProcess()
      • Methods inherited from class jline.lang.processes.DiscreteDistribution

        evalPMF, evalPMF
      • Methods inherited from class jline.lang.processes.Distribution

        evalProbInterval, getName, getNumParams, getParam, getRate, getSupport, getVar, isContinuous, isDisabled, isDiscrete, isImmediate, isMarkovian, mean, name, numParams, param, rate, scv, setNumParams, setParam, skewness, support, var
      • Methods inherited from class jline.lang.Copyable

        copy
      • Methods inherited from class java.lang.Object

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

      • Zipf

        Zipf(double s, int n)
        Construct a Zipf-like distribution
        Parameters:
        s - - the shape
        n - - number of items
    • Method Detail

      • genHarmonic

         static double genHarmonic(double s, int n)

        Generate harmonic numbers to normalize a Zipf-like distribution on n items with shape s

      • evalCDF

         double evalCDF(double t)

        Evaluates the cumulative distribution function at t

        Parameters:
        t - - the point where the cdf will be evaluated
        Returns:

        - the cdf evaluated at t

      • evalPMF

         Matrix evalPMF(List<Double> t)

        Evaluates the probability mass function at t

        Parameters:
        t - - the point where the pmf will be evaluated
        Returns:

        - the pfm evaluated at t

      • getMean

         double getMean()

        Computes the distribution mean

        Returns:

        - the mean of the distribution

      • getSCV

         double getSCV()

        Computes the squared coefficient of variation == variance/mean^2

        Returns:

        - the squared coefficient of variation

      • getSkewness

         double getSkewness()

        Gets the skewness of this distribution. Skewness measures the asymmetry of the probability distribution.

        Returns:

        the skewness value

      • evalLST

         double evalLST(double s)

        Evaluates the Laplace-Stieltjes Transform at s. For Zipf distribution, LST(s) = Σ(k=1 to n) P(X=k) * e^(-s*k)

        Parameters:
        s - the Laplace domain variable
        Returns:

        the LST value at s

      • sample

         Array<double> sample(int n, Random random)

        Generates samples from the Zipf distribution using the specified random generator. Uses the inverse transform sampling method.

        Parameters:
        n - the number of samples to generate
        random - the random number generator to use
        Returns:

        array of samples from the Zipf distribution

      • sample

         Array<double> sample(int n)

        Gets n samples from the distribution

        Parameters:
        n - - the number of samples
        Returns:

        - n samples from the distribution