Regional-Fish-Modeling / Spatial-Analysis

Spatial analysis of brook trout count data: INLA, semivariograms, etc
0 stars 0 forks source link

Software for Spatiotemporal Analysis #1

Open djhocking opened 8 years ago

djhocking commented 8 years ago

TMB is used through R exclusively with the TMB package, although it requires a separate cpp script with the model. It's kid of analogous to using JAGS (where the model is written in BUGS language and save as a txt file). The cpp code takes a little getting used to but isn't that hard because the actual TMB program includes cpp functions that make TMB code look and act more like R code (Kasper coded probability functions to look like those in R).

TMB using Automatic Differentiation like ADMB but is MUCH faster than ADMB. It is frequentist unlike INLA which is Bayesian, so it's very, very fast. This is valuable with complex spatiotemporal problems and when doing simulations. Despite the time, I do usually prefer Bayesian approaches because it makes for easier predictions and probabilistic uncertainty statements (credible intervals). However, INLA is as currently programmed is not flexible enough to include things like detection probability, limiting it's usefulness for me. Other Bayesian programs like JAGS and WinBUGS (with it's spatial add-on) are flexible enough but too slow. In Stan it would be fast but too difficult (for me right now) to figure out a way to marginalize the latent random effects as needed by the HMC updater. That essentially leaves hand coding a Metropolis-Hastings algorithm and doing the tuning, but R is so slow that it would really need to be done in cpp. That seems like more of a pain then just using TMB and freqentist inference.

All that being said, saw that Mevin Hooten and colleagues have an R package called STabundance (Spatiotemporal Abundance: https://github.com/pconn/STabundance) that does what we what in a Bayesian framework. I haven't dug into it yet but there is basically no documentation or examples, so it will be challenging to get up to speed at first.

djhocking commented 8 years ago

the hSDM package might also provide some potential options as it is spatial and includes detection observation processes, but it may be limited to occupancy (I thought I read at some point that it did abundance too but it might not be sufficient for spatiotemporal abundance models with detection).

http://hsdm.sourceforge.net/ http://sourceforge.net/p/hsdm/code/ci/master/tree/

One other limitation is the detection process might not include a depletion/removal process. If that were the only problem, it could likely be overcome but adjusting the code directly once the package is downloaded or forked from sourceforge.