[R-sig-ME] geometric mean regression

Ahmad ahmadr215 at tpg.com.au
Tue Apr 3 04:38:43 CEST 2018


Hi Russell

Thanks for this, 
This makes my life much easier! You mentioned that the delta method can
estimate GM of standard errors, is that what you meant?
I need to look into this (SE), it would be great if GM of SE can be done
with emmeans package.

Ahmad
 


-----Original Message-----
From: Lenth, Russell V <russell-lenth at uiowa.edu> 
Sent: Tuesday, 3 April 2018 8:17 AM
To: ahmadr215 at tpg.com.au
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] geometric mean regression

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