Learn R Programming

VGAM (version 0.9-4)

lognormal: Lognormal Distribution

Description

Maximum likelihood estimation of the (univariate) lognormal distribution.

Usage

lognormal(lmeanlog = "identitylink", lsdlog = "loge", zero = 2)
lognormal3(lmeanlog = "identitylink", lsdlog = "loge",
           powers.try = (-3):3, delta = NULL, zero = 2)

Arguments

lmeanlog, lsdlog
Parameter link functions applied to the mean and (positive) $\sigma$ (standard deviation) parameter. Both of these are on the log scale. See Links for more choices.
zero
An integer-valued vector specifying which linear/additive predictors are modelled as intercepts only. For lognormal(), the values must be from the set {1,2} which correspond to mu, sigma, respectively. For
powers.try
Numerical vector. The initial $lambda$ is chosen as the best value from min(y) - 10^powers.try where y is the response.
delta
Numerical vector. An alternative method for obtaining an initial $lambda$. Here, delta = min(y)-lambda. If given, this supersedes the powers.try argument. The value must be positive.

Value

  • An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm, and vgam.

Warning

Regularity conditions are not satisfied for the 3-parameter case: results may be erroneous. May withdraw it in later versions.

Details

A random variable $Y$ has a 2-parameter lognormal distribution if $\log(Y)$ is distributed $N(\mu, \sigma^2)$. The expected value of $Y$, which is $$E(Y) = \exp(\mu + 0.5 \sigma^2)$$ and not $\mu$, make up the fitted values.

A random variable $Y$ has a 3-parameter lognormal distribution if $\log(Y-\lambda)$ is distributed $N(\mu, \sigma^2)$. Here, $\lambda < Y$. The expected value of $Y$, which is $$E(Y) = \lambda + \exp(\mu + 0.5 \sigma^2)$$ and not $\mu$, make up the fitted values.

lognormal() and lognormal3() fit the 2- and 3-parameter lognormal distribution respectively. Clearly, if the location parameter $\lambda=0$ then both distributions coincide.

References

Kleiber, C. and Kotz, S. (2003) Statistical Size Distributions in Economics and Actuarial Sciences, Hoboken, NJ, USA: Wiley-Interscience.

See Also

rlnorm, uninormal, CommonVGAMffArguments, simulate.vlm.

Examples

Run this code
ldata <- data.frame(y1 = rlnorm(nn <- 1000, meanlog = 1.5, sdlog = exp(-0.8)))
fit1 <- vglm(y1 ~ 1, lognormal, data = ldata, trace = TRUE, crit = "c")
coef(fit1, matrix = TRUE)
Coef(fit1)

ldata2 <- data.frame(x2 = runif(nn <- 1000))
ldata2 <- transform(ldata2, y2 = rlnorm(nn, mean = 0.5, sd = exp(x2)))
fit2 <- vglm(y2 ~ x2, lognormal(zero = 1), data = ldata2, trace = TRUE)
coef(fit2, matrix = TRUE)

lambda <- 4
ldata3 <- data.frame(y3 = lambda + rlnorm(1000, m = 1.5, sd = exp(-0.8)))
fit3 <- vglm(y3 ~ 1, lognormal3, data = ldata3, trace = TRUE, crit = "c")
coef(fit3, matrix = TRUE)
summary(fit3)

Run the code above in your browser using DataLab