c-rutter / crcrdm

Robust Decision Making Tools for Cancer Screening Models
https://c-rutter.github.io/crcrdm/
GNU General Public License v2.0
3 stars 0 forks source link

Set Design from csv #15

Closed pedroliman closed 3 years ago

pedroliman commented 3 years ago

Set design from csv

pedroliman commented 3 years ago

This was recently implemented. Now the r experiment$set_design() function , accepts the grid_design_df parameter:

n_sensitivities = 10
sensitivity_design = data.frame(
  se.5 = seq.default(from = 0.2,to = 0.75, length.out = n_sensitivities),
  se.10 = seq.default(from = 0.55,to = 0.85, length.out = n_sensitivities),
  se.20 = seq.default(from = 0.90,to = 0.98, length.out = n_sensitivities),
  se.40 = seq.default(from = 0.95,to = 0.99, length.out = n_sensitivities)
) %>%
  mutate(id = row_number())

# Adding colonoscopy intervals:
colonoscopy.intervals = c(3,5,7:13,15,17)

grid_design = expand.grid(sensitivity_design$id, colonoscopy.intervals)
names(grid_design) = c("id", "colonoscopy_interval")

grid_design = grid_design %>%
  left_join(sensitivity_design, by = "id") %>%
  select(-id)

# Creating an experiment --------------------------------------------------
experiment = crcexperiment$new(avg_model, model)

# setting the Experimental Design
experiment$set_design(blocks = 1, grid_design_df = grid_design)

This is used here: https://github.com/c-rutter/rdmcolon/blob/master/R/01_create_experiment.R