smile.stat.distribution

## Class DiscreteDistribution

• ### Constructor Summary

Constructors
Constructor and Description
`DiscreteDistribution()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double` `likelihood(int[] x)`
The likelihood given a sample set following the distribution.
`double` `logLikelihood(int[] x)`
The likelihood given a sample set following the distribution.
`double` `logp(double x)`
The density at x in log scale, which may prevents the underflow problem.
`abstract double` `logp(int x)`
The probability mass function in log scale.
`double` `p(double x)`
The probability density function for continuous distribution or probability mass function for discrete distribution at x.
`abstract double` `p(int x)`
The probability mass function.
`protected double` ```quantile(double p, int xmin, int xmax)```
Invertion of cdf by bisection numeric root finding of `cdf(x) = p` for discrete distribution.
`int` `randi()`
Generates an integer random numbers following this discrete distribution.
`int[]` `randi(int n)`
Generates a set of integer random numbers following this discrete distribution.
• ### Methods inherited from class smile.stat.distribution.AbstractDistribution

`inverseTransformSampling, quantile, quantile, rejection`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Methods inherited from interface smile.stat.distribution.Distribution

`cdf, entropy, length, likelihood, logLikelihood, mean, quantile, rand, rand, sd, variance`
• ### Constructor Detail

• #### DiscreteDistribution

`public DiscreteDistribution()`
• ### Method Detail

• #### randi

`public int randi()`
Generates an integer random numbers following this discrete distribution.
• #### randi

`public int[] randi(int n)`
Generates a set of integer random numbers following this discrete distribution.
• #### p

`public abstract double p(int x)`
The probability mass function.
• #### p

`public double p(double x)`
Description copied from interface: `Distribution`
The probability density function for continuous distribution or probability mass function for discrete distribution at x.
• #### logp

`public abstract double logp(int x)`
The probability mass function in log scale.
• #### logp

`public double logp(double x)`
Description copied from interface: `Distribution`
The density at x in log scale, which may prevents the underflow problem.
• #### likelihood

`public double likelihood(int[] x)`
The likelihood given a sample set following the distribution.
• #### logLikelihood

`public double logLikelihood(int[] x)`
The likelihood given a sample set following the distribution.
• #### quantile

```protected double quantile(double p,
int xmin,
int xmax)```
Invertion of cdf by bisection numeric root finding of `cdf(x) = p` for discrete distribution.
Returns:
an integer `n` such that `P(<n) ≤ p ≤ P(<n+1)`.