Optimizing Sepsis Time Zero Definitions Based on Associations Between Time-to-Antibiotics and Mortality
This repository contains R code for the inverse probability weighting (IPW) analysis within the above manuscript.
R version ≥4.0.2 and the following packages: data.table, progressr, and tidyverse.
-
ipw_run.RDescription: The primary script that runs the IPW analysis, including loading of the input person-time dataset, data cleanup, generation of point estimates, bootstrapping, generating summary tables, and saving output files. This script can be invoked directly and expects 2 to 4 command line arguments:
$ ./ipw_run.R MODEL_NAME INPUT_FILE [NUM_WORKERS] [NUM_BOOTSTRAPS]MODEL_NAMEspecifies the variables included in the pooled over time logistic regression model. Possible values includenone,baseline_HCA, andmax_HCA(the fully adjusted model including time-varying covariates).Input files:
$INPUT_FILE<- the input person-time dataset, in either CSV or RDS format
Output files:
$INPUT_FILE.after_setup.rds<- a cache of the dataset after cleanup/setup procedures$INPUT_FILE.adj-$MODEL_NAME.est_debug.txt<- contains debug info for the point estimates$INPUT_FILE.adj-$MODEL_NAME.est_summary.csv<- a summary of point estimates$INPUT_FILE.adj-$MODEL_NAME.boot-$NUM_BOOTSTRAPS.rds<- estimates for the bootstrap replicates$INPUT_FILE.adj-$MODEL_NAME.boot_summary-$NUM_BOOTSTRAPS.csv<- a summary of the bootstraps
-
ipw_setup.RDescription: Setup and cleanup functions for the input person-time datasets for
ipw_run.R. The most important exported function isipw_setup(), which runs the entire setup process. -
ipw_boot.RDescription: Contains the primary steps of the IPW analysis that are called by
ipw_run.R.The most important exported functions are:
ipw_est()<- creates point estimatesipw_boot()<- creates bootstrapped estimates that can be used to construct a 95% CIsummarize_ipw_est()<- creates summary statistics for the point estimatessummarize_ipw_boot()<- creates summary statistics for the bootrapped estimates
MIT. See LICENSE.txt
For questions, clarifications, or further support, please contact:
Theodore Pak, MD, PhD — theodore (dot) pak (at) uci (dot) edu