pbs-assess / sdmTMB

:earth_americas: An R package for spatial and spatiotemporal GLMMs with TMB
https://pbs-assess.github.io/sdmTMB/
182 stars 26 forks source link

Adding `getsd = TRUE` to `sdmTMBcontrol` #311

Closed James-Thorson-NOAA closed 4 months ago

James-Thorson-NOAA commented 4 months ago

I'd like to use sdmTMB to build a model without running it, so that I can more easily diagnose issues during convergence. I think the easiest way to do that is add getsd=TRUE to sdmTMBcontrol(.), so that users can do getsd=FALSE, newton_loops = 0, nlminb_loops = 0 to get the build object without running it. getsd=FALSE would then skip sdreport and get_convergence_diagnostics calls in sdmTMB.

Does that sound like a useful PR to do on main branch, or any suggestions on alternative ways to do this?

PS: using it in this way also requires changing assert_that to validate_that in the auto-check about the passed value of nlminb_loops

James-Thorson-NOAA commented 4 months ago

Nevermind, I think I see that sdmTMB( ..., do_fit = FALSE) will do what I'm intending.

seananderson commented 4 months ago

Yeah, do_fit = FALSE should work. The argument is modelled after what glmmTMB does.