Closed ecophilina closed 10 months ago
This part: https://github.com/pbs-assess/sdmTMB/blob/48b391434e9b214c97a3c24cf4f6f7548cac0272/R/predict.R#L838-L840
which is parsing the results from the TMB report, needs to be finished. It needs to match something like this, which is for newdata
:
https://github.com/pbs-assess/sdmTMB/blob/48b391434e9b214c97a3c24cf4f6f7548cac0272/R/predict.R#L717-L719
https://github.com/pbs-assess/sdmTMB/blob/48b391434e9b214c97a3c24cf4f6f7548cac0272/R/predict.R#L691-L694
There may be some other reason why I disabled this, but I can't remember right now. An easy hack would be internally setting newdata = object$data
in the case of spatially varying coefficients, but that is slightly slower to return.
I'm also getting this error as well when calling the dharma_residuals()
function in sdmTMBextra
s_spp_re <- simulate(fit_spp_re, nsim = 500)
r_spp_re <- sdmTMBextra::dharma_residuals(s_spp_re, fit_spp_re, plot = FALSE)
Error in `predict()`:
! Prediction with `newdata = NULL` is not supported with spatially varying coefficients yet.
Please provide your data to `newdata`.
Run `rlang::last_trace()` to see where the error occurred.
OK, fixed now. All I had to do was uncomment that code. I wish I could remember why I disabled it at some point, but everything looks fine to me in tests.
Not obvious why this is the case. Would be nice if it would use the model data like all other cases.