R/elnorm3.R
elnorm3.RdEstimate the mean, standard deviation, and threshold parameters for a three-parameter lognormal distribution, and optionally construct a confidence interval for the threshold or the median of the distribution.
elnorm3(x, method = "lmle", ci = FALSE, ci.parameter = "threshold",
ci.method = "avar", ci.type = "two-sided", conf.level = 0.95,
threshold.lb.sd = 100, evNormOrdStats.method = "royston")Extended methods and derivations are available in
Probability distributions and parameter estimation: elnorm3.
Open the vignette locally with
vignette("distributions-and-estimation", package = "EnvStats").
numeric vector of observations.
character string specifying the method of estimation. Possible values are:
"lmle" (local maximum likelihood; the default)
"mme" (method of moments)
"mmue" (method of moments using an unbaised estimate of variance)
"mmme" (modified method of moments due to Cohen and Whitten (1980))
"zero.skew" (zero-skewness estimator due to Griffiths (1980))
"royston.skew" (estimator based on Royston's (1992b) index of skewness).
See the DETAILS section for more information.
logical scalar indicating whether to compute a confidence interval for either
the threshold or median of the distribution. The default value is FALSE.
character string indicating the parameter for which the confidence interval is
desired. The possible values are "threshold" (the default) and
"median". This argument is ignored if ci=FALSE.
character string indicating the method to use to construct the confidence interval.
The possible values are "avar" (asymptotic variance; the default), "likelihood.profile", and "skewness" (method suggested by Royston
(1992b) for method="zero.skew"). This argument is ignored if ci=FALSE.
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.
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.
a positive numeric scalar specifying the range over which to look for the
local maximum likelihood (method="lmle") or zero-skewness
(method="zero.skewness") estimator of threshold. The range is set to [ mean(x) - threshold.lb.sd * sd(x), min(x) ]. If you receive a warning
message that elnorm3 is unable to find an acceptable estimate of threshold
in this range, it may be because of convergence problems specific to the data in
x. When this occurs, try changing the value of threshold.lb.sd. This
same range is used in constructing confidence intervals for the threshold parameter.
The default value is threshold.lb.sd=100. This argument is relevant only if
method="lmle", method="zero.skew",
ci.method="likelihood.profile", and/or ci.method="skewness".
character string indicating which method to use in the call to
link{evNormOrdStatsScalar} when method="mmme". See the DETAILS
section for more information.
a list of class "estimate" containing the estimated parameters and other information.
See estimate.object for details.
Aitchison, J., and J.A.C. Brown (1957). The Lognormal Distribution (with special references to its uses in economics). Cambridge University Press, London, Chapter 5.
Calitz, F. (1973). Maximum Likelihood Estimation of the Parameters of the Three-Parameter Lognormal Distribution–a Reconsideration. Australian Journal of Statistics 15(3), 185–190.
Cohen, A.C. (1951). Estimating Parameters of Logarithmic-Normal Distributions by Maximum Likelihood. Journal of the American Statistical Association 46, 206–212.
Cohen, A.C. (1988). Three-Parameter Estimation. In Crow, E.L., and K. Shimizu, eds. Lognormal Distributions: Theory and Applications. Marcel Dekker, New York, Chapter 4.
Cohen, A.C., and B.J. Whitten. (1980). Estimation in the Three-Parameter Lognormal Distribution. Journal of the American Statistical Association 75, 399–404.
Cohen, A.C., B.J. Whitten, and Y. Ding. (1985). Modified Moment Estimation for the Three-Parameter Lognormal Distribution. Journal of Quality Technology 17, 92–99.
Crow, E.L., and K. Shimizu. (1988). Lognormal Distributions: Theory and Applications. Marcel Dekker, New York, Chapter 2.
Griffiths, D.A. (1980). Interval Estimation for the Three-Parameter Lognormal Distribution via the Likelihood Function. Applied Statistics 29, 58–68.
Harter, H.L., and A.H. Moore. (1966). Local-Maximum-Likelihood Estimation of the Parameters of Three-Parameter Lognormal Populations from Complete and Censored Samples. Journal of the American Statistical Association 61, 842–851.
Heyde, C.C. (1963). On a Property of the Lognormal Distribution. Journal of the Royal Statistical Society, Series B 25, 392–393.
Hill, .B.M. (1963). The Three-Parameter Lognormal Distribution and Bayesian Analysis of a Point-Source Epidemic. Journal of the American Statistical Association 58, 72–84.
Hoshi, K., J.R. Stedinger, and J. Burges. (1984). Estimation of Log-Normal Quantiles: Monte Carlo Results and First-Order Approximations. Journal of Hydrology 71, 1–30.
Johnson, N. L., S. Kotz, and N. Balakrishnan. (1994). Continuous Univariate Distributions, Volume 1. Second Edition. John Wiley and Sons, New York.
Royston, J.P. (1992b). Estimation, Reference Ranges and Goodness of Fit for the Three-Parameter Log-Normal Distribution. Statistics in Medicine 11, 897–912.
Stedinger, J.R. (1980). Fitting Lognormal Distributions to Hydrologic Data. Water Resources Research 16(3), 481–490.
The problem of estimating the parameters of a three-parameter lognormal distribution has been extensively discussed by Aitchison and Brown (1957, Chapter 6), Calitz (1973), Cohen (1951), Cohen (1988), Cohen and Whitten (1980), Cohen et al. (1985), Griffiths (1980), Harter and Moore (1966), Hill (1963), and Royston (1992b). Stedinger (1980) and Hoshi et al. (1984) discuss fitting the three-parameter lognormal distribution to hydrologic data.
The global maximum likelihood estimates are inadmissible. In the past, several researchers have found that the local maximum likelihood estimates (lmle's) occasionally fail because of convergence problems, but they were not using the likelihood profile and reparameterization of Griffiths (1980). Cohen (1988) recommends the modified methods of moments estimators over lmle's because they are easy to compute, they are unbiased with respect to \(\mu\) and \(\sigma^2\) (the mean and standard deviation on the log-scale), their variances are minimal or near minimal, and they do not suffer from regularity problems.
Because the distribution of the lmle of the threshold parameter \(\gamma\) is far
from normal for moderate sample sizes (Griffiths, 1980), it is questionable whether
confidence intervals for \(\gamma\) or the median based on asymptotic variances
and covariances will perform well. Cohen and Whitten (1980) and Cohen et al. (1985),
however, found that the asymptotic variances and covariances are reasonably close to
corresponding simulated variances and covariances for the modified method of moments
estimators (method="mmme"). In a simulation study (5000 monte carlo trials),
Royston (1992b) found that the coverage of confidence intervals for \(\gamma\)
based on the likelihood profile (ci.method="likelihood.profile") was very
close the nominal level (94.1% for a nominal level of 95%), although not
symmetric. Royston (1992b) also found that the coverage of confidence intervals
for \(\gamma\) based on the skewness method (ci.method="skewness") was also
very close (95.4%) and symmetric.
# Generate 20 observations from a 3-parameter lognormal distribution
# with parameters meanlog=1.5, sdlog=1, and threshold=10, then use
# Cohen and Whitten's (1980) modified moments estimators to estimate
# the parameters, and construct a confidence interval for the
# threshold based on the estimated asymptotic variance.
# (Note: the call to set.seed simply allows you to reproduce this example.)
set.seed(250)
dat <- rlnorm3(20, meanlog = 1.5, sdlog = 1, threshold = 10)
elnorm3(dat, method = "mmme", ci = TRUE)
#>
#> Results of Distribution Parameter Estimation
#> --------------------------------------------
#>
#> Assumed Distribution: 3-Parameter Lognormal
#>
#> Estimated Parameter(s): meanlog = 1.5206664
#> sdlog = 0.5330974
#> threshold = 9.6620403
#>
#> Estimation Method: mmme
#>
#> Data: dat
#>
#> Sample Size: 20
#>
#> Confidence Interval for: threshold
#>
#> Confidence Interval Method: Normal Approximation
#> Based on Asymptotic Variance
#>
#> Confidence Interval Type: two-sided
#>
#> Confidence Level: 95%
#>
#> Confidence Interval: LCL = 6.985258
#> UCL = 12.338823
#>
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: 3-Parameter Lognormal
#
#Estimated Parameter(s): meanlog = 1.5206664
# sdlog = 0.5330974
# threshold = 9.6620403
#
#Estimation Method: mmme
#
#Data: dat
#
#Sample Size: 20
#
#Confidence Interval for: threshold
#
#Confidence Interval Method: Normal Approximation
# Based on Asymptotic Variance
#
#Confidence Interval Type: two-sided
#
#Confidence Level: 95%
#
#Confidence Interval: LCL = 6.985258
# UCL = 12.338823
#----------
# Repeat the above example using the other methods of estimation
# and compare.
round(elnorm3(dat, "lmle")$parameters, 1)
#> meanlog sdlog threshold
#> 1.3 0.7 10.5
#meanlog sdlog threshold
# 1.3 0.7 10.5
round(elnorm3(dat, "mme")$parameters, 1)
#> meanlog sdlog threshold
#> 2.1 0.3 6.0
#meanlog sdlog threshold
# 2.1 0.3 6.0
round(elnorm3(dat, "mmue")$parameters, 1)
#> meanlog sdlog threshold
#> 2.2 0.3 5.8
#meanlog sdlog threshold
# 2.2 0.3 5.8
round(elnorm3(dat, "mmme")$parameters, 1)
#> meanlog sdlog threshold
#> 1.5 0.5 9.7
#meanlog sdlog threshold
# 1.5 0.5 9.7
round(elnorm3(dat, "zero.skew")$parameters, 1)
#> meanlog sdlog threshold
#> 1.3 0.6 10.3
#meanlog sdlog threshold
# 1.3 0.6 10.3
round(elnorm3(dat, "royston")$parameters, 1)
#> meanlog sdlog threshold
#> 1.4 0.6 10.1
#meanlog sdlog threshold
# 1.4 0.6 10.1
#----------
# Compare methods for computing a two-sided 95% confidence interval
# for the threshold:
# modified method of moments estimator using asymptotic variance,
# lmle using asymptotic variance,
# lmle using likelihood profile, and
# zero-skewness estimator using the skewness method.
elnorm3(dat, method = "mmme", ci = TRUE,
ci.method = "avar")$interval$limits
#> LCL UCL
#> 6.985258 12.338823
# LCL UCL
# 6.985258 12.338823
elnorm3(dat, method = "lmle", ci = TRUE,
ci.method = "avar")$interval$limits
#> LCL UCL
#> 9.017223 11.980107
# LCL UCL
# 9.017223 11.980107
elnorm3(dat, method = "lmle", ci = TRUE,
ci.method="likelihood.profile")$interval$limits
#> LCL UCL
#> 3.699989 11.266030
# LCL UCL
# 3.699989 11.266029
elnorm3(dat, method = "zero.skew", ci = TRUE,
ci.method = "skewness")$interval$limits
#> LCL UCL
#> -25.18851 11.18652
# LCL UCL
#-25.18851 11.18652
#----------
# Now construct a confidence interval for the median of the distribution
# based on using the modified method of moments estimator for threshold
# and the asymptotic variances and covariances. Note that the true median
# is given by threshold + exp(meanlog) = 10 + exp(1.5) = 14.48169.
elnorm3(dat, method = "mmme", ci = TRUE, ci.parameter = "median")
#>
#> Results of Distribution Parameter Estimation
#> --------------------------------------------
#>
#> Assumed Distribution: 3-Parameter Lognormal
#>
#> Estimated Parameter(s): meanlog = 1.5206664
#> sdlog = 0.5330974
#> threshold = 9.6620403
#>
#> Estimation Method: mmme
#>
#> Data: dat
#>
#> Sample Size: 20
#>
#> Confidence Interval for: median
#>
#> Confidence Interval Method: Normal Approximation
#> Based on Asymptotic Variance
#>
#> Confidence Interval Type: two-sided
#>
#> Confidence Level: 95%
#>
#> Confidence Interval: LCL = 11.20541
#> UCL = 17.26922
#>
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: 3-Parameter Lognormal
#
#Estimated Parameter(s): meanlog = 1.5206664
# sdlog = 0.5330974
# threshold = 9.6620403
#
#Estimation Method: mmme
#
#Data: dat
#
#Sample Size: 20
#
#Confidence Interval for: median
#
#Confidence Interval Method: Normal Approximation
# Based on Asymptotic Variance
#
#Confidence Interval Type: two-sided
#
#Confidence Level: 95%
#
#Confidence Interval: LCL = 11.20541
# UCL = 17.26922
#----------
# Compare methods for computing a two-sided 95% confidence interval
# for the median:
# modified method of moments estimator using asymptotic variance,
# lmle using asymptotic variance,
# lmle using likelihood profile, and
# zero-skewness estimator using the skewness method.
elnorm3(dat, method = "mmme", ci = TRUE, ci.parameter = "median",
ci.method = "avar")$interval$limits
#> LCL UCL
#> 11.20541 17.26922
# LCL UCL
#11.20541 17.26922
elnorm3(dat, method = "lmle", ci = TRUE, ci.parameter = "median",
ci.method = "avar")$interval$limits
#> LCL UCL
#> 12.28326 15.87233
# LCL UCL
#12.28326 15.87233
elnorm3(dat, method = "lmle", ci = TRUE, ci.parameter = "median",
ci.method = "likelihood.profile")$interval$limits
#> LCL UCL
#> 6.314583 16.165526
# LCL UCL
# 6.314583 16.165525
elnorm3(dat, method = "zero.skew", ci = TRUE, ci.parameter = "median",
ci.method = "skewness")$interval$limits
#> LCL UCL
#> -22.38322 16.33569
# LCL UCL
#-22.38322 16.33569
#----------
# Clean up
#---------
rm(dat)