Learn R Programming

VGAM (version 0.9-6)

lognormal: Lognormal Distribution

Description

Maximum likelihood estimation of the (univariate) lognormal distribution.

Usage

lognormal(lmeanlog = "identitylink", lsdlog = "loge", 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. See

Value

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

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.

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
ldata2 <- data.frame(x2 = runif(nn <- 1000))
ldata2 <- transform(ldata2, y1 = rlnorm(nn, mean = 1 + 2 * x2, sd = exp(-1)),
                            y2 = rlnorm(nn, mean = 1, sd = exp(-1 + x2)))
fit1 <- vglm(y1 ~ x2, lognormal(zero = 2), data = ldata2, trace = TRUE)
fit2 <- vglm(y2 ~ x2, lognormal(zero = 1), data = ldata2, trace = TRUE)
coef(fit1, matrix = TRUE)
coef(fit2, matrix = TRUE)

Run the code above in your browser using DataLab