-
Notifications
You must be signed in to change notification settings - Fork 31
Add simultaneous intervals on smooths in draw.gam()
#314
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
Comments
Hello. I am new to the package and together with @EliotFr5 and under the supervision of [@katossky / @JMeyer31] we are willing to solve this issue, as part of an assignment at the ENSAI school of statistical engineering (France). We have read the general guidelines from Github and we will try to be as autonomous as possible but we may ask for guidance from now and then. We |
To solve this problem, we have considered two possible solutions :
Let us know what you think. |
Hi @louisebarbet and @EliotFr5 Thanks for the interest in gratia and apologies for the slow reply (I've just finished a block of teaching). I'm not sure this Issue is the best option for you to jump into the package with:
Further, all of this needs an overhaul for efficiency reasons (the evaluation of smooths and creating the ggplot objects is embarrassingly parallel) and to deduplicate code.
Wherever we add the simultaneous interval code, the argument should follow the convention elsewhere in the package, which is
gratia already has There is already code in the package to compute simultaneous intervals in two separate places (maybe three because of the now-deprecated An easier issue to get stuck into, but which is related to #314, is to add simultaneous intervals to the fitted/predicted values - i.e. a simultaneous interval over two or more model terms. See #4 and #67, and I have had a few emails about this recently. Implementing this for If you want to continue with implementing the wish of #314, then it needs to be done in |
Hi @gavinsimpson, Thank you for your help ! @EliotFr5 and I will work on the issue you highlighted, specifically add simultaneous intervals to the fitted/predicted values.
This means we need to add a k attribute to the You mentioned existing code for computing simultaneous intervals. Would you like us to use the
Let us know what you think. |
A Bonferroni adjustment would be far to conservative as What is needed is an interval that includes |
Hi @gavinsimpson, Thank you for your clarifications. @louisebarbet and I read your blog post and found that the code computing these intervals for a single smooth is in the
And update the following section:
Let us know if this approach aligns with your expectations! |
@EliotFr5 You don't need to modify anything in The lines is particular that need changing are: Lines 129 to 132 in 10fef60
If the type of interval is simultaneous, you will instead need to use |
Sorry, what I meant to say was, if a simultaneous interval is requested, then in addition to crit <- if (interval == "simultaneous") { # these next three lines are also from the blog post
absDev <- abs(sweep(simDev, 1, se.fit, FUN = "/"))
masd <- apply(absDev, 2L, max)
quantile(masd, prob = 0.95, type = 8)
} else {
coverage_normal(ci_level)
} |
Discussed in #313
Originally posted by AlainZuur September 6, 2024
Hello...what would be the easiest way to get simultaneous CIs with draw()? I can get them manually with confint...but it would be much easier if draw() could plot them (I don't think it can??).
I can see how to do it manually:
https://gavinsimpson.github.io/gratia/articles/custom-plotting.html
This part:
sm <- smooth_estimates(m) |> add_confint()
And then replace by: confint and adjust the type argument. Is there any way of doing this faster?
Or change that line in draw.gam?
Alain
The text was updated successfully, but these errors were encountered: