Skip to content
Prev 20560 / 20628 Next

Negative response values when simulating glmer with log link

(I never answered the question on the lme4 issues list: I will 
answer here, and copy the information to the issues list.)

    There are two ways one might define a "log normal GLMM": (1) with a 
transformation

    eta = a + b*x + ...  (linear predictor)
    log(y) ~ Normal(eta, sigma^2)

or (2) with a link function:

    eta = a + b*x + ... (same as above)
    y ~ Normal(exp(eta), sigma^2)

These look almost identical, but are quite different.

   The first case is equivalent to

   Y ~ log-Normal(meanlog = eta, meansd = sigma)

[using R's parameterization based on the mean and standard deviation *on 
the log scale*].  In this case:

   * simulated values of log(y) can be any real number, but y = 
exp(log(y)) will always be positive (possibly zero due to floating point 
underflow in extreme cases
   * the standard deviation of Y is proportional to its mean (== the 
coefficient of variation is constant)

   In the second case,

   * simulated values of y can be any real number: could easily be 
negative, for example, if exp(eta) is close to zero and sigma is not too 
small
   * the standard deviation of Y is constant

   Although there are use cases for both models, I would say that case 1 
(transformation) is generally a more natural way to model positive, 
continuous data.

   Does that help?
On 2025-04-29 2:50 a.m., Fiona Scarff wrote: