Guide 2 - Calculating Parameters From Environmental Data
CGuideBParametersEnvironment.Rmd
This vignette demonstrates how the package generates values of epidemiological parameters (the force of infection for spillover from the sylvatic reservoir and the basic reproduction number for human-to-human transmission) from environmental covariates (including population, vegetation coverage, temperature suitability for yellow fever-carrying mosquitoes and non-human primate species richness). This approach is used to calculate epidemiological parameter values for a set of regions with known values of environmental covariates from a single set of coefficients.
For more information and background on the use of environmental covariates and the selection of covariates for use, see The global burden of yellow fever (Gaythorpe et al, 2021, eLife).
Environmental data is stored as a data frame with each line containing covariate values for one region, with the headings giving the variable names. In this imaginary example, the environmental covariates are simply named Var1-5.
library(YEP)
enviro_data <- read.csv(file = paste(path.package("YEP"),
"/exdata/enviro_data_example.csv",
sep = ""), header = TRUE)
head(enviro_data, 5)
Logarithmic values of the coefficients of the environmental covariates are stored as a data frame with the headings in the format FOI_(variable name) and R0_(variable name). In the example below, only one set of coefficient values are given, but multiple sets of coefficient values (e.g. a distribution of value estimates) can be used to produce a distribution of epidemiological parameter values, as shown below.
enviro_coeffs <- read.csv(file = paste(path.package("YEP"),
"/exdata/enviro_coeffs_example.csv",
sep = ""), header = TRUE)
enviro_coeffs
Covariate and coefficient values can be combined to produce values of the spillover force of infection and basic reproduction number using the param_calc_enviro() function.
n_regions <- nrow(enviro_data)
epi_data <- data.frame(region = enviro_data$region, FOI = rep(NA, n_regions),
R0 = rep(NA, n_regions))
for(n_region in 1:n_regions){
FOI_R0_values <- param_calc_enviro(enviro_coeffs = enviro_coeffs[1, ],
enviro_covar_values = enviro_data[n_region,c(2:ncol(enviro_data))])
epi_data$FOI[n_region] <- FOI_R0_values$FOI
epi_data$R0[n_region] <- FOI_R0_values$R0
}
head(epi_data, 5)
Spillover FOI and R0 data obtained in this way can be plotted on a map of the regions under consideration using the create_map function(), as can other regional data such as the values of the environmental covariates. Regional boundary data is loaded from one or more shapefiles of the format used by GADM using the map_shapes_load() function
regions=epi_data$region
shape_data <- map_shapes_load(regions, shapefiles=c(paste(path.package("YEP"),
"/exdata/shapefile_example.shp", sep = "")),
region_label_type="GID_1")
colour_scheme=readRDS(file=paste(path.package("YEP"),
"/exdata/colour_scheme_example.Rds", sep="/"))
colour_scale=colour_scheme$colour_scale
null1 <- create_map(shape_data, epi_data$FOI, scale=pretty(epi_data$FOI, 8),
colour_scale, pixels_max=720, text_size=0.75, map_title="",
legend_title="FOI", legend_position="topleft", legend_format="e",
legend_dp=1, output_file=NULL)
null2 <- create_map(shape_data, epi_data$R0, scale=pretty(epi_data$R0, 8),
colour_scale, pixels_max=720, text_size=0.75, map_title="",
legend_title="R0", legend_position="topleft", legend_format="f",
legend_dp=1, output_file=NULL)
To generate a distribution of spillover FOI and R0 values for each region, a distribution of environmental coefficient values can be used:
enviro_coeffs2 <- read.csv(file = paste(path.package("YEP"),
"/exdata/enviro_coeffs_example_multi.csv",
sep = ""), header = TRUE)
head(enviro_coeffs2, 5)
n_values=nrow(enviro_coeffs2)
epi_data <- list(FOI = array(NA, dim = c(n_values,n_regions)),
R0 = array(NA, dim = c(n_values,n_regions)))
for(n_value in 1:n_values){
for(n_region in 1:n_regions){
FOI_R0_values <- param_calc_enviro(enviro_coeffs = as.numeric(enviro_coeffs2[n_value, ]),
enviro_covar_values = enviro_data[n_region, c(2:ncol(enviro_data))])
epi_data$FOI[n_value,n_region] <- FOI_R0_values$FOI
epi_data$R0[n_value,n_region] <- FOI_R0_values$R0
}
}