Spatio-temporal GAM vs sdmTMB Model Standard Errors #179
-
I'm fitting a binomial spatio-temporal SDM in both mgcv and sdmTMB. One model is of course using the SPDE approach, and the other is using spatio-temporal smooth functions. I notice that the GMRF standard errors (on the link scale) change less throughout time when compared to their GAM counterparts. I'm just curious if anybody has any idea why. Is this difference due to GMRFs vs splines? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
It'd be interesting to see the structure of each of the models you're using because there might be subtle differences between the GAM and SPDE implementation (e.g. did you include spatial + spatiotemporal effects? just spatial?) There certainly look to be differences (why can't the GAM predict to the dark grey areas for example?). One reason may be the distribution of spline knots relative to the data is not as uniform as the SPDE mesh? If you haven't seen it, Dave Miller has an awesome paper diving into this comparison more (and it includes code!): https://link.springer.com/article/10.1007/s13253-019-00377-z |
Beta Was this translation helpful? Give feedback.
-
Sorry about the confusion on the dark grey areas! ggplot2 cut that bit off because its off the color scale I used for the other image! :) I used spatio-temporal fields in sdmTMB and a function of (eastings, northings, year) in the GAM. I'm intrigued by your comment regarding the distribution of the spline knots. I wonder if there's a way to check that... |
Beta Was this translation helpful? Give feedback.
-
Yes -- it should be pretty easy to extract. How you do it depends on the type of spline you're using
If you're using p-splines or b-splines
For a cubic regression spline:
Gavin Simpson has a few good blog posts around knots -- and this example shows how to specify knot locations to the |
Beta Was this translation helpful? Give feedback.
-
For the GAM, it could depend on whether you have |
Beta Was this translation helpful? Give feedback.
-
Yeah, its the te() version of s(X, Y, year). TPS, which I think makes things tricky because it doesn't use knots in the traditional way as far as I understand. I suppose using year in an sdmTMB model with spatio-temporal fields would essentially be a repeated slice each year. |
Beta Was this translation helpful? Give feedback.
-
If 2001 and 2019 are the beginning and end (or near to it) then might you just be seeing the uncertainty from the smoother tails? library(mgcv)
#> Loading required package: nlme
#> This is mgcv 1.8-41. For overview type 'help("mgcv-package")'.
fit <- gam(density ~ s(year, k = 3), data = sdmTMB::pcod, family = tw())
plot(fit) Created on 2023-02-15 with reprex v2.0.2 |
Beta Was this translation helpful? Give feedback.
-
Interesting. Yeah, they are the beginning and end years. |
Beta Was this translation helpful? Give feedback.
If 2001 and 2019 are the beginning and end (or near to it) then might you just be seeing the uncertainty from the smoother tails?
Created on 2023-02-15 with reprex v2.0.2