96% CIs for EDFs in GAMs using mgcv I have been using the mgcv package in R to conduct Generalised Additive Models. I've been using Noam Ross's excellent free course to guide me (thank you Dr Ross). https://noamross.github.io/gams-in-r-course/
However, a coauthor has now asked me to calculate the 95% confidence intervals around the EDF values.
I'm wondering if anyone knows how to do this and could please provide me with any code.
Thank you!
Kimina
 A: I guess you could do it by using the uncertainty estimate of the log smoothness parameter(s) for each smooth and refit the model with the smoothness parameter fixed at the lower bound of the 95% interval (after being transformed back to the non-log scale), record the EDF of the smooth, and then repeat but with the smoothness parameter fixed at the upper bound of the suitably backtransformed 95% interval on the log smoothness parameter.
You can fix smoothness parameters at known values via the sp argument to gam().
That said, this seems like a strange request to me; EDF is more a summary measure of the model complexity. I understand what the coauthor may be getting at with their question, but is I think focusing on the wrong value. Using the log-smoothness parameters and (assuming you fit with method = 'REML') their uncertainty, but visualised through the effect they have on the fitted smooth is one way that I have seen people look at this element of the uncertainty in estimated smooth functions.
You might also consider looking at this paper
Faraway, J., 2016. Confidence bands for smoothness in nonparametric regression. Stat 5, 4–10. https://doi.org/10.1002/sta4.100
