Skip to content

mbjoseph/scr-stan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scr-stan: spatial capture-recapture examples in Stan

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

The goal of scr-stan is to provide Stan implementations for a variety of spatial capture-recapture models described in the book Spatial Capture-Recapture by Royle, Chandler, Gardner, and Sollmann. The emphasis is on translating models from JAGS to Stan.

Why?

Stan is a flexible language that enables full Bayesian inference with dynamic Hamiltonian Monte Carlo, approximate Bayesian inference with automatic differentiation variational inference, and optimization (e.g., penalized maximum likelihood).

There are some good reasons to use Stan:

Using Stan can be hard for ecologists with experience in JAGS/BUGS/NIMBLE, because you have to marginalize over discrete parameters. But, you don't have to start from scratch. This repo provide a variety of examples, and if you've never marginalized over discrete parameters to implement a model in Stan, you might find this tutorial helpful.

Hopefully these Stan implementations lower the barrier to entry.

Dependencies

These examples use the scrbook R package, which you can download from here: https://sites.google.com/site/spatialcapturerecapture/scrbook-r-package

The remaining dependencies are on CRAN, and you can install them from R with:

devtools::install_deps()

What's here

This repo contains a bunch of Stan translations of JAGS models provided in the SCR book. Each example is a self-contained R script, and one or two Stan files.

Inspiration

This repo was built in the spirit of the Hiroki Itô's excellent Stan translations of "Bayesian Population Analysis using WinBUGS --- A Hierarchical Perspective" (2012) by Marc Kéry and Michael Schaub.

Contributing

If you have questions or find any issues, feel free to open an issue on GitHub: https://github.com/mbjoseph/scr-stan/issues