Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

elogis

Estimate Parameters of a Logistic Distribution


Description

Estimate the location and scale parameters of a logistic distribution, and optionally construct a confidence interval for the location parameter.

Usage

elogis(x, method = "mle", ci = FALSE, ci.type = "two-sided", 
    ci.method = "normal.approx", conf.level = 0.95)

Arguments

x

numeric vector of observations.

method

character string specifying the method of estimation. Possible values are "mle" (maximum likelihood; the default), "mme" (methods of moments), and "mmue" (method of moments based on the unbiased estimator of variance). See the DETAILS section for more information on these estimation methods.

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 "normal.approx" (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.

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, …, x_n) be a vector of n observations from an logistic distribution with parameters location=η and scale=θ.

Estimation

Maximum Likelihood Estimation (method="mle")
The maximum likelihood estimators (mle's) of η and θ are the solutions of the simultaneous equations (Forbes et al., 2011):

∑_{i=1}^{n} \frac{1}{1 + e^{z_i}} = \frac{n}{2} \;\;\;\; (1)

∑_{i=1}^{n} z_i \, [\frac{1 - e^{z_i}}{1 + e^{z_i}} = n \;\;\;\; (2)

where

z_i = \frac{x_i - \hat{eta}_{mle}}{\hat{θ}_{mle}} \;\;\;\; (3)

Method of Moments Estimation (method="mme")
The method of moments estimators (mme's) of η and θ are given by:

\hat{η}_{mme} = \bar{x} \;\;\;\; (4)

\hat{θ}_{mme} = \frac{√{3}}{π} s_m \;\;\;\; (5)

where

\bar{x} = ∑_{i=1}^n x_i \;\;\;\; (6)

s_m^2 = \frac{1}{n} ∑_{i=1}^n (x_i - \bar{x})^2 \;\;\;\; (7)

that is, s_m denotes the square root of the method of moments estimator of variance.

Method of Moments Estimators Based on the Unbiased Estimator of Variance (method="mmue")
These estimators are exactly the same as the method of moments estimators given in equations (4-7) above, except that the method of moments estimator of variance in equation (7) is replaced with the unbiased estimator of variance:

s^2 = \frac{1}{n-1} ∑_{i=1}^n (x_i - \bar{x})^2 \;\;\;\; (8)


Confidence Intervals
When ci=TRUE, an approximate (1-α)100% confidence intervals for η can be constructed assuming the distribution of the estimator of η is approximately normally distributed. A two-sided confidence interval is constructed as:

[\hat{η} - t(n-1, 1-α/2) \hat{σ}_{\hat{η}}, \, \hat{η} + t(n-1, 1-α/2) \hat{σ}_{\hat{η}}]

where t(ν, p) is the p'th quantile of Student's t-distribution with ν degrees of freedom, and the quantity

\hat{σ}_{\hat{η}} = \frac{π \hat{θ}}{√{3n}} \;\;\;\; (9)

denotes the estimated asymptotic standard deviation of the estimator of η.

One-sided confidence intervals for η and θ are computed in a similar fashion.

Value

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

Note

The logistic distribution is defined on the real line and is unimodal and symmetric about its location parameter (the mean). It has longer tails than a normal (Gaussian) distribution. It is used to model growth curves and bioassay data.

Author(s)

Steven P. Millard (EnvStats@ProbStatInfo.com)

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. (1995). Continuous Univariate Distributions, Volume 2. Second Edition. John Wiley and Sons, New York.

See Also

Examples

# Generate 20 observations from a logistic distribution with 
  # parameters location=0 and scale=1, then estimate the parameters 
  # and construct a 90% confidence interval for the location parameter. 
  # (Note: the call to set.seed simply allows you to reproduce this example.)

  set.seed(250) 
  dat <- rlogis(20) 
  elogis(dat, ci = TRUE, conf.level = 0.9) 

  #Results of Distribution Parameter Estimation
  #--------------------------------------------
  #
  #Assumed Distribution:            Logistic
  #
  #Estimated Parameter(s):          location = -0.2181845
  #                                 scale    =  0.8152793
  #
  #Estimation Method:               mle
  #
  #Data:                            dat
  #
  #Sample Size:                     20
  #
  #Confidence Interval for:         location
  #
  #Confidence Interval Method:      Normal Approximation
  #                                 (t Distribution)
  #
  #Confidence Interval Type:        two-sided
  #
  #Confidence Level:                90%
  #
  #Confidence Interval:             LCL = -0.7899382
  #                                 UCL =  0.3535693
  
  #----------

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

EnvStats

Package for Environmental Statistics, Including US EPA Guidance

v2.4.0
GPL (>= 3)
Authors
Steven P. Millard [aut], Alexander Kowarik [ctb, cre] (<https://orcid.org/0000-0001-8598-4130>)
Initial release
2020-10-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.