Skip to contents

This worked example demonstrates how to set up and run the reactive version of the standard yellow fever dynamic model presented in the YEP package. The reactive version differs from the standard version (which is described in this worked example) in [TBA]

The inputs for the Model_Run_Reactive() function, which runs this version of the model, are the same as for the Model_Run function in the YEP package, except that (as with the other alternate versions in this package) there is no variable output type - the function always outputs detailed SEIRV data for every time point and age group (equivalent to setting output_type=“full” in Model_Run()). There are also three additional inputs [TBA]

library(YellowFeverDynamics)
input_data <- readRDS(file = paste(path.package("YellowFeverDynamics"), 
                                   "/exdata/input_data_example.Rds", sep = ""))
#[TBA]
vacc_data1 <- input_data$vacc_data[1, , ]*0
#[TBA]
vacc_data2 <- input_data$vacc_data[1, , ]
pop_data <- input_data$pop_data[1, , ]  
# Force of infection due to spillover from sylvatic reservoir
FOI_spillover <- 1.0e-8             
# Basic reproduction number for urban spread of infection
R0 <- 1.5             
# Year(s) for which data is to be output
years_data <- c(2000)
# SEIRV data from end of a previous run to use as input (if mode_start = 2; not 
# used here and hence set to NULL)
start_SEIRV <- NULL           
# First year in population/vaccination data (here taken from the input data set; 
# if the population and vaccination data is set manually, this similarly needs 
# to be set manually)
year0 <- input_data$years_labels[1]
# Flag indicating how to set initial population immunity level in addition to
# vaccination
# If mode_start = 0, only vaccinated individuals are immune (R = 0)
# If mode_start = 1, shift some non-vaccinated individuals into recovered to 
# give herd immunity (R = 1 - 1/R0)
# If mode_start = 2, use SEIRV input in list from previous run(s), set using
# start_SEIRV variable
mode_start <- 1  
# Proportional vaccine efficacy (from 0 to 1); probability of vaccination 
# successfully providing immunity (i.e. moving vaccinated individual to group V)
vaccine_efficacy <- 1.0       
# Time increment in days to use in model (should be 1.0, 2.5 or 5.0 days)
dt <- 1.0            
# Number of particles to run
n_particles <- 10     
# Number of threads to run
n_threads <- 1   
# TBA
deterministic <- FALSE
#[TBA]
p_rep <- c(1,1)
#[TBA]
outbreak_threshold1 <- Inf
#[TBA]
cluster_threshold1 <- 1.0

We run Model_Run_Reactive() as shown:

test1 <- Model_Run_Reactive(FOI_spillover, R0, vacc_data1, vacc_data2, pop_data, years_data,
                   start_SEIRV, year0, mode_start, vaccine_efficacy, dt, 
                   n_particles, n_threads, deterministic, p_rep, 
                   outbreak_threshold1, cluster_threshold1)

As with YEP::Model_Run(), we can plot the output:

library(YFDaux)
plot <- plot_model_output(test1)
print(plot)