pbs-assess / sdmTMB

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

Add sub-regions to get_index() #166

Closed ericward-noaa closed 1 year ago

ericward-noaa commented 1 year ago

Scenario that's come up: we have a model like the basic pcod example

fit <- sdmTMB(
  density ~ s(depth),
  data = pcod_2011, mesh = mesh,
  family = tweedie(link = "log")
)

Let's say the survey domain consists of 2-3 sub areas, and we want to create an index for each. One way to do this now is to call the get_index() function 3x, with a different prediction grid for each sub area. It seems like an alternative would be to have a variable in the prediction grid ("A", "B", "C"), with another argument to get_index(..., region_name = "zzz") or similar . Also referencing this in Discussion

ecophilina commented 1 year ago

Did you end up doing this, or decide not to?

seananderson commented 1 year ago

I think decide not to since it's relatively easy to with the existing function and it would add complexity. Here's an example:

https://github.com/pbs-assess/sdmTMB/discussions/167#discussioncomment-4761404