[R-sig-ME] Which variance term to use for bias adjustment/correction when back-transforming?
Lieke Moereels
L|eke@Moeree|@ @end|ng |rom UGent@be
Wed Mar 26 15:10:59 CET 2025
Hi all
I hope you are doing well!
A small question:
To report and visualise model outputs from GLMMs, I back-transform estimates with a bias adjustment.
For back-transforming estimated means from the log scale for simple GLMMs with a single random effect term (e.g. richness ~ pH + (1|location)), I always did this (based on what Russ Lenth does in the emmeans package) as follows:
# derive variance attributable to random effects (if I am not mistaken, the below is based on a suggestion from you, Ben?)
extra_disp <- insight::get_variance(fitted_model)[["var.intercept"]] # in my simple models, the random-intercept variance equals the random effects variance
# back-transform estimates from log to response scale, with bias adjustment
estimate_resp <- exp(estimate) + 0.5*exp(estimate)*extra_disp^2
Now I saw that in the ggeffects package, for the predict_response function, the default is to use the residual variance rather than the random effects variance for bias adjustment/correction.
"To apply bias-correction, a valid value of sigma is required, which is extracted by default using insight::get_variance_residual()<https://easystats.github.io/insight/reference/get_variance.html>. Optionally, to provide own estimates of uncertainty, use the sigma argument."
In this discussion:https://github.com/easystats/insight/issues/1008, I saw both options (the one using the random intercept variance and the one using the residual variance) being used.
I am a bit confused about this use of different variance terms for the bias adjustment. Could someone explain to me why there are different approaches here and on what the choice for a certain approach depends? E.g. should I use the residual variance or the random effect variance in the case of a simple model like "richness ~ pH + (1|location)" with a Poisson or Gamma distribution?
Apologies if this should be obvious!
Many thanks and have a nice day!
Lieke
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list