Code for simulations, tables, and figures for the manuscript Understanding the implications of a complete case analysis for regression models with a right-censored covariate (https://doi.org/10.1080/00031305.2023.2282629).
simulation_study_functions_cc.R
: This script defines the functions used to generate data, run a simulation, and report the results for requested simulation settings.main_cc.R
: This script defines the functions used to estimate the parameters and the variance of the parameters using a complete case analysis or an oracle analysis.simulation_study_cc.R
: You can run a simulation study from inside this script. You can change the settings in the script to run with a certain number of simulations, sample size, number of fully observed covariates, true parameter values, starting values, mean function, censoring rate, censoring mechanism, sigma2, and output file name.dag_cc.R
: This script recreates the Directed Acyclic Graph (DAG) that is in the manuscript.cc_tables.R
: This script recreates the simulation results tables that are in the manuscript main text and supplementary materials.
Note: These scripts assume your working directory is inside the R
subdirectory.
cc_simulation_study.sh
: This is a bash script, which includes an example of another way to runsimulation_study_cc.R
from the command line instead of running the simulations inside the R script itself. To use this on the command line, you would edit the parameters in the file, save, and run the commandbash cc_simulation_study.sh
in the terminal.
Note: Some syntax in this file may change depending on the environment you are running it in. This is just an example of a bash file based on the computing cluster that was used to run the simulations.