Description Usage Arguments Value Examples
Run multiple bootstrapped change_point comparisons (in parallel)
1 2 3 4 5 6 7 8 | compare_cp_methods_bootstrap(
sim_data,
boot_trials = 100L,
num_cores = NULL,
method1,
method2,
loss_fun
)
|
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) |
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 |
method1 |
First change point method to compare |
method2 |
Second change point method to compare |
loss_fun |
The loss function used in the comparison (mean squared error (MSE), root mean squared error (RMSE), mean absolute error (MAE), mean squared log error (MSLE), or root mean squared log error (RMSLE) |
week_period |
Logical to incorporate a "day of the week" effect into. |
eval_criteria |
The evaluation criteria used to find change points, if using a linear regression method |
A tibble with two columns: 1) the bootstrap trial, 3) results from each trial (each trial contains a nested tibble with 3 columns: 1) the loss function used, 2) the value for method 1, and 3) the value for method 2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #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 (note = enter any cp_method here, it just acts as a place holder)
tmp_sim_data <- prep_sim_data(final_time_map, event_name = "any_ssd", cp_method = "lm", start_day = 1L, by_days = 1L,
week_period = TRUE)
# run bootstrapped comparisons between two method (e.g. lm_cube vs. cusum) based on MSE
results <- compare_cp_methods_bootstrap(sim_data = tmp_sim_data,
boot_trials = 1000L,
num_cores = NULL,
method1 = "lm_cube",
method2 = "cusum",
loss_fun = "MSE")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.