Closed fhui28 closed 1 year ago
A basic version would exploit using plot.gam off the final GAM fit in the PQL estimation algorithm. But can only do point estimates; see plot.gam helpful for more details.
Alternatively manual construction of the function is possible...but hard yards here!
Just some thoughts relevant to plotting; there is the "gratia" package from gavin simpson, and I just happened upon "mgcViz" that also exploits ggplot2 and looks to be quite useful... (and easily includes plots for parametric terms as well as smooths)
Starting example to look into
library(tidyverse)
library(gratia)
library(mgcv)
dat <- data_sim("eg1", n = 100, dist = "normal", scale = 2, seed = 2)
m1 <- gam(y ~ x0 + s(x1) + s(x2) + s(x3), data = dat, method = "REML")
draw(m1, parametric = TRUE)
parametric_effects(m1)
smooth_estimates(m1)
Package now implemented employs parametric_effects and smooth_estimates, but SEs and CIs are not possible.
Will need to ask Gavin Simpson about gratia and how to return specific things within his function used for constructing the predictions. I will make a note of this on github, but please don't hold your breath!
Standard errors are implemented for both all_parametric_effects
and all_smooth_estimates
returned from a CBFM object. Should be correct I hope!
Should either make an option in main CBFM to turn this off and/or create a separate function to do this. I prefer the latter.
WRT to a separate function, are you thinking that it would operate on a fitted CBFM model object? i.e., one would run a model, and then could generate the plotting object at any point afterward? If so, then that seems like a nice approach...
On Sun, Nov 20, 2022 at 4:34 PM Francis KC Hui @.***> wrote:
Should either make an option in main CBFM to turn this off and/or create a separate function to do this. I prefer the latter.
— Reply to this email directly, view it on GitHub https://github.com/fhui28/CBFM/issues/2#issuecomment-1321248486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORLQXE6LKAT6AIWSHM4MPDWJKKMVANCNFSM5AO6Q3EQ . You are receiving this because you commented.Message ID: @.***>
Yes that's the plan! But do it after the MEE revision
Done and now in postMEE branch. Will merge into main branch after manuscript is formally accepted somewhere.
termplot.CBFM for parametric plots; coefplot.CBFM; anything fancier like plot.gam for smooth functions?