Source: Infectious Disease Modelling ~ Emilia Vynnycky & Richard G. White

Load Packages

library(pacman)
## Warning: package 'pacman' was built under R version 4.3.3
p_load(
  rio, here, skimr, tidyverse, gtsummary, rstatix, corrr, janitor, flextable, 
  sf, SpatialEpi, dplyr, ggplot2, gridExtra, grid
)

Growth Rate Calculation

# Population
N <- 196943

# Growth rate during the first and second waves
tau <- 0.367  # First wave
tau_prime <- 0.104  # Second wave

# Infectious individuals
I <- 4567  # First wave
I_prime <- 19484  # Second wave

# Duration of infectiousness
D <- 2  # First wave
D_prime <- 2  # Second wave

Reproduction Number Calculation

# Rn Calculation
Rn <- 1 + tau * D
Rn_prime <- 1 + tau_prime * D_prime

# Assume 70% susceptible in the first wave, 50% in the second wave
R0 <- Rn / 0.7
R0_prime <- Rn_prime / 0.5

# Second order Rn
Rn1 <- Rn^2
Rn_prime1 <- Rn_prime^2

# Final Epidemic Size
S0 <- 0.7
S_prime <- 0.5

sf_first_wave <- S0 - I / N
R0_first_wave_final <- (log(sf_first_wave) - log(S0)) / (sf_first_wave - S0)

sf_second_wave <- S_prime - I_prime / N
R0_second_wave_final <- (log(sf_second_wave) - log(S_prime)) / (sf_second_wave - S_prime)

Summary Table

tab <- data.frame(
  Metric = c("Rn", "Rn′", "R0", "R0′", "Rn1", "Rn′1", "R0_final_1st_wave", "R0_final_2nd_wave"),
  Value = round(as.numeric(c(Rn, Rn_prime, R0, R0_prime, Rn1, Rn_prime1, R0_first_wave_final, R0_second_wave_final)), 2)
)

# Ensure no NA values
tab <- tab %>% mutate(Value = ifelse(is.na(Value), 0, Value))

# Generate flextable with correct decimal formatting
summary_table <- flextable(tab) %>%
  theme_vanilla() %>%  # Apply a clean theme
  set_table_properties(layout = "autofit")  # Adjust column width automatically

# Display the table
summary_table

Metric

Value

Rn

1.73

Rn′

1.21

R0

2.48

R0′

2.42

Rn1

3.01

Rn′1

1.46

R0_final_1st_wave

1.45

R0_final_2nd_wave

2.23

This document summarizes the calculations and outputs for infectious disease modeling using the growth rate method.