Main Content

poissfit

Poisson parameter estimates

Description

pHat = poissfit(x) returns the maximum likelihood estimates (MLEs) of the λ (lambda) parameter of the Poisson distribution, given the sample data in x.

The MLE of λ is equal to the mean of x.

λ^=1ni=1nxi

[pHat,pCI] = poissfit(x) additionally returns 95% confidence intervals.

[pHat,pCI] = poissfit(x,alpha) specifies the confidence level for the confidence intervals to be 100(1 – alpha)%.

example

Examples

collapse all

Generate a vector of random numbers from the Poisson distribution.

data = poissrnd(3,50,1);

Calculate the maximum likelihood estimate and 95% confidence interval for the λ (lambda) parameter.

[pHat1,pCI1] = poissfit(data)
pHat1 = 
2.9600
pCI1 = 2×1

    2.4831
    3.4369

pHat1 contains the estimate for the λ parameter that corresponds to the average number of events in a given time interval. pCI1 contains the confidence interval bounds.

Calculate the 99% confidence interval for the λ parameter.

[pHat2,pCI2] = poissfit(data,0.01)
pHat2 = 
2.9600
pCI2 = 2×1

    2.3333
    3.5867

The output shows that the 99% confidence interval for λ contains the 95% confidence interval.

Input Arguments

collapse all

Sample data, specified as a numeric vector or matrix. If x is a matrix, the function computes the MLE (and confidence interval, if specified) for the sample data in each column of x.

Data Types: single | double

Significance level for the confidence intervals, specified as a scalar in the range [0,1]. The confidence level is 100(1 – alpha)%, where alpha is the probability that the confidence intervals do not contain the true value.

Data Types: single | double

Output Arguments

collapse all

Poisson λ parameter estimates, returned as a numeric row vector. When x is a matrix, pHat has length n, where n is the number of columns in x.

Confidence intervals for the parameter estimates, returned as a 2-by-n numeric array. The first row of pCI contains lower confidence bound values, and the second row contains upper confidence bound values. When x is a vector, n = 1. When x is a matrix, n equals the number of columns in x.

Alternative Functionality

poissfit is a function specific to the Poisson distribution. Statistics and Machine Learning Toolbox™ also offers the generic functions mle, fitdist, and paramci and the Distribution Fitter app, which support various probability distributions.

  • mle returns MLEs and the confidence intervals of MLEs for the parameters of various probability distributions. You can specify the probability distribution name or a custom probability density function.

  • Create a PoissonDistribution probability distribution object by fitting the distribution to data using the fitdist function or the Distribution Fitter app. The object property lambda stores the estimate of the Poisson mean parameter. To obtain the confidence interval for the parameter estimate, pass the object to paramci.

Version History

Introduced before R2006a