gavinsimpson / gratia

ggplot-based graphics and useful functions for GAMs fitted using the mgcv package
https://gavinsimpson.github.io/gratia/
Other
206 stars 28 forks source link

Add support for tidybayes fitted_draws and posterior_draws #18

Open gavinsimpson opened 6 years ago

gavinsimpson commented 6 years ago

This came up in mjskay/tidybayes#130

Now that simulate.gam and related methods in gratia do the correct thing, I should revisit this.

@mjskay I follow what structures/layout/naming conventions are needed to support this, but was the intention that I include gratia:::fitted_draws.gam and gratia:::predicted_draws.gam or that I'd have some functions that provide equivalent output that you can wrap in tidybayes?

Either is fine with me.

mjskay commented 6 years ago

Ah, good question. I think there are pros and cons either way...

Pros / cons of putting [fitted|predicted]_draws.gam in gratia:

Pros:

Cons:

Pros / cons of putting [fitted|predicted]_draws.gam in tidybayes:

Pros:

Cons:

It might help to get some thoughts from other folks who are more experienced at this kind of cross-package coordination. I recall @alexpghayes may have had thoughts about this?

alexpghayes commented 6 years ago

I strongly recommend putting mgcv specific functionality all together in the same place, and then trying to match APIs as much as possible to make cross-package coordination easier.

If you don't want to depend on tidybayes just to get those generics, I would make a PR to generics and then import generics in both gratia and tidybayes.

Also @gavinsimpson, I've been meaning to follow up with you about tidymodels/broom#239 for ages now. It seems like tidy(), glance() and augment() for GAMs (at least with mgcv) should live in gratia over broom.