Occupancy modeling is possible in Stan as shown here, despite the lack of support for integer parameters.
In many Bayesian applications of occupancy modeling, the true occupancy states (0 or 1) are directly modeled, but this can be avoided by marginalizing out the true occupancy state.
The Stan manual (pg. 96) gives an example of this kind of marginalization for a discrete change-point model.
Here’s a Stan implementation of a dynamic (multi-year) occupancy model of the sort described by MacKenzie et al. (2003).
Here are the results for the probability of colonization $gamma$, and the probability of persistence $phi$.
The blue dashed line shows the true value, and the dashed red lines shows the mean of all 1000 posterior modes.
The black lines represent the HPDI for each interation, and the black points represent the posterior modes.
This example uses a uniform prior on both of these parameters – probably an overrepresentation of prior ignorance in most real systems.
Based on some initial exploration, this approach seems much much (much?) faster than explicitly modeling the latent occurrence states in JAGS, with better chain mixing and considerably less autocorrelation. Extension to multi-species models should be straightforward too – huzzah!
MacKenzie DI, Nichols JD, Hines JE, Knutson MG, Franklin AB. 2003. Estimating site occupancy, colonization, and local extinction when a species is detected imperfectly. Ecology 84(8): 2200-2207. pdf
To leave a comment for the author, please follow the link and comment on their blog: Ecology in silico.