library(pander)
library(ggplot2)
library(dplyr)
library(tidyr)

Epidemiological model provided by the package

The basic epidemiological model in the package is a SEEIIR model, which is a version of the SEIR model, but with both the Exposed and Infected split into two different groups. This results in a more realistic gamma distributed waiting time both between the exposed and infected state and the infected and recovered states.

We also need to keep track of who is vaccinated or not. When a Susceptible is vaccinated there is a certain probability that the person becomes recovered (and vaccinated), or stays susceptible (but vaccinated). This is dependent on the efficacy of the vaccine that season. Once one is in any of the other states, we assume that the vaccine does not influence the progress of the infection. As a result an infected who is vaccinated, will stay infected, but is now also tracked as being vaccinated.

Finally we divide the population into different age groups and risk groups. Different age groups and risk groups will be vaccinated at different rates. Infections between age groups happens according to the a contact matrix. The contact matrix governs the number of contacts between and within people of different age groups.

The main function implementing the epidemiological model is the infectionODEs function. This function requires a number of parameters and we will explain all these parameters below.

infectionODEs(population, initial_infected, vaccine_calendar, contact_matrix,
  susceptibility, transmissibility, infection_delays, interval)

population

The size of the population size part of each age group and risk group.

library(fluEvidenceSynthesis)
data(demography) # Population divided by age (0 years old, 1 years old, etc.)

# Separate into non elderly (<65) and elderly population
ag <- stratify_by_age(demography, limits=c(65)) # c( 43670500, 8262600 )

# Separate in risk groups. In this case we assume one additional (high) risk groups and that respectively 
# 1 percent of non elderly and 40% of elderly are in this risk group. It is possible to
# define an additional risk group (e.g. pregnant women) if desired
population <- stratify_by_risk(ag, matrix(c(0.01,0.4),nrow=1), 
                                labels = c("LowRisk", "HighRisk")) # c( 43233795, 4957560, 436705, 3305040 )

The resulting vector holds the low risk population by age group (43233795, 4957560) followed by the high risk (436705, 3305040).

Initial infected

The number of people infected at the beginning of the season, again separated into age groups and risk groups.

library(fluEvidenceSynthesis)
ag <- c(1000,1000)
initial.infected <- stratify_by_risk( ag, matrix(c(0.01,0.4),nrow=1)) # c(990, 600, 10, 400)

Vaccination calendar

The vaccination calendar for a given the year. See the vaccination vignette for a more in depth explanation of this object. Here we will assume a constant percentage being vaccinated for four months. The elderly and high risk groups are vaccinated at the highest rate, with no vaccination for the low risk, younger group.

vaccine_calendar <- as_vaccination_calendar(
  efficacy = c(0.7,0.3),
  coverage = as.data.frame(matrix(c(0,0,0,0,0,0.861,0.123,0.861), nrow = 2, byrow = T)),
  dates = c(as.Date("2010-10-01"), as.Date("2011-02-01")), # begin and end date
  no_age_groups = 2,
  no_risk_groups = 2
)

Contact matrix

Contact rates between the different age groups.

library(fluEvidenceSynthesis)
data(polymod_uk)
data(demography)

# Polymod data is subdivided in seven age groups
poly <- polymod_uk[,c(1,2,3,9)]
poly[,3] <- rowSums(polymod_uk[,3:8])

contacts <- contact_matrix(as.matrix(poly), demography, c(65))
pander(contacts)

Epidemiological parameters

Different parameter values in the epidemiological model. We assume susceptibility is different for the different age groups, while transmissibility is the same for each age group. Infection_delays are the average time going from exposed to infected and from infected to recovered.

susceptibility <- c( 0.7, 0.3 ) # Different for different ages
transmissibility <- 0.17 # Same for all ages
infection_delays <- c( 0.8, 1.8 ) # 0.8 and 1.8 day.

Interval

Interval is the time we want to integrate over. For example if we have a data point each week, then we want to model all the people infections during that week, giving us an interval of 7 days.

Run the model

odes <- infectionODEs( population, initial.infected, vaccine_calendar, contacts, 
               susceptibility, transmissibility, infection_delays, 7 )
pander(head(odes))
fraction.infected <- odes %>%
  gather(Group, Incidence, -Time) %>%
  mutate(fraction = Incidence/population[Group])

ggplot( data=fraction.infected ) + geom_line( aes(x=Time, y=fraction, colour = Group) ) + 
  ylab( "Fraction infected" )

Further reading

You can look up how to adapt the underlying transmission model to your own needs in the adapting-the-transmission-model vignette or learn how to use your model for parameter inference, which is explained in more detail in the inference vignette.

Possible exercises

  1. Try different vaccine calendars and compare the results
  2. Explore different parameter values
  3. Change the contact matrix
  4. Add more age groups


MJomaba/flu-evidence-synthesis documentation built on April 26, 2022, 11:12 p.m.