Does cross validation (sdmTMB_cv) work with delta models? #111
-
Question via email: does cross validation (sdmTMB_cv) work with delta models? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
The delta model features are relatively new, and compatibility with
Next, we have to make predictions for the binomial component -- and calculate the likelihood
The gamma likelihood is a little trickier,
The total likelihood is just the sum of the 2 components, The 'tot_like' is the total out of sample predictive density, and it's something you want to maximize via model selection. Another issue to be worked out is how to best select the training data. The above approach is totally random, which might be fine. But there's some recent work (see blockCV or spatialsample R packages) that can do spatial blocking -- to reduce autocorrelation between test / training data. This is a very active area of current research. |
Beta Was this translation helpful? Give feedback.
-
Good morning, I was wondering if doing cross-validation with sdmTMB_cv is still not compatible with delta-gamma model. if so, could I manually do a test/train "leaving the future out" (i.e. leaving the last 3 years of my dataset out and seen how good the model predicts these years) and then using the script you shared here to calculate likelihood of the predictions? Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
Hi -- this is still not implemented for delta models. I think maybe an even easier approach compared to the above script would just be to use the |
Beta Was this translation helpful? Give feedback.
-
Cross validation is now working with delta models: library(sdmTMB)
future::plan(future::multisession)
out_dg <- sdmTMB_cv(
density ~ depth_scaled,
data = pcod_2011,
mesh = make_mesh(pcod_2011, c("X", "Y"), cutoff = 10),
family = delta_gamma(),
k_folds = 5
)
#> Running fits with `future.apply()`.
#> Set a parallel `future::plan()` to use parallel processing.
out_dg$fold_loglik
#> [1] -531.3995 -702.3048 -591.7539 -608.1418 -611.2388
out_dg$sum_loglik
#> [1] -3044.839 |
Beta Was this translation helpful? Give feedback.
Cross validation is now working with delta models: