This repository contains the R code used for the analyses presented in the paper
"Disentangling Determinants of One-Year modified Rankin Scale in Patients with Incidentally Detected Solitary Intracranial Aneurysms".
All package dependencies are managed using renv. To restore the environment, run the following commands in R:
install.packages("renv") # if renv is not already installed
renv::restore() # restore packages from renv.lockThe repository includes the following files:
-
README.md: This file, providing an overview of the repository. -
data/: A directory containing the synthetic data used to reproduce the analysis (synthetic_dataset.rds). As well as the matrices containing the applied prior knowledge for the creation of all ABN models, i.e., a priori restricting and enforcing of arcs (prior_knowledge.xlxs). -
renv.lock: A file containing the R package versions used in this project. -
results/: A directory where the output results and figures are saved. With a subfolder for the outputs for the mcmcABN runs for the two models (recoveryandmanagement_effect). As the mRS at Baseline was imputed, there are separate subfolders for the results of each imputed data set (imp1toimp10andconsensus) in the later folder. -
scripts/: A directory containing the R scripts used for data analysis and figure generation:00_functions.R: Script containing all functions used in the analysis.00_mcmc_functions.R: Script containing all functions related to MCMC sampling.00_imputation.R: Script for performing the multiple imputation on the synthetic data set.01_setup.R: Script for loading necessary packages, defining the color palette. Additionally the synthetic data set is loaded here as well as all functions needed. As a last step, the imputation is performed. Thus, running this file is sufficient to set up the entire analysis performed in the later scripts.02_descriptives.R: Script for generating descriptive statistics and visualizations of the synthetic data set.03_modality_perprotocol.R: Script for performing the analysis on the modality chosen and the adherence to the protocol.04_recovery.R: Script for performing the recovery analysis, consisting of two parts: A) Regression analysis on the recovery using CMP-regression. B) ABN analysis to explore dependencies between variables related to recovery, including MCMCabn.05_management_effect.R: Script for performing the analysis on the effect of management strategy in two parts: A) Regression analysis on the effect of management strategy using CMP-regression and IPW. B) ABN analysis to explore dependencies between variables related to management strategy, including MCMCabn for all 10 imputed data sets.
- The synthetic data set is generated to mimic the structure and characteristics of a real data set. Note that it is provided for demonstration purposes only and does not contain any real patient data. Thus the results also differ from those presented in the paper.
- The analysis scripts are designed to be run sequentially, starting from
01_setup.Rto ensure that all necessary data and functions are loaded before proceeding with the analyses. - All results generated by the analysis scripts are saved in the
results/directory for easy access and review.- For demonstration purposes, example results from the synthetic data set are included in the repository, generated with 10,000 MCMC iterations.
- For the actual data set, 100,000 MCMC iterations were used to obtain the final results.
- For any questions or further clarifications regarding the code or analyses, please refer to the contact information provided in the paper.
- For the installation of
abn(), please refer to it's GitHub page (https://github.com/furrer-lab/abn).