broom.mixed icon indicating copy to clipboard operation
broom.mixed copied to clipboard

feature request: exponentiate coefficients from stanreg

Open graemeblair opened this issue 3 years ago • 1 comments

Just like for some of the other models, it would be helpful to be able to exponentiate coefficients in the tidy function for stanreg objects with the exponentiate argument to tidy.stanreg, e.g.:

library(rstanarm)
library(broom.mixed)
dat <- structure(list(ID = c("067", "083", "098"), age = c(64L, 70L, 6L), S = c(1, 1, 1)), row.names = c(67L, 83L, 98L), class = "data.frame")
fit <- 
  stan_glm(age ~ 1,
           family = gaussian(link = "log"),
           prior_intercept = normal(50, 5),
           data = dat)

tidy(fit, exponentiate = TRUE) # does not exponentiate (goes to ...)

Thanks so much for a terrifically useful package!

graemeblair avatar Jan 24 '22 22:01 graemeblair

This seems like fairly low-hanging fruit/a good idea, although I'll have to look at the guts. In any case there should be a ...-checker in there to warn (or error) if arguments are ignored ...

bbolker avatar Jan 25 '22 14:01 bbolker

Just adding on that request. The tidy() method is used in many places. exponentiate is a common arg regarding that method. It would be relevant to implement it here.

And when it is not relevant to use it, it should return an error.

More generally, it could be worth to consider adding rlang::check_dots_used() in such methods.

larmarange avatar Dec 13 '22 14:12 larmarange

added in 9601528d7

bbolker avatar Dec 13 '22 16:12 bbolker