Main Content

expfit

Exponential parameter estimates

Description

pHat = expfit(x) returns the maximum likelihood estimates (MLEs) of the mean parameter mu of the exponential distribution, given the sample data in x.

[pHat,pCI] = expfit(x) also returns the 95% confidence intervals for the parameter estimates.

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

example

[___] = expfit(x,alpha,censoring) accepts a Boolean vector, censoring, of the same size as x, containing the value 1 for observations that are right-censored and 0 for observations that are observed exactly.

[___] = expfit(x,alpha,censoring,freq) specifies the frequency (or weights) of the observations.

You can specify [] for alpha, censoring, and freq to use their default values.

Examples

collapse all

Generate 100 random numbers from the exponential distribution with the mean parameter mu=3.

rng(0,"twister") % For reproducibility
mu = 3;
x = exprnd(mu,100,1);

Find the maximum likelihood estimate and the 99% confidence interval for the exponential mean parameter.

[pHat,pCI] = expfit(x,0.01)
pHat = 
2.7511
pCI = 2×1

    2.1555
    3.6142

pHat is the MLE, and pCI contains the 99% confidence interval. The value in the first row is the lower bound, and the value in the second row is the upper bound.

Input Arguments

collapse all

Sample data, specified as a numeric vector or matrix. When x is a matrix, the function computes parameter estimates (and confidence intervals, if specified) for the individual columns in 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. You can specify [] for alpha to use its default value of 0.05.

Data Types: single | double

Indicator for the censoring of each value in x, specified as a logical vector of the same size as x. Use 1 for observations that are right-censored and 0 for observations that are fully observed.

The default is an array of 0s, meaning that all observations are fully observed.

You cannot specify censoring when x is a matrix.

Data Types: logical

Frequency (or weights) of the observations, specified as a nonnegative vector that is the same size as x. The freq input argument typically contains nonnegative integer counts for the corresponding elements in x, but can contain any nonnegative values.

To obtain the weighted MLEs for a data set with censoring, specify weights of observations, normalized to the number of observations in x.

The default is an array of 1s, meaning one observation per element of x.

You cannot specify freq when x is a matrix.

Data Types: single | double

Output Arguments

collapse all

Exponential mu 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

expfit is a function specific to the exponential 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 an ExponentialDistribution probability distribution object by fitting the distribution to data using the fitdist function or the Distribution Fitter app. The object property mu stores the estimate of the exponential mean parameter. To obtain the confidence interval for the parameter estimate, pass the object to paramci.

References

[1] Crowder, Martin J., ed. Statistical Analysis of Reliability Data. Reprinted. London: Chapman & Hall, 1995.

[2] Lawless, J. F. Statistical Models and Methods for Lifetime Data. Hoboken, NJ: Wiley-Interscience, 2002.

[3] Meeker, W. Q., and L. A. Escobar. Statistical Methods for Reliability Data. Hoboken, NJ: John Wiley & Sons, Inc., 1998.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a