EnvStats (version 2.3.1)

eexp: Estimate Rate Parameter of an Exponential Distribution

Description

Estimate the rate parameter of an exponential distribution, and optionally construct a confidence interval for the rate parameter.

Usage

eexp(x, method = "mle/mme", ci = FALSE, ci.type = "two-sided", 
    ci.method = "exact", conf.level = 0.95)

Arguments

x

numeric vector of observations.

method

character string specifying the method of estimation. Currently the only possible value is "mle/mme" (maximum likelihood/method of moments; the default). See the DETAILS section for more information.

ci

logical scalar indicating whether to compute a confidence interval for the location or scale parameter. The default value is FALSE.

ci.type

character string indicating what kind of confidence interval to compute. The possible values are "two-sided" (the default), "lower", and "upper". This argument is ignored if ci=FALSE.

ci.method

character string indicating what method to use to construct the confidence interval for the location or scale parameter. Currently, the only possible value is "exact" (the default). See the DETAILS section for more information. This argument is ignored if ci=FALSE.

conf.level

a scalar between 0 and 1 indicating the confidence level of the confidence interval. The default value is conf.level=0.95. This argument is ignored if ci=FALSE.

Value

a list of class "estimate" containing the estimated parameters and other information. See estimate.object for details.

Details

If x contains any missing (NA), undefined (NaN) or infinite (Inf, -Inf) values, they will be removed prior to performing the estimation.

Let \(\underline{x} = (x_1, x_2, \ldots, x_n)\) be a vector of \(n\) observations from an exponential distribution with parameter rate=\(\lambda\).

Estimation The maximum likelihood estimator (mle) of \(\lambda\) is given by: $$\hat{\lambda}_{mle} = \frac{1}{\bar{x}}$$ where $$\bar{x} = \frac{1}{n}\sum^n_{i=1} x_i$$ (Forbes et al., 2011). That is, the mle is the reciprocal of the sample mean.

Sometimes the exponential distribution is parameterized with a scale parameter instead of a rate parameter. The scale parameter is the reciprocal of the rate parameter, and the sample mean is both the mle and the minimum variance unbiased estimator (mvue) of the scale parameter.

Confidence Interval When ci=TRUE, an exact \((1-\alpha)100\%\) confidence intervals for \(\lambda\) can be constructed based on the relationship between the exponential distribution, the gamma distribution, and the chi-square distribution. An exponential distribution with parameter rate=\(\lambda\) is equivalent to a gamma distribution with parameters shape=1 and scale=\(1/\lambda\). The sum of \(n\) iid gamma random variables with parameters shape=1 and scale=\(1/\lambda\) is a gamma random variable with parameters shape=\(n\) and scale=\(1/\lambda\). Finally, a gamma distribution with parameters shape=\(n\) and scale=\(1/\lambda\) is equivalent to 0.5 times a chi-square distribution with degrees of freedom df=\(2n\). Thus, the quantity \(2n\bar{x}\) has a chi-square distribution with degrees of freedom df=\(2n\).

A two-sided \((1-\alpha)100\%\) confidence interval for \(\lambda\) is therefore constructed as: $$[\frac{\chi^2(2n, \alpha/2)}{2n\bar{x}}, \; \frac{chi^2(2n, 1 - \alpha/2)}{2n\bar{x}} ]$$ where \(\chi^2(\nu,p)\) is the \(p\)'th quantile of a chi-square distribution with \(\nu\) degrees of freedom.

One-sided confidence intervals are computed in a similar fashion.

References

Forbes, C., M. Evans, N. Hastings, and B. Peacock. (2011). Statistical Distributions. Fourth Edition. John Wiley and Sons, Hoboken, NJ.

Johnson, N. L., S. Kotz, and N. Balakrishnan. (1994). Continuous Univariate Distributions, Volume 1. Second Edition. John Wiley and Sons, New York.

See Also

Exponential.

Examples

Run this code
# NOT RUN {
  # Generate 20 observations from an exponential distribution with parameter 
  # rate=2, then estimate the parameter and construct a 90% confidence interval. 
  # (Note: the call to set.seed simply allows you to reproduce this example.)

  set.seed(250) 
  dat <- rexp(20, rate = 2) 
  eexp(dat, ci=TRUE, conf = 0.9) 

  #Results of Distribution Parameter Estimation
  #--------------------------------------------
  #
  #Assumed Distribution:            Exponential
  #
  #Estimated Parameter(s):          rate = 2.260587
  #
  #Estimation Method:               mle/mme
  #
  #Data:                            dat
  #
  #Sample Size:                     20
  #
  #Confidence Interval for:         rate
  #
  #Confidence Interval Method:      Exact
  #
  #Confidence Interval Type:        two-sided
  #
  #Confidence Level:                90%
  #
  #Confidence Interval:             LCL = 1.498165
  #                                 UCL = 3.151173

  #----------

  # Clean up
  #---------
  rm(dat)
# }

Run the code above in your browser using DataLab