Worked Example 6 - Running Model For Multiple Parameter Sets
BWorkedExampleFModelRunMulti.Rmd
This worked example demonstrates how to run the model for multiple sets of input parameters in parallel. Sets of input parameters can represent different regions (with different population, vaccination and spillover FOI and R0 inputs), the same region under different burden conditions (with different spillover FOI and R0 inputs), or the same region in different vaccination scenarios (with different vaccination inputs).
[TBA - Link to odin.dust documentation on running multiple parameter sets]
We load input data in the appropriate format (see Guide 1 - Inputs) as in Worked Example 1 - Single Model Run. Here we want to run the model for all 25 regions listed.
library(YEP)
input_data <- readRDS(file = paste(path.package("YEP"),
"/exdata/input_data_example.Rds", sep = ""))
vacc_data <- input_data$vacc_data
pop_data <- input_data$pop_data
n_regions <- length(input_data$region_labels)
We set up the inputs in a similar manner to Worked Example 1, but here the spillover FOI and R0 inputs are vectors with lengths equal to the number of parameter sets to run (here equal to the number of regions) and vacc_data and pop_data are 3-dimensional arrays instead of 2-dimensional ones, with the first dimension being the parameter sets (regions here). If mode_start = 2, start_SEIRV should be a [TBA].
FOI_spillover <- rep(1.0e-8,n_regions)
R0 <- rep(1.5,n_regions)
years_data <- c(2000)
start_SEIRV <- NULL
output_type <- "full"
year0 <- input_data$years_labels[1]
mode_start <- 1
vaccine_efficacy <- 1.0
dt <- 1.0
n_particles <- 5
n_threads <- n_regions*n_particles
deterministic <- FALSE
We use the Model_Run_Multi_Input() function to run the model for the inputs above:
test1 <- Model_Run_Multi_Input(FOI_spillover, R0, vacc_data, pop_data, years_data,
start_SEIRV, output_type, year0, mode_start, vaccine_efficacy,
dt, n_particles, n_threads, deterministic)
The output is a list with a length equal to the number of parameter sets, where each entry is a set of SEIRV data in the same format as the output of Model_Run().