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
Adding sizer to draw() in gratia #117
Comments
@asanders11 I now have sizer-like options available through a new function That plot was created by dat <- data_sim("eg1", n = 400, dist = "normal", scale = 2, seed = 42)
mod <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat, method = "REML")
## first derivatives of all smooths using central finite differences
d <- derivatives(mod, type = "central")
draw(d, add_change = TRUE, change_type = "sizer") with the latest version of gratia here (0.8.1.19 or later) Does that cover what you were looking for or were you also thinking about plotting smooths with significant periods of change indicated on them too? |
This is great, Gavin..thank you! And yes, I was hoping to plot significant periods of change as well. |
…to plot change indicators as per #117
I don't think I can implement this within Now you can use su_eg4 <- data_sim("eg4", n = 400, dist = "normal", scale = 2, seed = 1)
su_m_factor_by <- gam(y ~ fac + s(x2, by = fac) + s(x0),
data = su_eg4, method = "REML")
smooth_estimates(su_m_factor_by) |>
add_sizer(derivatives = d, type = "sizer") |>
draw(grouped_by = TRUE) produces: for example, showing that this works also with the new So I'm going to call that closed for now. Hope that's OK? If I've missed something, let me know. |
Appreciate it, Gavin. This is exactly what I needed! |
Hi Gavin - sorry to bring you back to this topic, but do you know when |
It'll be a few weeks at least before I can get this on CRAN, but you don't need to wait for that; this is in the version on GitHub already, and the README.md file contains instructions on installing the package from the wonderful r-universe repo and build system. https://github.com/gavinsimpson/gratia#installing-gratia |
Is it possible to add an argument similar to 'sizer' from your derivSimulCI() and CI fuctions to plot the first derivative of the spline, with sizer=TRUE to color increasing and decreasing parts of the spline?
Thanks!
The text was updated successfully, but these errors were encountered: