The code to run the analyses in this article can be found on the linked gitlab repository, [sadilcowellhuber2019][1]. That defines a set of `R` functions, as well as the main Stan files (in *src*).
The package can be built with Rstudio, compiling the Stan models for future use.
Note that the analyses themselves relied heavily on the [MGHPCC][2]. Without access to a cluster, most analyses would take prohibitively long. Instead, the results are stored as [drake][3] caches. These caches are stored in the linked box component of this osf project.
So, to access the code
1) Download a copy of the gitlab repository
2) Build the package (e.g., using Rstudio)
3) Download the caches.
- Note that the caches are gzipped, and the larger ones are additionally split into multiple files (those ending with part-##). To access recombine the split files, use a command like the following to reproduce the single compressed archive.
`cat cache_fig-recovery-cor* > cache_fig-recovery-cor.tar.gz`
- All compressed archives be unpacked with a command like
`tar -xvf cache_fig-recovery-cor.tar.gz`
4) At this point, move the uncompressed caches into the folder 'data-raw/caches.'
5) Now figures from the article can be recreated by running the scripts in the 'data-raw' folder. For example, sourcing figure4.R will reproduce Figure 4 from the manuscript.
6) These caches also store a record of the function calls that were used to generate the cached results. To see those functions, a command like the following can be called
`drake::read_drake_plan(cache=drake::this_cache(file.path('data-raw','caches','cache_fig-recovery-cor')))`
where, as above, the `cache_fig-recovery-cor` part should be replaced with whichever plan you're looking for.
[1]: https://gitlab.com/psadil/sadilcowellhube-r2019
[2]: https://mghpcc.umass.edu
[3]: https://ropensci.github.io/drake/