run_cp_bootstrap | R Documentation |
Run multiple bootstrapped change_point simulations (in parallel)
run_cp_bootstrap( sim_data, boot_trials = 100, n_sim_trials = 50, sim_algorithm = "simple", sim_ctrl = NULL, num_cores = NULL, no_bootstrapping = FALSE )
sim_data |
A dataset containing the time_map, miss bins and other parameters used for the simulation. This dataset should be created using the 'prep_sim_data()' function |
boot_trials |
The number of bootstrapped trials to run (default is 100) |
n_sim_trials |
The number of trials to run in simulation of miss visits (default is 50) |
num_cores |
The number of worker cores to use. If not specified will determined the number of cores based on the which ever is the smallest value between number of boot_trials or detected number of cores - 1 |
no_bootstrapping |
Specifies whether you want to run the simulations without bootstrapping the original dataset |
new_draw_weight |
A weighing parameter used to assign preference to drawing previously "missed" patients at each time step. A value of 0 applies strict preference to drawing patients who have been assigned to miss in prior time steps, while a value 0.5 applies equal weight to patients who have and have not been previously selected |
### Run simulations with bootstrapping and allow change point to vary with each bootstrap sample ### #load example final_time_map dataset load("/Shared/Statepi_Diagnosis/grant_projects/hsv_enceph/scripts/validation/enrolled_ge_365/report_data.RData") # rename ED column final_time_map <- final_time_map %>% rename(ed = ED) # run prep sim function tmp_sim_data <- prep_sim_data(final_time_map, event_name = "any_ssd", cp_method = "cusum", start_day = 1L, by_days = 1L, week_period = TRUE) #run simulations on number of visits simulation_results <- run_cp_bootstrap(tmp_sim_data, boot_trials = 500, n_sim_trials = 50, sim_algorithm = sim_algorithm, sim_ctrl = sim_ctrl, num_cores = NULL, no_bootstrapping = FALSE) ### Run simulations with bootstrapping and specify a change point applied to each bootstrap sample ### # set a change point cp <- 20L # run prep sim function tmp_sim_data <- prep_sim_data(final_time_map, event_name = "any_ssd", cp_method = "cusum", start_day = 1L, by_days = 1L, week_period = TRUE, specify_cp = cp) #run simulations on number of visits simulation_results <- run_cp_bootstrap(tmp_sim_data, boot_trials = 500, n_sim_trials = 50, sim_algorithm = sim_algorithm, sim_ctrl = sim_ctrl, num_cores = NULL, no_bootstrapping = FALSE) ### Run simulations without bootstrapping and allow function to find the optimal change point for inputted data ### # run prep sim function tmp_sim_data <- prep_sim_data(final_time_map, event_name = "any_ssd", cp_method = "cusum", start_day = 1L, by_days = 1L, week_period = TRUE) #run simulations on number of visits simulation_results <- run_cp_bootstrap(tmp_sim_data, boot_trials = 0, n_sim_trials = 25000, sim_algorithm = sim_algorithm, sim_ctrl = sim_ctrl, num_cores = NULL, no_bootstrapping = TRUE) ### Run simulations without bootstrapping and specify a change point instead of allowing function to find the optimal change point to apply to the data ### # set a change point cp <- 20L # run prep sim function tmp_sim_data <- prep_sim_data(final_time_map, event_name = "any_ssd", cp_method = "cusum", start_day = 1L, by_days = 1L, week_period = TRUE, specify_cp = cp) #run simulations on number of visits simulation_results <- run_cp_bootstrap(tmp_sim_data, boot_trials = 0, n_sim_trials = 25000, sim_algorithm = sim_algorithm, sim_ctrl = sim_ctrl, num_cores = NULL, no_bootstrapping = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.