Hi Folks -
Just wanted to put a small something I've been working on out there to see what folks think about it.
This is a stab at making a template for a fully reproducible soup-to-nuts Stan-based project, that starts with input data and ends with a PDF containing figures and estimates derived from the model output. This repository contains all the code needed to re-generate a simple Stan example (fitting a 2-component finite mixture model) with a single command:
The ideas represented here are a crystallization of things that have been going on in a number of other projects of mine that rely on sensitive data and so can't be opened up in a way that is fully reproducible to anyone. There are three big reproducibility ideas in here, some newer than others, none of which are my own but instead represent a synthesis of some very powerful tools and ideas:
1) make: Everything is orchestrated using a Makefile that updates outputs as a function of their dependencies on each other. In some ways, this is the most powerful idea and a very old one.
2)
Docker: One of the challenges of reproducing any project (and Stan ones in particular for non-initiates) is having the relevant software installed locally to both run the Stan model and to do the requisite munging of model output. Docker provides a way to create a portable environment that can run everywhere without forcing users to go through the relatively complicated install process. For example, the example presented here relies on: R, assorted R packages (readr, ggplot2, dplyr, gridExtra), RStan, pandoc, TexLive, etc. The provided Docker image makes it easy to just download the whole environment and re-generate the model results without a complicated local install.
3) Continuous integration (CI): CI tools are commonly used in software engineering to make sure that small changes to a project don't break the whole thing. This project is hosted on Gitlab to take advantage of their easy-to-use and free Docker-based continuous integration service. This way, every time a commit is made to the repository, the Makefile is re-run and the model output (MCMC samples, figures and PDF writeup) are uploaded to the repository and are available for download.
More information (and all the code and output) are available in the repository. It's very much a work-in-progress and is meant more as a prod for more thought and development than anything else, so any feedback would be greatly appreciated!
-Jon