pbs-assess / sdmTMB

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

improving run times with predict(, se_fit = TRUE) #10

Closed Lewis-Barnett-NOAA closed 5 years ago

Lewis-Barnett-NOAA commented 5 years ago

Is there any hope for this beyond coarsening the resolution of the prediction grid? I tried estimating the standard errors for a single west coast example and it was running for hours before I aborted the process.

seananderson commented 5 years ago

That or simplifying the model in some other way such as reducing the number of knots or the number of random fields. A piecewise approximation might be a little bit faster, I'm not sure. I imagine the number of predictions will have the biggest effect though. All se_fit = TRUE does is turn on this line during the predictions: https://github.com/pbs-assess/sdmTMB/blob/59128e924706ebeaba03852cac3e7438c32a1562/src/sdmTMB.cpp#L437

There might be a reason why you tend to see standard errors on derived parameters and coefficients but not the gridded predictions from these types of models in TMB.

I suppose it would also be possible to only predict on a subset of the full resolution grid as an alternative.

Lewis-Barnett-NOAA commented 5 years ago

Makes sense, thanks Sean. I realize this certainly isn't a sdmTMB-specific issue.