Skip to content
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

Simultaneous overall prediction bands #4

Open
gavinsimpson opened this issue Aug 16, 2018 · 3 comments
Open

Simultaneous overall prediction bands #4

gavinsimpson opened this issue Aug 16, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@gavinsimpson
Copy link
Owner

From @scottkosty on June 13, 2018 17:43

Consider the following example:

library("mgcv")
set.seed(2)
dat <- gamSim(1, n = 400, dist = "normal", scale = 2)
mod <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat, method = "REML")

It would be nice to get simultaneous bands for

f(x0) + f(x1) + f(x2) + f(x3)

where f(xn) is the true effect of xn on y.

For example, the following estimated values and standard errors correspond to the overall prediction:

predict(mod, se.fit = TRUE)

The hard part is getting a critical value that yields valid simultaneous bands.

This issue could be generalized to gettig simultaneous band for any combination of the smooth terms, e.g.,

f(x2) + f(x3)

but I'm not sure how much complexity this abstraction adds.

As for implementation, based on reading your extremely useful blog articles, I wonder whether it is possible through simulation from the joint posterior of all the smooth terms (does mgcv allow for this?), or from a joint multivariate normal.

Copied from original issue: gavinsimpson/schoenberg#8

@gavinsimpson
Copy link
Owner Author

From @alexpghayes on June 15, 2018 17:31

Seconded. New to GAMs here so I suspect I'm missing something, but is it currently possible to get pointwise prediction intervals for new data?

@gavinsimpson
Copy link
Owner Author

From @scottkosty on June 15, 2018 19:13

Seconded. New to GAMs here so I suspect I'm missing something, but is it currently possible to get pointwise prediction intervals for new data?

There is a newdata argument to mgcv::predict.gam. So if you set that argument accordingly, and set se.fit = TRUE, you should be able to use the typical normal ("normal" in the Gaussian sense) critical values (e.g., for an approximate 95% pointwise confidence band, you could consider multiplying the SE's by 2). For more information, see ?mgcv::predict.gam.

@gavinsimpson gavinsimpson changed the title simultaneous overall prediction bands Simultaneous overall prediction bands Oct 21, 2018
@tamas-ferenci
Copy link

Perhaps the best would be to have a function similar to predict.gam (i.e. providing predictions for some newdata) but spitting out - correctly calculated - CI as well, not only SE. If my understanding is correct, it is not possible right now with gratia, as we can only obtain these smooth-wise (hope I am not mistaken).

@gavinsimpson gavinsimpson added the enhancement New feature or request label Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants