Search code examples
rglmemmeans

How to use emmeans in a glm Tweedie regression model?


I adjusted a glm with family Tweedie. Right now I need to obtain the adjusted means and standard errors in response scale. So far:

mtcars$am <- as.factor(mtcars$am)
m1 <- glm(hp ~ am, data = mtcars,
          family = statmod::tweedie(var.power = 2.2, 
                                    link.power = 0 #link log
                                    ))
summary(emmeans(m1, "am"), type = "response")

 am response      SE  df asymp.LCL asymp.UCL
 0    5.0768 0.11516 Inf    4.8511    5.3025
 1    4.8430 0.13600 Inf    4.5764    5.1095

Unknown transformation "mu^0": no transformation done 
Confidence level used: 0.95 

How to inform that I used a link log()? How to deal with: "Unknown transformation "mu^0": no transformation done "?


Solution

  • Do this:

    emm <- update(emmeans(m1, "am"), tran = "log")
    summary(emm, type = "response")
    

    See the vignette in transformations for more details.