In this repository, we reimplement LCMCR in Stan (see paper), and diagnose and fix the causes of poor mixing and divergent transitions.
The repository structure is broken up into atomic tasks joined together using Make (see this blogpost on Principled Data Processing). In particular we have the following directory structure:
stan
: the raw Stan source code for the modelscompile
: compiles the Stan codeimport
: generates the simulated (and other) datafit
: fits the compiled models (and the R LCMCR code by comparison) against all the datasetssummaries
: creates summaries of each of the fitswrite
: generates the figures ultimately used in the blogpost
We are using an experimental version of the R LCMCR package that takes two parameters: a_lambda
and b_lambda
. Create a directory called opt/
from the root project directory, and install the package there: install.packages('R_Package_basic/output/LCMCR_0.5.0.tar.gz', lib = '~/path/to/project/opt')
.
Aside from the experimental LCMCR package, the main R dependency is pacman
. If it is not installed, run
Rscript -e 'install.packages("pacman")'
in the terminal. To run the project from end-to-end, which will install the necessary dependencies, run make
.
Note: make
will install the required R dependencies, including cmdstanr
, which will in turn install Stan.