smile.stat.distribution
Class PoissonDistribution
- java.lang.Object
-
- smile.stat.distribution.AbstractDistribution
-
- smile.stat.distribution.DiscreteDistribution
-
- smile.stat.distribution.PoissonDistribution
-
- All Implemented Interfaces:
- DiscreteExponentialFamily, Distribution
public class PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily
Poisson distribution expresses the probability of a number of events occurring in a fixed period of time if these events occur with a known average rate and independently of the time since the last event. The Poisson distribution can also be used for the number of events in other specified intervals such as distance, area or volume. If the expected number of occurrences in this interval is λ, then the probability that there are exactly n occurrences (n = 0, 1, 2, ...) is equal toλn e-λ f(n; λ) = --------- n!For sufficiently large values of λ, (say λ > 1000), the normal distribution with mean λ and variance λ, is an excellent approximation to the Poisson distribution. If λ is greater than about 10, then the normal distribution is a good approximation if an appropriate continuity correction is performed, i.e., P(X ≤ x), where (lower-case) x is a non-negative integer, is replaced by P(X ≤ x + 0.5).When a variable is Poisson distributed, its square root is approximately normally distributed with expected value of about λ1/2 and variance of about 1/4.
-
-
Constructor Summary
Constructors Constructor and Description PoissonDistribution(double lambda)Constructor.PoissonDistribution(int[] data)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecdf(double k)Cumulative distribution function.doubleentropy()Shannon entropy of the distribution.doublegetLambda()Returns the rate parameter, the expected number of occurrences in a time unit.doublelogp(int k)The probability mass function in log scale.DiscreteMixture.ComponentM(int[] x, double[] posteriori)The M step in the EM algorithm, which depends the specific distribution.doublemean()The mean of distribution.intnpara()The number of parameters of the distribution.doublep(int k)The probability mass function.doublequantile(double p)The quantile, the probability to the left of quantile is p.doublerand()This function generates a random variate with the poisson distribution.doublesd()The standard deviation of distribution.java.lang.StringtoString()doublevar()The variance of distribution.-
Methods inherited from class smile.stat.distribution.DiscreteDistribution
likelihood, logLikelihood, logp, p
-
Methods inherited from class smile.stat.distribution.AbstractDistribution
likelihood, logLikelihood
-
-
-
-
Constructor Detail
-
PoissonDistribution
public PoissonDistribution(double lambda)
Constructor.
-
PoissonDistribution
public PoissonDistribution(int[] data)
Constructor. Parameter will be estimated from the data by MLE.
-
-
Method Detail
-
getLambda
public double getLambda()
Returns the rate parameter, the expected number of occurrences in a time unit.
-
npara
public int npara()
Description copied from interface:DistributionThe number of parameters of the distribution.- Specified by:
nparain interfaceDistribution
-
mean
public double mean()
Description copied from interface:DistributionThe mean of distribution.- Specified by:
meanin interfaceDistribution
-
var
public double var()
Description copied from interface:DistributionThe variance of distribution.- Specified by:
varin interfaceDistribution
-
sd
public double sd()
Description copied from interface:DistributionThe standard deviation of distribution.- Specified by:
sdin interfaceDistribution
-
entropy
public double entropy()
Description copied from interface:DistributionShannon entropy of the distribution.- Specified by:
entropyin interfaceDistribution
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
p
public double p(int k)
Description copied from class:DiscreteDistributionThe probability mass function.- Specified by:
pin classDiscreteDistribution
-
logp
public double logp(int k)
Description copied from class:DiscreteDistributionThe probability mass function in log scale.- Specified by:
logpin classDiscreteDistribution
-
cdf
public double cdf(double k)
Description copied from interface:DistributionCumulative distribution function. That is the probability to the left of x.- Specified by:
cdfin interfaceDistribution
-
quantile
public double quantile(double p)
Description copied from interface:DistributionThe quantile, the probability to the left of quantile is p. It is actually the inverse of cdf.- Specified by:
quantilein interfaceDistribution
-
M
public DiscreteMixture.Component M(int[] x, double[] posteriori)
Description copied from interface:DiscreteExponentialFamilyThe M step in the EM algorithm, which depends the specific distribution.- Specified by:
Min interfaceDiscreteExponentialFamily- Parameters:
x- the input data for estimationposteriori- the posteriori probability.- Returns:
- the (unnormalized) weight of this distribution in the mixture.
-
rand
public double rand()
This function generates a random variate with the poisson distribution.Uses down/up search from the mode by chop-down technique for λ < 20, and patchwork rejection method for λ ≥ 20.
For λ < 1.E-6 numerical inaccuracy is avoided by direct calculation.
- Specified by:
randin interfaceDistribution
-
-
DataMelt 3.0 © DataMelt by jWork.ORG