New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A better model summary #214
Comments
There's currently an library("gratia")
library("mgcv")
eg1 <- data_sim("eg1", n = 1000, dist = "normal", scale = 2, seed = 1)
m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3),
data = eg1,
method = "REML")
overview(m)
It currently doesn't return estimates for parametric terms: eg4 <- data_sim("eg4", n = 400, dist = "normal", scale = 2, seed = 1)
m_by <- gam(y ~ fac + s(x2, by = fac) + s(x0),
data = su_eg4, method = "REML")
overview(m_by)
It wouldn't be hard to have What do you mean by I'm not a big fan of stars on p values, so I'd resist including them. Expanding on the basis names ( The above output is a plain tibble with some custom formatting rather than a specific Is this (sort of) what you had in mind? |
I did not know about |
I've added a few bits of this to > overview(m_by, stars = TRUE)
Generalized Additive Model with 5 terms
term type k edf statistic p.value stars
<chr> <chr> <dbl> <dbl> <dbl> <chr> <noquote>
1 fac parametric NA 2 150. < 0.001 ***
2 s(x2):fac1 TPRS 9 2.85 4.62 0.0021453 **
3 s(x2):fac2 TPRS 9 2.95 30.9 < 0.001 ***
4 s(x2):fac3 TPRS 9 6.49 30.9 < 0.001 ***
5 s(x0) TPRS 9 1.00 0.0168 0.8996412 but I was thinking about effect sizes, and while it's not too onerous to do this for univariate smooths (evaluating the smooth at 100 evenly spaced values should be fine for most cases), it gets slower when we're doing this for multidimensional smooths unless we keep the number of evaluation points low-ish. I haven't looked into where things are slowing down and an obvious place to speed things up would be to run each smooth in a separate thread/process with furrr and future, but I haven't implemented any of the effect-size bits yet because I want to think a little more about them. |
For the 2 papers I'm doing this for right now, we decided to have min/max in the summary calculated only from the fitted values on the data the model was trained on, so there's no additional predictions to make and these min/max values don't interpolate or extrapolate at all. This is at least predictable. For 2D+ one needs to think about things like |
I think
gratia
would be a nice home for an alternative GAM model summary table that would be a reasonable first pass for including in a paper or at least a supplement for common models, and be amenable to modification. Things that I think would be good to have:NA
where applicableI'm doing this for myself, and would be happy to start a PR based on it.
The text was updated successfully, but these errors were encountered: