Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

simultaneous overall prediction bands #8

Closed
scottkosty opened this issue Jun 13, 2018 · 3 comments
Closed

simultaneous overall prediction bands #8

scottkosty opened this issue Jun 13, 2018 · 3 comments

Comments

@scottkosty
Copy link

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.

@alexpghayes
Copy link

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?

@scottkosty
Copy link
Author

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
Copy link
Owner

This issue was moved to gavinsimpson/gratia#4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants