You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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).
From @scottkosty on June 13, 2018 17:43
Consider the following example:
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
The text was updated successfully, but these errors were encountered: