library("rstanmed") # Assumes SEER data is stored as txt in Data/Raw/ subfolder # Assumed CanCORS colorectal cohort is as CSV in Data/Raw/ subfolder dir <- paste0(getwd(), "/") # Main -------------------------------------------------------------------- options(mc.cores = 4) bayes_res <- run_data_app(seer_file_path = paste0(dir, "Data/Raw/data_SEER_for_BSA_summer_project.txt"), cancors_file_path = paste0(dir, "Data/Raw/selected_cancors_data_2016_3_14.csv"), samples_file_path = paste0(dir, "data_app_samples_", format(Sys.Date(), "%Y%m%d"), ".csv"), am_intx = 1, inf_fact = 1, chains = 4, iter = 2000, seed = 20200219, init_r = 0.05, control = list(adapt_delta = 0.97, max_treedepth = 20), auto_write = TRUE, mc.cores = 4) rstan::summary(bayes_res, par = "meffects[1]")$summary[,"n_eff"] rstan::summary(bayes_res, par = "meffects[1]")$summary[,"Rhat"] # Inflation factor -------------------------------------------------------- dainf_res <- run_data_app(seer_file_path = paste0(dir, "Data/Raw/data_SEER_for_BSA_summer_project.txt"), cancors_file_path = paste0(dir, "Data/Raw/selected_cancors_data_2016_3_14.csv"), samples_file_path = paste0(dir, "data_app_samples_", format(Sys.Date(), "%Y%m%d"), ".csv"), am_intx = 1, inf_fact = 10, chains = 4, iter = 2000, seed = 20201101, init_r = 0.05, control = list(adapt_delta = 0.95, max_treedepth = 15), auto_write = TRUE, mc.cores = 4) rstan::summary(dainf_res, par = "meffects[1]")$summary[,"n_eff"] rstan::summary(dainf_res, par = "meffects[1]")$summary[,"Rhat"]