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

refactor lme4/nlme/glmmTMB/(glmmADMB?) tidiers

Open bbolker opened this issue 7 years ago • 6 comments

I've gradually been refactoring the lme4 tidiers, moving away from the broom::fix*() functions - instead, make sure columns are renamed appropriately on the fly, and use tibble::rownames_to_column() as appropriate. Need to make sure that code is re-used appropriately and that behaviour is a similar as possible across these cases.

bbolker avatar Dec 31 '17 19:12 bbolker

Should there be a set of default parameters in the tidy/augment/glance that are built-in into all supported models? This would allow for a common api, with changes only to the arguments of the broom.mixed functions.

GuiMarthe avatar Jan 04 '18 14:01 GuiMarthe

can you be more specific? give an example?

bbolker avatar Jan 04 '18 15:01 bbolker

I'm thinking something along the lines of every tidy function should at least have the following parameters:

  • ran_prefix (or else)
  • conf.int (or a more general intervals)
  • conf.level (or prob)
  • conf.method ( or simply interval_method)
  • maybe others

Or should each model have an independently maintained set of functions that don't necessarily have to the same parameters. (Like brms with "intervals", since credible intervals != confidence intervals).

I'm thinking of a more unified api among mixed models tidiers.

GuiMarthe avatar Jan 04 '18 18:01 GuiMarthe

good points.

  • I've wanted to change conf.int for a while, at least to conf_int (since that's more tidyverse-like); it does make sense to change it to intervals, for reasons you suggest above (although IMO it would be not too horrible to keep conf[_.]int and note that it has a different meaning. I'd really like to change the names of the returned columns, conf.low and conf.high, to lower/upper or lwr/upr (these are shorter, and each pair has the same length; I've sometimes used conf.lo and conf.hi, but I prefer lower/upper - that would also take care of the credible vs confidence issue). However, I haven't wanted to do any of this for fear or breaking (back-)compatibility with broom.
  • similarly, I'd like to make sure that the argument that specifies whether to back-transform results (e.g. to go from log-odds to odds ratios) is transform rather than exponentiate (as in tidy.lm)

So the questions are:

  • how much do we want to break broom-compatibility in pursuit of consistency within broom.mixed (and/or other criteria such as keeping snake case)?
  • where should these rules be documented? (API.md) ? Does such a document exist already for broom?

@dgrtwo ? Opinions?

bbolker avatar Jan 04 '18 19:01 bbolker

I think that since we are splitting up parts of broom, this is our chance to get naming conventions straight and general enough. We won't get it again in a similar way. So my preference would be to break all broom-compatibility we need to break in order to have consistent conventions that "feel right" going forward.

With regard to the specific names, I prefer using intervals, lower/upper and transform.

paul-buerkner avatar Jan 11 '18 07:01 paul-buerkner

Agreed, but probably better singular (interval)

dmenne avatar Jan 11 '18 07:01 dmenne