Class Zipf
-
- All Implemented Interfaces:
-
java.io.Serializable,jline.lang.Copyable
public class Zipf extends DiscreteDistribution
A Zipf-like probability distribution
-
-
Constructor Summary
Constructors Constructor Description Zipf(double s, int n)Construct a Zipf-like distribution
-
Method Summary
Modifier and Type Method Description static doublegenHarmonic(double s, int n)Generate harmonic numbers to normalize a Zipf-like distribution on n items with shape s static voidmain(Array<String> args)doubleevalCDF(double t)Evaluates the cumulative distribution function at t MatrixevalPMF()MatrixevalPMF(List<Double> t)Evaluates the probability mass function at t doublegetMean()Computes the distribution mean doublegetSCV()Computes the squared coefficient of variation == variance/mean^2 doublegetSkewness()Gets the skewness of this distribution. doubleevalLST(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 MatrixCellgetProcess()-
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
-
-
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 generaterandom- 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
-
getProcess
MatrixCell getProcess()
-
-
-
-