lognormal: Lognormal Distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/family.normal.R

Description

Maximum likelihood estimation of the (univariate) lognormal distribution.

Usage

1
lognormal(lmeanlog = "identitylink", lsdlog = "loglink", zero = "sdlog")

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

Specifies which linear/additive predictor is modelled as intercept-only. For lognormal(), the values can be from the set {1,2} which correspond to mu, sigma, respectively. See CommonVGAMffArguments for more information.

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. The variance of Y is

Var(Y) = [exp(sigma^2) -1] * exp(2 mu + sigma^2).

Value

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

Author(s)

T. W. Yee

References

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

See Also

Lognormal, uninormal, CommonVGAMffArguments, simulate.vlm.

Examples

1
2
3
4
5
6
7
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)

Example output

Loading required package: stats4
Loading required package: splines
VGLM    linear loop  1 :  loglikelihood = -3256.7497
VGLM    linear loop  2 :  loglikelihood = -2845.898
VGLM    linear loop  3 :  loglikelihood = -2548.6544
VGLM    linear loop  4 :  loglikelihood = -2416.0695
VGLM    linear loop  5 :  loglikelihood = -2395.051
VGLM    linear loop  6 :  loglikelihood = -2394.5967
VGLM    linear loop  7 :  loglikelihood = -2394.5965
VGLM    linear loop  8 :  loglikelihood = -2394.5965
VGLM    linear loop  1 :  loglikelihood = -1880.2594
VGLM    linear loop  2 :  loglikelihood = -1873.0471
VGLM    linear loop  3 :  loglikelihood = -1872.9743
VGLM    linear loop  4 :  loglikelihood = -1872.9742
VGLM    linear loop  5 :  loglikelihood = -1872.9742
              meanlog loge(sdlog)
(Intercept) 0.9936615   -1.026091
x2          2.0215035    0.000000
             meanlog loge(sdlog)
(Intercept) 1.005146   -1.042064
x2          0.000000    1.018054

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.