umontreal.iro.lecuyer.probdist
Class LogarithmicDist
- java.lang.Object
-
- umontreal.iro.lecuyer.probdist.DiscreteDistributionInt
-
- umontreal.iro.lecuyer.probdist.LogarithmicDist
-
- All Implemented Interfaces:
- Distribution
public class LogarithmicDist extends DiscreteDistributionInt
Extends the classDiscreteDistributionIntfor the logarithmic distribution. It has shape parameter θ, where 0 < θ < 1. Its mass function isp(x) = - θx/(x log(1 - θ) for x = 1, 2, 3,...Its distribution function isF(x) = -1/log(1-θ)∑i=1xθi/i, & for x > 0.
-
-
Field Summary
-
Fields inherited from class umontreal.iro.lecuyer.probdist.DiscreteDistributionInt
EPSILON
-
-
Constructor Summary
Constructors Constructor and Description LogarithmicDist(double theta)Constructs a logarithmic distribution with parameter θ = theta.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static doublebarF(double theta, int x)Computes the complementary distribution function.doublebarF(int x)Returns bar(F)(x), the complementary distribution function.static doublecdf(double theta, int x)Computes the distribution function F(x).doublecdf(int x)Returns the distribution function F evaluated at x (see).static LogarithmicDistgetInstanceFromMLE(int[] x, int n)Creates a new instance of a logarithmic distribution with parameter θ estimated using the maximum likelihood method based on the n observations x[i], i = 0, 1,…, n - 1.doublegetMean()Returns the mean of the distribution function.static doublegetMean(double theta)Computes and returns the mean of the logarithmic distribution with parameter θ = theta.static double[]getMLE(int[] x, int n)Estimates the parameter θ of the logarithmic distribution using the maximum likelihood method, from the n observations x[i], i = 0, 1,…, n - 1.double[]getParams()Return a table containing the parameters of the current distribution.doublegetStandardDeviation()Returns the standard deviation of the distribution function.static doublegetStandardDeviation(double theta)Computes and returns the standard deviation of the logarithmic distribution with parameter θ = theta.doublegetTheta()Returns the θ associated with this object.doublegetVariance()Returns the variance of the distribution function.static doublegetVariance(double theta)Computes and returns the variance of the logarithmic distribution with parameter θ = theta.static intinverseF(double theta, double u)intinverseFInt(double u)Returns the inverse distribution function F-1(u), where 0 <= u <= 1.static doubleprob(double theta, int x)Computes the logarithmic probability p(x).doubleprob(int x)Returns p(x), the probability of x, which should be a real number in the interval [0, 1].voidsetTheta(double theta)Sets the θ associated with this object.java.lang.StringtoString()
-
-
-
Constructor Detail
-
LogarithmicDist
public LogarithmicDist(double theta)
Constructs a logarithmic distribution with parameter θ = theta.
-
-
Method Detail
-
prob
public double prob(int x)
Description copied from class:DiscreteDistributionIntReturns p(x), the probability of x, which should be a real number in the interval [0, 1].- Specified by:
probin classDiscreteDistributionInt- Parameters:
x- value at which the mass function must be evaluated- Returns:
- the mass function evaluated at x
-
cdf
public double cdf(int x)
Description copied from class:DiscreteDistributionIntReturns the distribution function F evaluated at x (see).- Specified by:
cdfin classDiscreteDistributionInt- Parameters:
x- value at which the distribution function must be evaluated- Returns:
- the distribution function evaluated at x
-
barF
public double barF(int x)
Description copied from class:DiscreteDistributionIntReturns bar(F)(x), the complementary distribution function. See the WARNING above.- Overrides:
barFin classDiscreteDistributionInt- Parameters:
x- value at which the complementary distribution function must be evaluated- Returns:
- the complementary distribution function evaluated at x
-
inverseFInt
public int inverseFInt(double u)
Description copied from class:DiscreteDistributionIntReturns the inverse distribution function F-1(u), where 0 <= u <= 1. The default implementation uses binary search.- Overrides:
inverseFIntin classDiscreteDistributionInt- Parameters:
u- value in the interval (0, 1) for which the inverse distribution function is evaluated- Returns:
- the inverse distribution function evaluated at u
-
getMean
public double getMean()
Description copied from interface:DistributionReturns the mean of the distribution function.
-
getVariance
public double getVariance()
Description copied from interface:DistributionReturns the variance of the distribution function.
-
getStandardDeviation
public double getStandardDeviation()
Description copied from interface:DistributionReturns the standard deviation of the distribution function.
-
prob
public static double prob(double theta, int x)Computes the logarithmic probability p(x).
-
cdf
public static double cdf(double theta, int x)Computes the distribution function F(x).
-
barF
public static double barF(double theta, int x)Computes the complementary distribution function. WARNING: The complementary distribution function is defined as bar(F)(x) = P[X >= x].
-
inverseF
public static int inverseF(double theta, double u)
-
getMLE
public static double[] getMLE(int[] x, int n)Estimates the parameter θ of the logarithmic distribution using the maximum likelihood method, from the n observations x[i], i = 0, 1,…, n - 1. The estimate is returned in element 0 of the returned array.- Parameters:
x- the list of observations used to evaluate parametersn- the number of observations used to evaluate parameters- Returns:
- returns the parameter [ hat(&thetas;)]
-
getInstanceFromMLE
public static LogarithmicDist getInstanceFromMLE(int[] x, int n)
Creates a new instance of a logarithmic distribution with parameter θ estimated using the maximum likelihood method based on the n observations x[i], i = 0, 1,…, n - 1.- Parameters:
x- the list of observations to use to evaluate parametersn- the number of observations to use to evaluate parameters
-
getMean
public static double getMean(double theta)
Computes and returns the mean of the logarithmic distribution with parameter θ = theta.- Returns:
- the mean of the logarithmic distribution E[X] = - θ/((1 - θ)ln(1 - θ))
-
getVariance
public static double getVariance(double theta)
Computes and returns the variance of the logarithmic distribution with parameter θ = theta.- Returns:
- the variance of the logarithmic distribution Var[X] = - θ(θ + ln(1 - θ))/((1 - θ)2(ln(1 - θ))2)
-
getStandardDeviation
public static double getStandardDeviation(double theta)
Computes and returns the standard deviation of the logarithmic distribution with parameter θ = theta.- Returns:
- the standard deviation of the logarithmic distribution
-
getTheta
public double getTheta()
Returns the θ associated with this object.
-
setTheta
public void setTheta(double theta)
Sets the θ associated with this object.
-
getParams
public double[] getParams()
Return a table containing the parameters of the current distribution.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG