bbolker / broom.mixed

tidy methods for mixed models in R
227 stars 23 forks source link

'exponentiate' option for glmmTMB tidier #88

Closed bbolker closed 4 years ago

bbolker commented 4 years ago

From https://github.com/glmmTMB/glmmTMB/issues/553:

offering this up as I could potentially implement if people think it's useful. Is there any reason why the tidy.glmmTMB method couldn't simply implement something like the exponentiate param used in tidy.rlmerMod?

It's pretty straightforward, and it scales estimates, CI's and SE's all at once:

    if (exponentiate) {
      vv <- intersect(c("estimate", "conf.low", "conf.high"), 
        names(ret))
      ret <- (ret %>% mutate_at(vars(vv), ~exp(.)) %>% 
        mutate(std.error = std.error * estimate))
    } 

note that SEs need to be treated more carefully (multiplied by exponentiated fit?)

bbolker commented 4 years ago

added in 6a34c99b4