
Raw Moment of a Lognormal Distribution
moment_lognormal.RdComputes a raw moment of a lognormal distribution using its closed-form expression. The lognormal distribution is specified by its log-mean (\(\mu\)) and log-standard deviation (\(\sigma\)).
Details
Let \(X \sim N(\mu, \sigma^2)\) and \(Y = \exp(X)\). Then \(Y\) follows a lognormal distribution, and its raw moment of order \(n\) is: $$ E[Y^n] = \exp\left(n\mu + \frac{n^2\sigma^2}{2}\right). $$
In particular, the mean is: $$ E[Y] = \exp\left(\mu + \frac{\sigma^2}{2}\right), $$ and the variance can be calculated as: $$ \mathrm{Var}(Y) = E[Y^2] - E[Y]^2. $$
This function can be used to adjust predictions from generalized linear mixed models with normally distributed random parameters and a log link.