Main Content

expfit

Exponential parameter estimates

Syntax

muhat = expfit(data)
[muhat,muci] = expfit(data)
[muhat,muci] = expfit(data,alpha)
[...] = expfit(data,alpha,censoring)
[...] = expfit(data,alpha,censoring,freq)

Description

muhat = expfit(data) estimates the mean of exponentially distributed sample data in the vector data.

[muhat,muci] = expfit(data) also returns the 95% confidence interval for the mean parameter estimates in muci. The first row of muci is the lower bound of the confidence interval, and the second row is the upper bound.

[muhat,muci] = expfit(data,alpha) returns the 100(1–alpha)% confidence interval for the parameter estimate muhat, where alpha is a value in the range [0 1] specifying the width of the confidence interval. By default, alpha is 0.05, which corresponds to the 95% confidence interval.

[...] = expfit(data,alpha,censoring) accepts a Boolean vector, censoring, of the same size as data, which is 1 for observations that are right-censored and 0 for observations that are observed exactly. data must be a vector in order to pass in the argument censoring.

[...] = expfit(data,alpha,censoring,freq) accepts a frequency vector, freq of the same size as data. Typically, freq contains integer frequencies for the corresponding elements in data, but can contain any nonnegative values. Pass in [] for alpha, censoring, or freq to use their default values.

Examples

The following estimates the mean mu of exponentially distributed data, and returns a 95% confidence interval for the estimate:

mu = 3;
data = exprnd(mu,100,1); % Simulated data

[muhat,muci] = expfit(data)
muhat =
    2.7511
muci =
    2.2826
    3.3813

Extended Capabilities

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

Version History

Introduced before R2006a