intermed
/`simulationsSimulation studies for manuscript "Nonparametric estimators of mediation effects with multiple mediators"
Author: David Benkeser and Jialu Ran
This repository houses simulation code for replicating simulation results. There are five simulations. Each simulation is run at four sample sizes on one thousand simulated data sets.
The code is organized using a Makefile
with package management via the renv
package.
The general work flow for simulations is as follows.
Install the renv
package in R
(e.g., via install.packages
). From the
simulations
folder, synchronize the package environment as follows.
Rscript -e "renv::restore()"
This command will install packages from the project lockfile.
make
the simulation parametersmake output/parm.RData
This creates the .RData
file that defines the parameters for simulation jobs.
make
the simulation resultsmake simulation_results
This command will only work on a slurm
cluster -- it submits 20k jobs using
sbatch
. Some modification to the Make
recipe may be needed depending on
cluster configuration.
If a cluster is not available, then it should be straightforward to follow the logic of the code to reproduce the results using some other form of high throughput computing.
The simulation_results
recipe generates 20k output files that need to be
merged.
make merge_results
make
the figuresmake figures
This makes all figures presented in the main text and supplement.
make
the heatmaps illustrating mediator distributionsmake heatmaps
The code for executing the G-computation simulation included in the supplement is included in a separate repository.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.