{"id":19557979,"url":"https://github.com/mbjoseph/scr-stan","last_synced_at":"2025-04-26T23:31:38.008Z","repository":{"id":137141834,"uuid":"257470508","full_name":"mbjoseph/scr-stan","owner":"mbjoseph","description":"Spatial capture-recapture models in Stan","archived":false,"fork":false,"pushed_at":"2020-05-17T03:51:10.000Z","size":267,"stargazers_count":22,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-04T18:21:49.484Z","etag":null,"topics":["bayesian-statistics","capture-recapture","data-augmentation","density-estimation","ecology","r","spatial","stan"],"latest_commit_sha":null,"homepage":"","language":"Stan","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbjoseph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-04-21T03:32:19.000Z","updated_at":"2024-05-16T17:48:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"0bb1b889-26a7-4b81-bf0c-df7cc7bf4c22","html_url":"https://github.com/mbjoseph/scr-stan","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"ed0654c21ee955b249191f59feb4e614c1dcada2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbjoseph%2Fscr-stan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbjoseph%2Fscr-stan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbjoseph%2Fscr-stan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbjoseph%2Fscr-stan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbjoseph","download_url":"https://codeload.github.com/mbjoseph/scr-stan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251068038,"owners_count":21531475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian-statistics","capture-recapture","data-augmentation","density-estimation","ecology","r","spatial","stan"],"created_at":"2024-11-11T04:44:38.396Z","updated_at":"2025-04-26T23:31:37.712Z","avatar_url":"https://github.com/mbjoseph.png","language":"Stan","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![](activity-center.png)\n\n# scr-stan: spatial capture-recapture examples in Stan\n\n\u003c!-- badges: start --\u003e\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\u003c!-- badges: end --\u003e\n\nThe goal of scr-stan is to provide Stan implementations for a variety of \nspatial capture-recapture models described in the book \n[Spatial Capture-Recapture](https://www.elsevier.com/books/spatial-capture-recapture/royle/978-0-12-405939-9)\nby Royle, Chandler, Gardner, and Sollmann.\nThe emphasis is on translating models from [JAGS](http://mcmc-jags.sourceforge.net/) to [Stan](https://mc-stan.org/). \n\n### Why?\n\nStan is a flexible language that enables full Bayesian inference with dynamic\nHamiltonian Monte Carlo, approximate Bayesian inference with automatic\ndifferentiation variational inference, and optimization (e.g., penalized \nmaximum likelihood).\n\nThere are some good reasons to use Stan: \n\n- Stan is fast\n- Stan has good [documentation](https://mc-stan.org/users/documentation/)\n- Stan helps you avoid errors with [data types](https://mc-stan.org/docs/2_23/reference-manual/univariate-data-types-and-variable-declarations.html)\n- Stan has good [sampling diagnostics and warnings](https://mc-stan.org/misc/warnings.html)\n- Stan has a healthy [user community](https://discourse.mc-stan.org/)\n\nUsing Stan can be hard for ecologists with experience in JAGS/BUGS/NIMBLE, because \n[you have to marginalize over discrete parameters](https://mc-stan.org/docs/2_23/stan-users-guide/latent-discrete-parameterization.html). \nBut, you don't have to start from scratch. \nThis 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](https://mbjoseph.github.io/posts/2020-04-28-a-step-by-step-guide-to-marginalizing-over-discrete-parameters-for-ecologists-using-stan/) helpful. \n\nHopefully these Stan implementations lower the barrier to entry.\n\n### Dependencies\n\nThese examples use the `scrbook` R package, which you can download from here: \nhttps://sites.google.com/site/spatialcapturerecapture/scrbook-r-package\n\nThe remaining dependencies are on CRAN, and you can install them from R with:\n\n```r\ndevtools::install_deps()\n```\n\n### What's here\n\nThis repo contains a bunch of Stan translations of JAGS models provided in the\nSCR book. \nEach example is a self-contained R script, and one or two Stan files.\n\n- [Chapter 5: fully spatial capture-recapture models](ch05)\n- [Chapter 6: likelihood analysis of spatial capture-recapture models](ch06)\n- [Chapter 7: variation in encounter probability](ch07)\n- [Chapter 8: model selection and assessment](ch08)\n- [Chapter 9: alternative observation models](ch09)\n- [Chapter 11: spatial variation in density](ch11)\n- [Chapter 14: stratified populations: multi-session and multi-site data](ch14)\n- [Chapter 15: models for search-encounter data](ch15)\n- [Chapter 16: open population models](ch16)\n\n### Inspiration\n\nThis repo was built in the spirit of the Hiroki Itô's excellent [Stan \ntranslations of \"Bayesian Population Analysis using \nWinBUGS --- A Hierarchical Perspective\" (2012) by Marc Kéry and Michael Schaub](https://github.com/stan-dev/example-models/tree/master/BPA).\n\n### Contributing\n\nIf you have questions or find any issues, feel free to open an issue on GitHub: \nhttps://github.com/mbjoseph/scr-stan/issues\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbjoseph%2Fscr-stan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbjoseph%2Fscr-stan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbjoseph%2Fscr-stan/lists"}