# Interface Distribution

All Superinterfaces:
`Serializable`
All Known Implementing Classes:
`AbstractDistribution`, `BernoulliDistribution`, `BetaDistribution`, `BinomialDistribution`, `ChiSquareDistribution`, `DiscreteDistribution`, `DiscreteExponentialFamilyMixture`, `DiscreteMixture`, `EmpiricalDistribution`, `ExponentialDistribution`, `ExponentialFamilyMixture`, `FDistribution`, `GammaDistribution`, `GaussianDistribution`, `GaussianMixture`, `GeometricDistribution`, `HyperGeometricDistribution`, `KernelDensity`, `LogisticDistribution`, `LogNormalDistribution`, `Mixture`, `NegativeBinomialDistribution`, `PoissonDistribution`, `ShiftedGeometricDistribution`, `TDistribution`, `WeibullDistribution`

public interface Distribution extends Serializable
Probability distribution of univariate random variable. A probability distribution identifies either the probability of each value of a random variable (when the variable is discrete), or the probability of the value falling within a particular interval (when the variable is continuous). When the random variable takes values in the set of real numbers, the probability distribution is completely described by the cumulative distribution function, whose value at each real x is the probability that the random variable is smaller than or equal to x.
• ## Method Summary

Modifier and Type
Method
Description
`double`
`cdf(double x)`
Cumulative distribution function.
`double`
`entropy()`
Shannon entropy of the distribution.
`int`
`length()`
The number of parameters of the distribution.
`default double`
`likelihood(double[] x)`
The likelihood of the sample set following this distribution.
`default double`
`logLikelihood(double[] x)`
The log likelihood of the sample set following this distribution.
`double`
`logp(double x)`
The density at x in log scale, which may prevents the underflow problem.
`double`
`mean()`
The mean of distribution.
`double`
`p(double x)`
The probability density function for continuous distribution or probability mass function for discrete distribution at x.
`double`
`quantile(double p)`
The quantile, the probability to the left of quantile is p.
`double`
`rand()`
Generates a random number following this distribution.
`default double[]`
`rand(int n)`
Generates a set of random numbers following this distribution.
`default double`
`sd()`
The standard deviation of distribution.
`double`
`variance()`
The variance of distribution.
• ## Method Details

• ### length

int length()
The number of parameters of the distribution. The "length" is in the sense of the minimum description length principle.
Returns:
The number of parameters.
• ### mean

double mean()
The mean of distribution.
Returns:
The mean.
• ### variance

double variance()
The variance of distribution.
Returns:
The variance.
• ### sd

default double sd()
The standard deviation of distribution.
Returns:
The standard deviation.
• ### entropy

double entropy()
Shannon entropy of the distribution.
Returns:
Shannon entropy.
• ### rand

double rand()
Generates a random number following this distribution.
Returns:
a random number.
• ### rand

default double[] rand(int n)
Generates a set of random numbers following this distribution.
Parameters:
`n` - the number of random numbers to generate.
Returns:
a set of random numbers.
• ### p

double p(double x)
The probability density function for continuous distribution or probability mass function for discrete distribution at x.
Parameters:
`x` - a real number.
Returns:
the density.
• ### logp

double logp(double x)
The density at x in log scale, which may prevents the underflow problem.
Parameters:
`x` - a real number.
Returns:
the log density.
• ### cdf

double cdf(double x)
Cumulative distribution function. That is the probability to the left of x.
Parameters:
`x` - a real number.
Returns:
the probability.
• ### quantile

double quantile(double p)
The quantile, the probability to the left of quantile is p. It is actually the inverse of cdf.
Parameters:
`p` - the probability.
Returns:
the quantile.
• ### likelihood

default double likelihood(double[] x)
The likelihood of the sample set following this distribution.
Parameters:
`x` - a set of samples.
Returns:
the likelihood.
• ### logLikelihood

default double logLikelihood(double[] x)
The log likelihood of the sample set following this distribution.
Parameters:
`x` - a set of samples.
Returns:
the log likelihood.