jsocolar / flocker

flexible occupancy estimation in R
Other
30 stars 3 forks source link

Spatial Gaussian Process models in flocker #61

Closed KBrunk01 closed 1 year ago

KBrunk01 commented 1 year ago

Hey Jacob! I'm using flocker to run occupancy models with passive acoustic monitoring data, and I'd like to incorporate a spatial Gaussian process to account for spatial autocorrelation. I am able to run flocker with a gaussian process (using brms syntax), but it seems like flocker can't do much with the resulting brms fit object and throws errors. I am fairly new to stan and brms, so it's possible it's mostly user error, but I'm curious if you'd expect a gaussian process to be implementable within flocker at this stage. If so, I can reproduce some of my error messages. Thanks in advance for any thoughts!

jsocolar commented 1 year ago

Hi @KBrunk01 ! Flocker is definitely supposed to support all of the models that brms supports, but the post-processing is currently a bit hit-or-miss, because much of it needs to be re-implemented natively--that is, you can't necessarily expect to be able to call every post-processing function from brms on a flocker fit and have it work.

My intention is to support (almost) all of the post-processing functionality from brms (one exception--at least for now--is approximate leave-one-out cross validation with moment matching), but this is a work in progress!

Two questions for you:

  1. What post-processing functions do you need to run? I can prioritize getting these up and running sooner rather than later (unless it's LOO with moment matching), or if they're already supposed to work I can troubleshoot that for you. Some of the brms post-processing is already implemented in separate native flocker functions, so in a best case scenario maybe I can just point you to the functions that you need to use.
  2. If you fit a model without the GP, does the post processing work? It shouldn't, which is to say that any post-processing that works without a GP should work with a GP. If you have a reprex where the addition of a GP term breaks post-processing, I'd very much appreciate a bug report, as that would likely indicate a bug in either flocker or in brms.
jsocolar commented 1 year ago

Oh, another question is what flavor of occupancy model you're working with. Is this a single-season model, or a multiseason model? Does it involve a false-positive detection component? The post processing functionality for models other than the single-season model is a bit behind the functionality for the single-season model.

jsocolar commented 1 year ago

@KBrunk01 if you are working with a garden-variety single season model, almost all post-processing should now be possible. If you are working with some other model type, let me know and I can see if I can prioritize getting whatever processing you need up and running.

KBrunk01 commented 1 year ago

Hey Jacob - sorry for the lack of response on this end! Yes - I was using a single-season model with no fancy additions (false positives, etc.) besides the spatial gaussian process. I will try to get back to this project next week, but I will close the issue in the meantime, and I can open it back up if needed. Thanks!