[R-sig-ME] geometric mean regression

Lenth, Russell V russell-lenth at uiowa.edu
Tue Apr 3 00:16:55 CEST 2018


The emmeans package handles this quite easily. You can do something like this:

    model <- lm(log(y) ~ treatment + ..., ...)   # where treatment is a factor
    library(emmeans)
    emm <- emmeans(model, "treatment", type = "response")
    emm    # shows the estimated geometric means
    contrast(emm, "pairwise")    # shows ratios of these estimates

A variety of models besides lm() are supported. The response transformation is detected automatically, and `type = "response"` tells it to back-transform. The delta method is used to obtain standard errors.

For more information, see `vignette("transformations", package = "emmeans")`

Russell V. Lenth  -  Professor Emeritus
Department of Statistics and Actuarial Science   
The University of Iowa  -  Iowa City, IA 52242  USA   
Voice (319)335-0712 (Dept. office)  -  FAX (319)335-3017



More information about the R-sig-mixed-models mailing list