---
title: "Covid-19 International Modelling Consortium model simulation report"
output: word_document
editor_options: 
  chunk_output_type: console
---


```{r message = FALSE, echo = FALSE}
knitr::opts_chunk$set(echo = FALSE)
```


```{r out.width = "30%"}
knitr::include_graphics("como_logo.png")
```

# Summary of Model Simulations

Document generated the `r Sys.time()`.


The following is a summary of the output from the CoMo Consortium model version `r version_app` which can be accessed through an online interface at https://comomodel.net/.

*Whilst every effort has been taken during the development of this tool/model for it to be as accurate and reliable as possible it is important that the user understands that the outputs are a prediction based on the assumptions chosen through the input parameter values. In view of the current uncertainty on the COVID-19 mechanisms of action, the output of the model should be used to explore multiple scenarios and in combination with a larger evidence base during decision-making. The appropriate use of this tool/model and its output can contribute to effective policymaking, but misuse or misinterpretation of the output can mislead decision-making. Any decisions taken whist using these tools are the responsibility of the user and no liability whatsoever will be taken by the developers/authors of the tool.*

# Model Calibration

## Inputs

The CoMo model uses demographic data for Country from UN 2019 Revision of World Population Prospects (https://population.un.org/wpp/Download/Standard/Population/). The model is age structured and the contacts between age classes are assumed to follow those predicted in [1] for `r input$country_contact`. Cases and mortality data are downloaded from the [European Centre for Disease Prevention and Control website](https://www.ecdc.europa.eu/en). Severity and risk of death are assumed to be age dependent and default values follow estimates from France [2].

The simulation was started on `r input$date_range[1]` with the following interventions assumed to be applied for the duration of the observed data: *`r unique(interventions$baseline_mat$intervention)`.*


The following chart illustrates the timelines of these interventions:

```{r warning = FALSE, dpi = 200, fig.width = 12, fig.height = 15, eval = show}
dta <- interventions$baseline_mat %>%
    mutate(date_end = date_end + 1,
           label = paste0(value, unit, " ", difftime(date_end, date_start, units = "days") - 1, "d."))
  
  # completing with all "real" interventions
  dta <- bind_rows(
    dta,
    tibble(intervention = setdiff(real_interventions, dta$intervention))) %>%
    filter(intervention %in% real_interventions) %>% 
    arrange(intervention)
  
  dta$index <- 11 - as.numeric(factor(dta$intervention))
  
  if(interventions$baseline_mat %>% nrow() == 0) return({
    plot(c(0, 1), c(0, 1), ann = F, bty = 'n', type = 'n', xaxt = 'n', yaxt = 'n')
    text(x = 0.5, y = 0.8, paste("No Intervention has been selected"), 
         cex = 1.5, col = "black")
  })
  
  if(interventions$baseline_mat %>% nrow() > 0) return({
  ggplot(dta) + 
    geom_rect(aes(xmin = date_start , xmax = date_end, ymin = index, ymax = (index + 0.95 * 100/100), fill = intervention), alpha = 0.4) +
    geom_rect(aes(xmin = date_start , xmax = date_end, ymin = index, ymax = (index + 0.95 * value/100), fill = intervention)) +
    geom_segment(data = dta, aes(colour = "Today", x = Sys.Date(), xend = Sys.Date(), y = 0, yend = 11), lty = 2, alpha = 1, lwd = 1.3) +
    geom_segment(data = dta, aes(colour = "Simulation Range", x = input$date_range[1], xend = input$date_range[1], y = 0, yend = 11), lty = 2, alpha = 1, lwd = 1.3) +
    geom_segment(data = dta, aes(colour = "Simulation Range", x = input$date_range[2], xend = input$date_range[2], y = 0, yend = 11), lty = 2, alpha = 1, lwd = 1.3) +
    scale_colour_manual(name="Line Color", values = c(`Today` = "#c0392b", `Simulation Range` = "#2980b9")) +
    geom_text(aes(x = date_start, y = index, label = label),
               hjust = -0.1, vjust = -1, inherit.aes = FALSE, alpha = 1, size = 4) +
    labs(x = NULL, y = NULL) +
    guides(fill = guide_legend(title = NULL), colour = guide_legend(title = NULL)) +
    scale_x_date(labels = date_format("%b' %y")) +
    scale_y_continuous(labels = NULL) +
    scale_fill_brewer(palette = "Set3") +
    theme_bw(base_size = 19) +
    theme(legend.position = "right", legend.title = element_text(), legend.text = element_text(size = 13),
          panel.border = element_blank(),
          panel.grid.major.y = element_blank(),  panel.grid.minor = element_blank(),
          panel.grid.major.x = element_line(size = 0.5, colour= "grey80"),
          axis.line = element_blank(), axis.ticks = element_blank(),
          axis.text = element_text(color = "grey20", size = 12))
  })
```

There follows a list of the key input values (for a full list, please see the Appendix):

- Probability of infection given a contact is `r input$p`
- Percentage of all asymptomatic infections reported is `r input$report`%
- Percentage of all symptomatic infections reported is `r input$reportc`%
- Percentage of all hospital surge bed occupancy (in the app: of all hospitalisations) reported is `r input$reporth`%

## Model output compared with data

The following graph shows the reported cases data compared with the model prediction:

```{r warning = FALSE, dpi = 200, fig.width = 12, fig.height = 8, eval = show}
dta <- left_join(tibble(daily_incidence_min = simul_baseline$results$min$daily_incidence,
                        daily_incidence_med = simul_baseline$results$med$daily_incidence,
                        daily_incidence_max = simul_baseline$results$max$daily_incidence,
                        daily_total_cases_min = simul_baseline$results$min$daily_total_cases,
                        daily_total_cases_med = simul_baseline$results$med$daily_total_cases,
                        daily_total_cases_max = simul_baseline$results$max$daily_total_cases,
                        time = simul_baseline$results$time),
                 cases_rv$data,
                 by = c("time" = "date"))

max_x <- dta$time[last(which(!is.na(dta$cases)))] + 3
max_y <- 1.2 * max(dta$cases, na.rm = TRUE)

dta2 <- dta %>%
  rename(Date = time) %>%
  filter(Date <= max_x)

ggplot(data = dta2, aes(x = Date)) +
  geom_ribbon(aes(ymin = daily_total_cases_min, ymax = daily_total_cases_max), fill = "#00441b", alpha = 0.7) +
  geom_line(aes(y = daily_total_cases_med, color = "Predicted Reported + Unreported"), lwd = 1.2) + 
  geom_ribbon(aes(ymin = daily_incidence_min, ymax = daily_incidence_max), fill = "#74c476", alpha = 0.7) +
  geom_line(aes(y = daily_incidence_med, color = "Predicted Reported"), lwd = 1.2) +
  geom_line(aes(y = cases, color = "Observed"), lwd = 1.2) +
  geom_point(aes(y = cases), color = "red") + 
  coord_cartesian(ylim = c(NA, max_y)) +
  ggtitle("Baseline Cases") + xlab("") + ylab("Daily Cases") +
  theme_light(base_size = 17) +
  theme(legend.position = "bottom") +
  scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  scale_color_manual(name = "Cases", values = c("Predicted Reported" = "#74c476", "Predicted Reported + Unreported" = "#00441b", "Observed" = "red"))
```


The following graph shows the cumulative mortality data compared with the model prediction:

```{r warning = FALSE, dpi = 200, fig.width = 12, fig.height = 8, eval = show}
dta <- left_join(tibble(
    reportable_death_min = simul_baseline$results$min$reportable_death,
    reportable_death_med = simul_baseline$results$med$reportable_death,
    reportable_death_max = simul_baseline$results$max$reportable_death,
    # attributable_deaths_min = simul_baseline$results$min$attributable_deaths,
    # attributable_deaths_med = simul_baseline$results$med$attributable_deaths,
    # attributable_deaths_max = simul_baseline$results$max$attributable_deaths,
    time = simul_baseline$results$time), 
    cases_rv$data, # cumulative_death
    by = c("time" = "date"))
  
  # X/Y scales
  if(input$focus_axis == "Observed")  {
    max_x <- dta$time[last(which(!is.na(dta$cumulative_death)))] + 3
    max_y <- 1.2 * max(dta$cumulative_death, na.rm = TRUE)
  }
  if(input$focus_axis == "Predicted Reported" | input$focus_axis == "Predicted Reported + Unreported")  {
    max_x <- max(dta$time)
    max_y <- NA
  }
  
  dta %>%
    rename(Date = time) %>%
    filter(Date <= max_x) %>%
  
  ggplot(aes(x = Date)) +
    geom_ribbon(aes(ymin = reportable_death_min, ymax = reportable_death_max), fill = "#74c476", alpha = 0.7) +
    geom_line(aes(y = reportable_death_med, color = "Predicted Reported + Unreported"), lwd = 1.2) + 
    
    # geom_ribbon(aes(ymin = attributable_deaths_min, ymax = attributable_deaths_max), fill = "#74c476", alpha = 0.7) +
    # geom_line(aes(y = attributable_deaths_med, color = "Attributable"), lwd = 1.2) + 
    
    geom_line(aes(y = cumulative_death, color = "Observed"), lwd = 1.2) +
    
    geom_point(aes(y = cumulative_death), color = "red") +
    coord_cartesian(ylim = c(NA, max_y)) +
    labs(title = "Baseline Cumulative Deaths", x= "", y = "") +
    theme_light(base_size = 14) +
    theme(legend.position = "bottom") +
    scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
    scale_color_manual(name = "Cumulative Deaths", values = c("Predicted Reported + Unreported" = "#74c476", "Observed" = "red"))
```

For this “baseline scenario” between `r input$date_range[1]` and `r input$date_range[2]`:

- `r simul_baseline$results$med$pct_total_pop_infected[which(simul_baseline$results$med$time == input$date_range[2])]`% of the population is predicted to have experienced the infection (including unreported, mildly symptomatic, and/or asymptomatic infections)
- `r format(simul_baseline$results$med$attributable_deaths[which(simul_baseline$results$med$time == input$date_range[2])], big.mark = ",")` Covid-19 attributable deaths are expected during the range of simulation of which `r format(simul_baseline$results$med$reportable_death[which(simul_baseline$results$med$time == input$date_range[2])], big.mark = ",")` would be reported. 

# Baseline compared with hypothetical scenario

*The following series of charts represents a series of model projections for various values over time for both baseline and hypothetical scenarios. In reviewing this output, note that COVID-19 is a novel disease. Knowledge on transmission dynamics is still being discovered. Models are therefore based on assumptions and unknown information about the disease. Model inputs and outputs will change as we learn more about the disease and the impact of interventions on the disease. Uncertainty is even more pronounced in a country or population where the epidemic is still at early stage. Options and outputs will change once better serology, treatments, vaccines become widely available.*

A “hypothetical scenario” was simulated with the same inputs values except for the interventions which were set up as follows: *`r unique(interventions$future_mat$intervention)`.*


The following chart illustrates the timelines of these interventions: 

```{r warning = FALSE, dpi = 200, fig.width = 12, fig.height = 15, eval = show}
dta <- interventions$future_mat %>%
    mutate(date_end = date_end + 1,
           label = paste0(value, unit, " ", difftime(date_end, date_start, units = "days") - 1, "d."))
  
  # completing with all "real" interventions
  dta <- bind_rows(
    dta,
    tibble(intervention = setdiff(real_interventions, dta$intervention))) %>%
    filter(intervention %in% real_interventions) %>% 
    arrange(intervention)
  
  dta$index <- 11 - as.numeric(factor(dta$intervention))
  
  if(interventions$future_mat %>% nrow() == 0) return({
    plot(c(0, 1), c(0, 1), ann = F, bty = 'n', type = 'n', xaxt = 'n', yaxt = 'n')
    text(x = 0.5, y = 0.8, paste("No Intervention has been selected"), 
         cex = 1.5, col = "black")
  })
  
  if(interventions$future_mat %>% nrow() > 0) return({
    ggplot(dta) + 
      geom_rect(aes(xmin = date_start , xmax = date_end, ymin = index, ymax = (index + 0.95 * 100/100), fill = intervention), alpha = 0.4) +
      geom_rect(aes(xmin = date_start , xmax = date_end, ymin = index, ymax = (index + 0.95 * value/100), fill = intervention)) +
      geom_segment(data = dta, aes(colour = "Today", x = Sys.Date(), xend = Sys.Date(), y = 0, yend = 11), lty = 2, alpha = 1, lwd = 1.3) +
      geom_segment(data = dta, aes(colour = "Simulation Range", x = input$date_range[1], xend = input$date_range[1], y = 0, yend = 11), lty = 2, alpha = 1, lwd = 1.3) +
      geom_segment(data = dta, aes(colour = "Simulation Range", x = input$date_range[2], xend = input$date_range[2], y = 0, yend = 11), lty = 2, alpha = 1, lwd = 1.3) +
      scale_colour_manual(name="Line Color", values = c(`Today` = "#c0392b", `Simulation Range` = "#2980b9")) +
      geom_text(aes(x = date_start, y = index, label = label),
                hjust = -0.1, vjust = -1, inherit.aes = FALSE, alpha = 1, size = 4) +
      labs(x = NULL, y = NULL) +
      guides(fill = guide_legend(title = NULL), colour = guide_legend(title = NULL)) +
      scale_x_date(labels = date_format("%b' %y")) +
      scale_y_continuous(labels = NULL) +
      scale_fill_brewer(palette = "Set3") +
      theme_bw(base_size = 19) +
      theme(legend.position = "right", legend.title = element_text(), legend.text = element_text(size = 13),
            panel.border = element_blank(),
            panel.grid.major.y = element_blank(),  panel.grid.minor = element_blank(),
            panel.grid.major.x = element_line(size = 0.5, colour= "grey80"),
            axis.line = element_blank(), axis.ticks = element_blank(),
            axis.text = element_text(color = "grey20", size = 12))
  })
```


For this “hypothetical scenario” between `r input$date_range[1]` and `r input$date_range[2]`:

- `r simul_interventions$results$med$pct_total_pop_infected[which(simul_interventions$results$med$time == input$date_range[2])]`% of the population is predicted to have experienced the infection (including unreported, mildly symptomatic, and/or asymptomatic infections)
- `r format(simul_interventions$results$med$attributable_deaths[which(simul_interventions$results$med$time == input$date_range[2])], big.mark = ",")` Covid-19 attributable deaths are expected during the range of simulation of which `r format(simul_interventions$results$med$reportable_death[which(simul_interventions$results$med$time == input$date_range[2])], big.mark = ",")` would be reported. 

## `r input$focus_axis_dup` cases

```{r warning = FALSE, dpi = 200, fig.width = 12, fig.height = 8, eval = show}

dta <- left_join(tibble(daily_incidence_min = simul_baseline$results$min$daily_incidence,
                        daily_incidence_med = simul_baseline$results$med$daily_incidence,
                        daily_incidence_max = simul_baseline$results$max$daily_incidence,
                        daily_total_cases_min = simul_baseline$results$min$daily_total_cases,
                        daily_total_cases_med = simul_baseline$results$med$daily_total_cases,
                        daily_total_cases_max = simul_baseline$results$max$daily_total_cases,
                        time = simul_baseline$results$time),
                 cases_rv$data,
                 by = c("time" = "date"))

# X/Y scales
if(input$focus_axis_dup == "Observed")  {
  max_x <- dta$time[last(which(!is.na(dta$cases)))] + 3
  max_y <- 1.2 * max(dta$cases, na.rm = TRUE)
}

if(input$focus_axis_dup == "Predicted Reported")  {
  max_x <- max(dta$time)
  max_y <- 1.2 * max(dta$daily_incidence_max, na.rm = TRUE)
}

if(input$focus_axis_dup == "Predicted Reported + Unreported")  {
  max_x <- max(dta$time)
  max_y <- 1.2 * max(dta$daily_total_cases_max, na.rm = TRUE)
}
dta2 <- dta %>%
  rename(Date = time) %>%
  filter(Date <= max_x)

plot1 <- ggplot(data = dta2, aes(x = Date)) +
  geom_ribbon(aes(ymin = daily_total_cases_min, ymax = daily_total_cases_max), fill = "#00441b", alpha = 0.7) +
  geom_line(aes(y = daily_total_cases_med, color = "Predicted Reported + Unreported"), lwd = 1.2) + 
  geom_ribbon(aes(ymin = daily_incidence_min, ymax = daily_incidence_max), fill = "#74c476", alpha = 0.7) +
  geom_line(aes(y = daily_incidence_med, color = "Predicted Reported"), lwd = 1.2) +
  geom_line(aes(y = cases, color = "Observed"), lwd = 1.2) +
  geom_point(aes(y = cases), color = "red") + 
  coord_cartesian(ylim = c(NA, max_y)) +
  scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  ggtitle("Baseline Cases") + xlab("") + ylab("Daily Cases") +
  theme_light(base_size = 14) +
  theme(legend.position = "bottom") +
  scale_color_manual(name = "Cases", values = c("Predicted Reported" = "#74c476", "Predicted Reported + Unreported" = "#00441b", "Observed" = "red"))

dta <- left_join(tibble(daily_incidence_min = simul_interventions$results$min$daily_incidence,
                        daily_incidence_med = simul_interventions$results$med$daily_incidence,
                        daily_incidence_max = simul_interventions$results$max$daily_incidence,
                        daily_total_cases_min = simul_interventions$results$min$daily_total_cases,
                        daily_total_cases_med = simul_interventions$results$med$daily_total_cases,
                        daily_total_cases_max = simul_interventions$results$max$daily_total_cases,
                        time = simul_interventions$results$time),
                 cases_rv$data,
                 by = c("time" = "date"))

# X/Y scales
if(input$focus_axis_dup == "Observed")  {
  max_x <- dta$time[last(which(!is.na(dta$cases)))] + 3
  max_y <- max(max_y, 1.2 * max(dta$cases, na.rm = TRUE))
}

if(input$focus_axis_dup == "Predicted Reported")  {
  max_x <- max(dta$time)
  max_y <- max(max_y, 1.2 * max(dta$daily_incidence_max, na.rm = TRUE))
}

if(input$focus_axis_dup == "Predicted Reported + Unreported")  {
  max_x <- max(dta$time)
  max_y <- max(max_y, 1.2 * max(dta$daily_total_cases_max, na.rm = TRUE))
}

dta2 <- dta %>%
  rename(Date = time) %>%
  filter(Date <= max_x)

plot2 <- ggplot(data = dta2, aes(x = Date)) +
  geom_ribbon(aes(ymin = daily_total_cases_min, ymax = daily_total_cases_max), fill = "#00441b", alpha = 0.7) +
  geom_line(aes(y = daily_total_cases_med, color = "Predicted Reported + Unreported"), lwd = 1.2) + 
  geom_ribbon(aes(ymin = daily_incidence_min, ymax = daily_incidence_max), fill = "#74c476", alpha = 0.7) +
  geom_line(aes(y = daily_incidence_med, color = "Predicted Reported"), lwd = 1.2) +
  geom_line(aes(y = cases, color = "Observed"), lwd = 1.2) +
  geom_point(aes(y = cases), color = "red") + 
  coord_cartesian(ylim = c(NA, max_y)) +
  scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  ggtitle("Hypthetical Scenario Cases") + xlab("") + ylab("Daily Cases") +
  theme_light(base_size = 14) +
  theme(legend.position = "bottom") +
  scale_color_manual(name = "Cases", values = c("Predicted Reported" = "#74c476", "Predicted Reported + Unreported" = "#00441b", "Observed" = "red"))

grid.arrange(plot1, plot2, ncol = 2)
```


The above graphs show the `r input$focus_axis_dup` cases over time expected from the Baseline compared with the Hypothetical scenario. 


## Cumulative mortality

```{r warning = FALSE, dpi = 200, fig.width = 14, fig.height = 8, eval = show}
max_y <- max(simul_baseline$results$med$total_deaths, 
             simul_interventions$results$med$total_deaths)

nb_time <- length(simul_baseline$results$time)

dta <- tibble(
  time = rep(simul_baseline$results$time, 8),
  value = c(simul_baseline$results$med$death_natural_non_exposed, simul_baseline$results$med$death_natural_exposed, 
            simul_baseline$results$med$death_treated_hospital, simul_baseline$results$med$death_treated_icu,
            simul_baseline$results$med$death_treated_ventilator, simul_baseline$results$med$death_untreated_hospital,
            simul_baseline$results$med$death_untreated_icu, simul_baseline$results$med$death_untreated_ventilator),
  nature = c(rep("Deaths Natural non Exposed", nb_time), rep("Deaths Natural Exposed", nb_time),
             rep("Deaths Treated Hospital", nb_time), rep("Deaths Treated ICU", nb_time),
             rep("Deaths Treated Ventilator", nb_time), rep("Deaths Untreated Hospital", nb_time),
             rep("Deaths Untreated ICU", nb_time), rep("Deaths Untreated Ventilator", nb_time))
)

plot1 <- ggplot(data = dta, aes(x = time, y = value, fill = nature))+
  geom_bar(stat = "identity", width = 1)+
  scale_fill_brewer(palette = "Set1") +
  ylab("Deaths") + xlab("") +
  coord_cartesian(ylim = c(NA, max_y)) +
  scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  theme(legend.title = element_blank(), legend.position = "left") +
  labs(title = "Baseline Cumulative Deaths")

dta <- tibble(
  time = rep(simul_interventions$results$time, 8),
  value = c(simul_interventions$results$med$death_natural_non_exposed, simul_interventions$results$med$death_natural_exposed, 
            simul_interventions$results$med$death_treated_hospital, simul_interventions$results$med$death_treated_icu,
            simul_interventions$results$med$death_treated_ventilator, simul_interventions$results$med$death_untreated_hospital,
            simul_interventions$results$med$death_untreated_icu, simul_interventions$results$med$death_untreated_ventilator),
  nature = c(rep("Deaths Natural non Exposed", nb_time), rep("Deaths Natural Exposed", nb_time),
             rep("Deaths Treated Hospital", nb_time), rep("Deaths Treated ICU", nb_time),
             rep("Deaths Treated Ventilator", nb_time), rep("Deaths Untreated Hospital", nb_time),
             rep("Deaths Untreated ICU", nb_time), rep("Deaths Untreated Ventilator", nb_time))
)

plot2 <- ggplot(data = dta, aes(x = time, y = value, fill = nature))+
  geom_bar(stat = "identity", width = 1)+
  scale_fill_brewer(palette = "Set1") +
  ylab("Deaths") + xlab("") +
  coord_cartesian(ylim = c(NA, max_y)) +
  scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  theme(legend.title = element_blank(), legend.position = "none") +
  labs(title = "Hypthetical Scenario Cumulative Deaths")

grid.arrange(plot1, plot2, ncol = 2, widths = c(1.5, 1))
```


The above graphs show the cumulative mortality over time expected from the Baseline compared with the Hypothetical scenario. The expected mortality has been further stratified to reflect death from severe COVID-19 during hospital treatment or in severely ill patients who were not able to access these resources. The predicted COVID-19 attributable deaths may be compared with mortality from other causes where patients may or may not test positive for COVID-19 post-mortem depending on their infection status upon death. 

## Deaths per Age Category

```{r warning = FALSE, dpi = 200, fig.width = 14, fig.height = 8, eval = show}
dta <- simul_baseline$results$med$tc %>%
  group_by(age_cat) %>%
  summarise(total_deaths = round(sum(value)), .groups = "drop") %>% 
  mutate(freq = round(100 * total_deaths / sum(total_deaths), 1))

plot1 <- ggplot(data = dta, aes(x = age_cat, y = total_deaths, fill = age_cat))+ 
    geom_bar(stat = "identity") +
    geom_text(aes(label = paste0(format(total_deaths, big.mark = ",", scientific = FALSE), " (", freq, "%)")), 
              size = 4, fontface= 2, vjust = -0.2) + 
    scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
    scale_fill_brewer(palette = "BrBG") + 
    ylab("") + xlab("") +
    theme_minimal(base_size = 14) + 
    theme(legend.title = element_blank(), legend.position = "bottom") + 
    labs(title = "Total Reported Covid-19 Deaths per Age Category", subtitle = "Baseline")




dta <- simul_interventions$results$med$tc %>%
  group_by(age_cat) %>%
  summarise(total_deaths = round(sum(value)), .groups = "drop") %>% 
  mutate(freq = round(100 * total_deaths / sum(total_deaths), 2))

plot2 <- ggplot(data = dta, aes(x = age_cat, y = total_deaths, fill = age_cat))+ 
    geom_bar(stat = "identity") +
    geom_text(aes(label = paste0(format(total_deaths, big.mark = ",", scientific = FALSE), " (", freq, "%)")), 
              size = 4, fontface= 2, vjust = -0.2) + 
    scale_y_continuous(labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
    scale_fill_brewer(palette = "BrBG") + 
    ylab("") + xlab("") +
    theme_minimal(base_size = 14) + 
    theme(legend.title = element_blank(), legend.position = "bottom") + 
    labs(title = "Total Reported Covid-19 Deaths per Age Category", subtitle = "Hypothetical Scenario")

grid.arrange(plot1, plot2, ncol = 2)
```


## Hospital occupancy 


```{r warning = FALSE, dpi = 200, fig.width = 14, fig.height = 12, eval = show}
nb_time <- length(simul_baseline$results$time)


# Baseline ----

dta <- tibble(time = rep(simul_baseline$results$time, 3),
              nature = c(rep("Hospital Surge Beds", nb_time), rep("ICU Beds", nb_time), rep("Ventilators", nb_time)),
              value = c(simul_baseline$results$med$hospital_surge_beds, simul_baseline$results$med$icu_beds, simul_baseline$results$med$ventilators))


plot11 <- ggplot(data = dta %>% filter(nature == "Hospital Surge Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$beds_available, linetype = "dashed") +
  scale_y_continuous(limits = c(0, max(simul_baseline$results$med$hospital_surge_beds, simul_interventions$results$med$hospital_surge_beds)),
                     labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Baseline, Hospital Surge Beds")

plot12 <- ggplot(data = dta %>% filter(nature == "ICU Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$icu_beds_available, linetype = "dashed") +
  coord_cartesian(ylim = c(NA,  max(simul_baseline$results$med$icu_beds, simul_interventions$results$med$icu_beds))) +
  scale_y_continuous(limits = c(0, max(simul_baseline$results$med$icu_beds, simul_interventions$results$med$icu_beds)),
                     labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Baseline, ICU Beds")

plot13 <- ggplot(data = dta %>% filter(nature == "Ventilators"), aes(x = time, y = value))+
  geom_line()+
  ylab("Ventilators") + xlab("") +
  geom_hline(yintercept = input$ventilators_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$ventilators, simul_interventions$results$med$ventilators)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Baseline, Ventilators")

# Hypothetical Scenario ----

dta <- tibble(time = rep(simul_interventions$results$time, 3),
              nature = c(rep("Hospital Surge Beds", nb_time), rep("ICU Beds", nb_time), rep("Ventilators", nb_time)),
              value = c(simul_interventions$results$med$hospital_surge_beds, simul_interventions$results$med$icu_beds, simul_interventions$results$med$ventilators))


plot21 <- ggplot(data = dta %>% filter(nature == "Hospital Surge Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$beds_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$hospital_surge_beds, simul_interventions$results$med$hospital_surge_beds)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Hypothetical Scenario, Hospital Surge Beds")

plot22 <- ggplot(data = dta %>% filter(nature == "ICU Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$icu_beds_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$icu_beds, simul_interventions$results$med$icu_beds)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Hypothetical Scenario, ICU Beds")

plot23 <- ggplot(data = dta %>% filter(nature == "Ventilators"), aes(x = time, y = value))+
  geom_line()+
  ylab("Ventilators") + xlab("") +
  geom_hline(yintercept = input$ventilators_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$ventilators, simul_interventions$results$med$ventilators)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Hypothetical Scenario, Ventilators")

grid.arrange(plot11, plot21,
             plot12, plot22, 
             plot13, plot23,
             ncol = 2)
```


The above graphs show expected hospital occupancy for the baseline and hypothetical scenarios depending on the input values of resource availability as follows:

- Maximum number of hospital surge beds is `r input$beds_available`
- Maximum number of ICU beds without ventilators is  `r input$icu_beds_available`
- Maximum number of ICU beds with ventilators is  `r input$ventilators_available`

In most simulations, the occupancy for each classification will plateau at the input capacity. A level of flexibility is assumed in the model which allows for the occupancy to exceed capacity in some cases. Especially in the hospital surge category. For this reason, some simulations will predict occupancy exceeding capacity. 

## Hospital demand

```{r warning = FALSE, dpi = 200, fig.width = 14, fig.height = 12, eval = show}
nb_time <- length(simul_baseline$results$time)


# Baseline ----

dta <- tibble(time = rep(simul_baseline$results$time, 3),
              nature = c(rep("Hospital Surge Beds", nb_time), rep("ICU Beds", nb_time), rep("Ventilators", nb_time)),
              value = c(simul_baseline$results$med$normal_bed_requirement, simul_baseline$results$med$icu_bed_requirement, simul_baseline$results$med$icu_ventilator_requirement))


plot11 <- ggplot(data = dta %>% filter(nature == "Hospital Surge Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$beds_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$normal_bed_requirement, simul_interventions$results$med$normal_bed_requirement)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Baseline, Hospital Surge Beds")

plot12 <- ggplot(data = dta %>% filter(nature == "ICU Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$icu_beds_available, linetype = "dashed") +
  scale_y_continuous(limits = c(0, max(simul_baseline$results$med$icu_bed_requirement, simul_interventions$results$med$icu_bed_requirement)), labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Baseline, ICU Beds")

plot13 <- ggplot(data = dta %>% filter(nature == "Ventilators"), aes(x = time, y = value))+
  geom_line()+
  ylab("Ventilators") + xlab("") +
  geom_hline(yintercept = input$ventilators_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$icu_ventilator_requirement, simul_interventions$results$med$icu_ventilator_requirement)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Baseline, Ventilators")

# Hypothetical Scenario ----

dta <- tibble(time = rep(simul_interventions$results$time, 3),
              nature = c(rep("Hospital Surge Beds", nb_time), rep("ICU Beds", nb_time), rep("Ventilators", nb_time)),
              value = c(simul_interventions$results$med$normal_bed_requirement, simul_interventions$results$med$icu_bed_requirement, simul_interventions$results$med$icu_ventilator_requirement))


plot21 <- ggplot(data = dta %>% filter(nature == "Hospital Surge Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$beds_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$normal_bed_requirement, simul_interventions$results$med$normal_bed_requirement)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Hypothetical Scenario, Hospital Surge Beds")

plot22 <- ggplot(data = dta %>% filter(nature == "ICU Beds"), aes(x = time, y = value))+
  geom_line()+
  ylab("Beds") + xlab("") +
  geom_hline(yintercept = input$icu_beds_available, linetype = "dashed") +
  scale_y_continuous(
    limits = c(0, max(simul_baseline$results$med$icu_bed_requirement, simul_interventions$results$med$icu_bed_requirement)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Hypothetical Scenario, ICU Beds")

plot23 <- ggplot(data = dta %>% filter(nature == "Ventilators"), aes(x = time, y = value))+
  geom_line()+
  ylab("Ventilators") + xlab("") +
  geom_hline(yintercept = input$ventilators_available, linetype = "dashed") +
  scale_y_continuous(
    limits =c(0, max(simul_baseline$results$med$icu_ventilator_requirement, simul_interventions$results$med$icu_ventilator_requirement)),
    labels=function(x) format(x, big.mark = ",", decimal.mark = ".", scientific = FALSE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Hypothetical Scenario, Ventilators")

grid.arrange(plot11, plot21,
             plot12, plot22, 
             plot13, plot23,
             ncol = 2)
```

The above graphs represent the expected demand for baseline and hypothetical scenarios for hospital surge beds, ICU beds without ventilators, and ICU beds with ventilators, even if some of this demand cannot be met with the current health system. 

## Reproduction number 

```{r warning = FALSE, dpi = 200, fig.width = 14, fig.height = 6, eval = show}
dta <- tibble(Rt = simul_baseline$results$med$Rt, Date = simul_baseline$results$time)

plot1 <- ggplot(data = dta, aes(x = Date, y = Rt))+
  geom_line()+
  ylab("Rt") + xlab("") +
  geom_hline(yintercept = 1, linetype = "dashed") +
  ylim(0, max(simul_baseline$results$med$Rt, simul_interventions$results$med$Rt, na.rm = TRUE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Baseline, Rt")

dta <- tibble(Rt = simul_interventions$results$med$Rt, Date = simul_interventions$results$time)

plot2 <- ggplot(data = dta, aes(x = Date, y = Rt))+
  geom_line()+
  ylab("Rt") + xlab("") +
  geom_hline(yintercept = 1, linetype = "dashed") +
  ylim(0, max(simul_baseline$results$med$Rt, simul_interventions$results$med$Rt, na.rm = TRUE)) +
  theme_minimal(base_size = 14) +
  labs(title = "Hypothetical Scenario, Rt")

grid.arrange(plot1, plot2, ncol = 2)
```


The above graphs show the model prediction of the reproduction number over time, R_t, if this value is greater than 1, then the epidemic may spread in the population. R_t may be less than 1 if either the interventions deployed are sufficient to stop transmission, if a sufficient percentage of the population have been exposed to the infection and are immune (herd immunity), or some combination of these outcomes.

# References

1.	Prem, K., A.R. Cook, and M. Jit, Projecting social contact matrices in 152 countries using contact surveys and demographic data. PLoS Comput Biol, 2017. 13(9): p. e1005697.
2.	Henrik Salje, Cécile Tran Kiem, Noémie Lefrancq, Noémie Courtejoie, Paolo Bosetti, Juliette Paireau, Alessio Andronico, Nathanaël Hozé, Jehanne Richet, Claire-Lise Dubost, Yann Le Strat, Justin Lessler, Daniel Levy-Bruhl, Arnaud Fontanet, Lulla Opatowski, Pierre-Yves Boelle, and Simon Cauchemez. Estimating the burden of sars-cov-2 in france. Science, 369(6500):208–211, 2020.


# Appendix: Parameter Table

| Sheet-Intervention                    | Parameter                                                                                                         | Value                           |
|---------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------|
| Parameters                            | (changed in v17) Number of exposed people at start date                                                           | `r input$init`                  |
| Parameters                            | (v16.2) Proportion of population with partial immunity at the start date                                          | `r input$pre`                   |
| Parameters                            | Probability of infection given contact (0 to 0.2)                                                                 | `r input$p`                     |
| Parameters                            | Percentage of all asymptomatic infections that are reported                                                       | `r input$report`                |
| Parameters                            | Percentage of all symptomatic infections that are reported                                                        | `r input$reportc`               |
| Parameters                            | (v16.2) Percentage of denied hospitalisations that are reported                                                   | `r input$reporth_g`             |
| Parameters                            | (v16.2) Percentage of non-severe hospitalisations that are appropriately treated                                  | `r input$reporth`               |
| Parameters                            | (v16.2) Percentage of severe hospitalisations that are appropriately treated                                      | `r input$reporth_ICU`           |
| Parameters                            | (v16.2) Percentage of all asymptomatic infections in previously vaccinated people that are reported               | `r input$report_v`              |
| Parameters                            | (v16.2) Percentage of all asymptomatic infections in previously vaccinated and exposed people that are reported   | `r input$report_vr`             |
| Parameters                            | (v16.2) Percentage of all asymptomatic infections in previously infected people that are reported                 | `r input$report_r`              |
| Parameters                            | (v16.2) Percentage of all symptomatic infections in previously vaccinated people that are reported                | `r input$report_cv`             |
| Parameters                            | (v16.2) Percentage of all symptomatic infections in previously vaccinated and exposed people that are reported    | `r input$report_cvr`            |
| Parameters                            | (v16.2) Percentage of all symptomatic infections in previously infected people that are reported                  | `r input$report_cr`             |
| Parameters                            | (v16.2) Percentage of all people dying outside the hospital with asymptomatic infections reported as covid-deaths | `r input$report_natdeathI`      |
| Parameters                            | (v16.2) Percentage of all people dying outside the hospital with symptomatic infections reported as covid-deaths  | `r input$report_natdeathCL`     |
| Parameters                            | (v16.2) Percentage of all people dying outside the hospital with severe infections reported as covid-deaths       | `r input$report_death_HC`       |
| Parameters                            | Iterations (1 to 10,000)                                                                                          | `r input$iterations`            |
| Parameters                            | Noise (0.01 to 0.2)                                                                                               | `r input$noise`                 |
| Parameters                            | Confidence (5 to 25)                                                                                              | `r input$confidence`            |
| Parameters                            | (v17) Average sample size for seroprevalence                                                                      | `r input$sample_size`           |
| Country Area Param                    | Social Contacts Data                                                                                              | `r input$country_contact`       |
| Country Area Param                    | Mean Household size                                                                                               | `r input$household_size`        |
| Country Area Param                    | Mean number of infectious migrants per day                                                                        | `r input$mean_imports`          |
| Virus Param                           | Relative infectiousness of incubation phase                                                                       | `r input$rho`                   |
| Virus Param                           | Average incubation period (1 to 7 days)                                                                           | `r input$gamma`                 |
| Virus Param                           | Average duration of symptomatic infection period (1 to 7 days)                                                    | `r input$nui`                   |
| Virus Param                           | Month of peak infectivity of the virus (1, 2, …, 12)                                                              | `r input$phi`                   |
| Virus Param                           | Annual variation in infectivity of the virus                                                                      | `r input$amp`                   |
| Virus Param                           | Average duration of immunity (0.5 to 150)                                                                         | `r input$omega`                 |
| Virus Param                           | Probability upon infection of developing clinical symptoms                                                        | `r input$pclin`                 |
| Virus Param                           | Probability upon hospitalisation of requiring ICU admission                                                       | `r input$prob_icu`              |
| Virus Param                           | Probability upon admission to the ICU of requiring a ventilator                                                   | `r input$prob_vent`             |
| Virus Param                           | Proportion of hospitalised patients needing O2                                                                    | `r input$propo2`                |
| Virus Param                           | (v16.2) Probability upon infection of developing clinical symptoms if previously vaccinated                       | `r input$pclin_v`               |
| Virus Param                           | (v16.2) Probability upon infection of developing clinical symptoms if previously vaccinated and exposed           | `r input$pclin_vr`              |
| Virus Param                           | (v16.2) Probability upon infection of developing clinical symptoms if previously infected                         | `r input$pclin_r`               |
| Virus Param                           | (v16.2) Probability upon hospitalisation of requiring ICU admission if previously vaccinated                      | `r input$prob_icu_v`            |
| Virus Param                           | (v16.2) Probability upon hospitalisation of requiring ICU admission if previously vaccinated and exposed          | `r input$prob_icu_vr`           |
| Virus Param                           |  (v16.2) Probability upon hospitalisation of requiring ICU admission if previously infected                       | `r input$prob_icu_r`            |
| Virus Param                           | (v16.2) Probability upon admission to the ICU of requiring a ventilator if previously vaccinated                  | `r input$prob_v_v`              |
| Virus Param                           | (v16.2) Probability upon admission to the ICU of requiring a ventilator if previously vaccinated and exposed      | `r input$prob_v_vr`             |
| Virus Param                           | (v16.2) Probability upon admission to the ICU of requiring a ventilator if previously infected                    | `r input$prob_v_r`              |
| Virus Param                           | (v16.2) Probability of infection of people that have recovered from a previous infection                          | `r input$sigmaR`                |
| Virus Param                           | (v16.2) Change in probability of requiring hospitalisation if previously vaccinated                               | `r input$sigmaEV`               |
| Virus Param                           | (v16.2) Change in probability of requiring hospitalisation if previously infected                                 | `r input$sigmaER`               |
| Virus Param                           | (v16.2) Change in probability of requiring hospitalisation if previously infected and vaccinated                  | `r input$sigmaEVR`              |
| Virus Param                           | (v16.2) Days from seropositve to seronegative                                                                     | `r input$seroneg`               |
| Hospitalisation Param                 | Maximum number of hospital surge beds                                                                             | `r input$beds_available`        |
| Hospitalisation Param                 | Maximum number of ICU beds without ventilators                                                                    | `r input$icu_beds_available`    |
| Hospitalisation Param                 | Maximum number of ICU beds with ventilators                                                                       | `r input$ventilators_available` |
| Hospitalisation Param                 | Relative percentage of regular daily contacts when hospitalised:                                                  | `r input$rhos`                  |
| Hospitalisation Param                 | Scaling factor for infection hospitalisation rate: (0.1 to 5)                                                     | `r input$ihr_scaling`           |
| Hospitalisation Param                 | Probability of dying when hospitalised (not req O2):                                                              | `r input$pdeath_h`              |
| Hospitalisation Param                 | Probability of dying when hospitalised if req O2:                                                                 | `r input$pdeath_ho`             |
| Hospitalisation Param                 | Probability of dying when denied hospitalisation (not req O2):                                                    | `r input$pdeath_hc`             |
| Hospitalisation Param                 | Probability of dying when denied hospitalisation if req O2:                                                       | `r input$pdeath_hco`            |
| Hospitalisation Param                 | Probability of dying when admitted to ICU (not req O2):                                                           | `r input$pdeath_icu`            |
| Hospitalisation Param                 | Probability of dying when admitted to ICU if req O2:                                                              | `r input$pdeath_icuo`           |
| Hospitalisation Param                 | Probability of dying when admission to ICU denied (not req O2):                                                   | `r input$pdeath_icuc`           |
| Hospitalisation Param                 | Probability of dying when admission to ICU denied if req O2:                                                      | `r input$pdeath_icuco`          |
| Hospitalisation Param                 | Probability of dying when ventilated:                                                                             | `r input$pdeath_vent`           |
| Hospitalisation Param                 | Probability of dying when ventilator denied:                                                                      | `r input$pdeath_ventc`          |
| Hospitalisation Param                 | (v16.2) Probability of dying when ventilator required and not going to hospital:                                  | `r input$pdeath_vent_hc`        |
| Hospitalisation Param                 | (v16.2) Probability of dying when icu required (not O2) and not going to hospital:                                | `r input$pdeath_icu_hc`         |
| Hospitalisation Param                 | (v16.2) Probability of dying when icu required (req O2) and not going to hospital:                                | `r input$pdeath_icu_hco`        |
| Hospitalisation Param                 | Duration of hospitalised infection: (1 to 30)                                                                     | `r input$nus`                   |
| Hospitalisation Param                 | Duration of ICU infection: (1 to 30)                                                                              | `r input$nu_icu`                |
| Hospitalisation Param                 | Duration of ventilated infection: (1 to 30)                                                                       | `r input$nu_vent`               |
| Self-isolation if Symptomatic         |                                                                                                        Adherence: | `r input$selfis_eff`            |
| (*Self-isolation) Screening           |                                                                                 Overdispersion: (1, 2, 3, 4 or 5) | `r input$screen_overdispersion` |
| (*Self-isolation) Screening           |                                                                                                 Test Sensitivity: | `r input$screen_test_sens`      |
| (*Self-isolation) Household Isolation |                                                                             Days in isolation for average person: | `r input$quarantine_days`       |
| (*Self-isolation) Household Isolation |                                                           Days to implement maximum quarantine coverage: (1 to 5) | `r input$quarantine_effort`     |
| (*Self-isolation) Household Isolation |                                                        Decrease in the number of other contacts when quarantined: | `r input$quarantine_eff_other`  |
| (*Self-isolation) Household Isolation |                                                      Increase in the number of contacts at home when quarantined: | `r input$quarantine_eff_home`   |
| Sheet-Intervention                    | Parameter                                                                                                         | Value                           |
|---------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------|
| Parameters                            | (changed in v17) Number of exposed people at start date                                                           | `r input$init`                  |
| Parameters                            | (v16.2) Proportion of population with partial immunity at the start date                                          | `r input$pre`                   |
| Parameters                            | Probability of infection given contact (0 to 0.2)                                                                 | `r input$p`                     |
| Parameters                            | Percentage of all asymptomatic infections that are reported                                                       | `r input$report`                |
| Parameters                            | Percentage of all symptomatic infections that are reported                                                        | `r input$reportc`               |
| Parameters                            | (v16.2) Percentage of denied hospitalisations that are reported                                                   | `r input$reporth_g`             |
| Parameters                            | (v16.2) Percentage of non-severe hospitalisations that are appropriately treated                                  | `r input$reporth`               |
| Parameters                            | (v16.2) Percentage of severe hospitalisations that are appropriately treated                                      | `r input$reporth_ICU`           |
| Parameters                            | (v16.2) Percentage of all asymptomatic infections in previously vaccinated people that are reported               | `r input$report_v`              |
| Parameters                            | (v16.2) Percentage of all asymptomatic infections in previously vaccinated and exposed people that are reported   | `r input$report_vr`             |
| Parameters                            | (v16.2) Percentage of all asymptomatic infections in previously infected people that are reported                 | `r input$report_r`              |
| Parameters                            | (v16.2) Percentage of all symptomatic infections in previously vaccinated people that are reported                | `r input$report_cv`             |
| Parameters                            | (v16.2) Percentage of all symptomatic infections in previously vaccinated and exposed people that are reported    | `r input$report_cvr`            |
| Parameters                            | (v16.2) Percentage of all symptomatic infections in previously infected people that are reported                  | `r input$report_cr`             |
| Parameters                            | (v16.2) Percentage of all people dying outside the hospital with asymptomatic infections reported as covid-deaths | `r input$report_natdeathI`      |
| Parameters                            | (v16.2) Percentage of all people dying outside the hospital with symptomatic infections reported as covid-deaths  | `r input$report_natdeathCL`     |
| Parameters                            | (v16.2) Percentage of all people dying outside the hospital with severe infections reported as covid-deaths       | `r input$report_death_HC`       |
| Parameters                            | Iterations (1 to 10,000)                                                                                          | `r input$iterations`            |
| Parameters                            | Noise (0.01 to 0.2)                                                                                               | `r input$noise`                 |
| Parameters                            | Confidence (5 to 25)                                                                                              | `r input$confidence`            |
| Parameters                            | (v17) Average sample size for seroprevalence                                                                      | `r input$sample_size`           |
| Country Area Param                    | Social Contacts Data                                                                                              | `r input$country_contact`       |
| Country Area Param                    | Mean Household size                                                                                               | `r input$household_size`        |
| Country Area Param                    | Mean number of infectious migrants per day                                                                        | `r input$mean_imports`          |
| Virus Param                           | Relative infectiousness of incubation phase                                                                       | `r input$rho`                   |
| Virus Param                           | Average incubation period (1 to 7 days)                                                                           | `r input$gamma`                 |
| Virus Param                           | Average duration of symptomatic infection period (1 to 7 days)                                                    | `r input$nui`                   |
| Virus Param                           | Month of peak infectivity of the virus (1, 2, …, 12)                                                              | `r input$phi`                   |
| Virus Param                           | Annual variation in infectivity of the virus                                                                      | `r input$amp`                   |
| Virus Param                           | Average duration of immunity (0.5 to 150)                                                                         | `r input$omega`                 |
| Virus Param                           | Probability upon infection of developing clinical symptoms                                                        | `r input$pclin`                 |
| Virus Param                           | Probability upon hospitalisation of requiring ICU admission                                                       | `r input$prob_icu`              |
| Virus Param                           | Probability upon admission to the ICU of requiring a ventilator                                                   | `r input$prob_vent`             |
| Virus Param                           | Proportion of hospitalised patients needing O2                                                                    | `r input$propo2`                |
| Virus Param                           | (v16.2) Probability upon infection of developing clinical symptoms if previously vaccinated                       | `r input$pclin_v`               |
| Virus Param                           | (v16.2) Probability upon infection of developing clinical symptoms if previously vaccinated and exposed           | `r input$pclin_vr`              |
| Virus Param                           | (v16.2) Probability upon infection of developing clinical symptoms if previously infected                         | `r input$pclin_r`               |
| Virus Param                           | (v16.2) Probability upon hospitalisation of requiring ICU admission if previously vaccinated                      | `r input$prob_icu_v`            |
| Virus Param                           | (v16.2) Probability upon hospitalisation of requiring ICU admission if previously vaccinated and exposed          | `r input$prob_icu_vr`           |
| Virus Param                           |  (v16.2) Probability upon hospitalisation of requiring ICU admission if previously infected                       | `r input$prob_icu_r`            |
| Virus Param                           | (v16.2) Probability upon admission to the ICU of requiring a ventilator if previously vaccinated                  | `r input$prob_v_v`              |
| Virus Param                           | (v16.2) Probability upon admission to the ICU of requiring a ventilator if previously vaccinated and exposed      | `r input$prob_v_vr`             |
| Virus Param                           | (v16.2) Probability upon admission to the ICU of requiring a ventilator if previously infected                    | `r input$prob_v_r`              |
| Virus Param                           | (v16.2) Probability of infection of people that have recovered from a previous infection                          | `r input$sigmaR`                |
| Virus Param                           | (v16.2) Change in probability of requiring hospitalisation if previously vaccinated                               | `r input$sigmaEV`               |
| Virus Param                           | (v16.2) Change in probability of requiring hospitalisation if previously infected                                 | `r input$sigmaER`               |
| Virus Param                           | (v16.2) Change in probability of requiring hospitalisation if previously infected and vaccinated                  | `r input$sigmaEVR`              |
| Virus Param                           | (v16.2) Days from seropositve to seronegative                                                                     | `r input$seroneg`               |
| Hospitalisation Param                 | Maximum number of hospital surge beds                                                                             | `r input$beds_available`        |
| Hospitalisation Param                 | Maximum number of ICU beds without ventilators                                                                    | `r input$icu_beds_available`    |
| Hospitalisation Param                 | Maximum number of ICU beds with ventilators                                                                       | `r input$ventilators_available` |
| Hospitalisation Param                 | Relative percentage of regular daily contacts when hospitalised:                                                  | `r input$rhos`                  |
| Hospitalisation Param                 | Scaling factor for infection hospitalisation rate: (0.1 to 5)                                                     | `r input$ihr_scaling`           |
| Hospitalisation Param                 | Probability of dying when hospitalised (not req O2):                                                              | `r input$pdeath_h`              |
| Hospitalisation Param                 | Probability of dying when hospitalised if req O2:                                                                 | `r input$pdeath_ho`             |
| Hospitalisation Param                 | Probability of dying when denied hospitalisation (not req O2):                                                    | `r input$pdeath_hc`             |
| Hospitalisation Param                 | Probability of dying when denied hospitalisation if req O2:                                                       | `r input$pdeath_hco`            |
| Hospitalisation Param                 | Probability of dying when admitted to ICU (not req O2):                                                           | `r input$pdeath_icu`            |
| Hospitalisation Param                 | Probability of dying when admitted to ICU if req O2:                                                              | `r input$pdeath_icuo`           |
| Hospitalisation Param                 | Probability of dying when admission to ICU denied (not req O2):                                                   | `r input$pdeath_icuc`           |
| Hospitalisation Param                 | Probability of dying when admission to ICU denied if req O2:                                                      | `r input$pdeath_icuco`          |
| Hospitalisation Param                 | Probability of dying when ventilated:                                                                             | `r input$pdeath_vent`           |
| Hospitalisation Param                 | Probability of dying when ventilator denied:                                                                      | `r input$pdeath_ventc`          |
| Hospitalisation Param                 | (v16.2) Probability of dying when ventilator required and not going to hospital:                                  | `r input$pdeath_vent_hc`        |
| Hospitalisation Param                 | (v16.2) Probability of dying when icu required (not O2) and not going to hospital:                                | `r input$pdeath_icu_hc`         |
| Hospitalisation Param                 | (v16.2) Probability of dying when icu required (req O2) and not going to hospital:                                | `r input$pdeath_icu_hco`        |
| Hospitalisation Param                 | Duration of hospitalised infection: (1 to 30)                                                                     | `r input$nus`                   |
| Hospitalisation Param                 | Duration of ICU infection: (1 to 30)                                                                              | `r input$nu_icu`                |
| Hospitalisation Param                 | Duration of ventilated infection: (1 to 30)                                                                       | `r input$nu_vent`               |
| Self-isolation if Symptomatic         |                                                                                                        Adherence: | `r input$selfis_eff`            |
| (*Self-isolation) Screening           |                                                                                 Overdispersion: (1, 2, 3, 4 or 5) | `r input$screen_overdispersion` |
| (*Self-isolation) Screening           |                                                                                                 Test Sensitivity: | `r input$screen_test_sens`      |
| (*Self-isolation) Household Isolation |                                                                             Days in isolation for average person: | `r input$quarantine_days`       |
| (*Self-isolation) Household Isolation |                                                           Days to implement maximum quarantine coverage: (1 to 5) | `r input$quarantine_effort`     |
| (*Self-isolation) Household Isolation |                                                        Decrease in the number of other contacts when quarantined: | `r input$quarantine_eff_other`  |
| (*Self-isolation) Household Isolation |                                                      Increase in the number of contacts at home when quarantined: | `r input$quarantine_eff_home`   |
| Social Distancing                     |                                                                                                        Adherence: | `r input$dist_eff`              |
| Handwashing                           |                                                                                                 Efficacy: (0-25%) | `r input$hand_eff`              |
| Mask Wearing                          |                                                                                                 Efficacy: (0-35%) | `r input$mask_eff`              |
| Working at Home                       |                                                                                                         Efficacy: | `r input$work_eff`              |
| Working at Home                       |                                                                 Home contacts inflation due to working from home: | `r input$w2h`                   |
| School Closures                       |                                                                    Home contacts inflation due to school closure: | `r input$s2h`                   |
| Shielding the Elderly                 |                                                                                                         Efficacy: | `r input$cocoon_eff`            |
| Shielding the Elderly                 |                                                                     Minimum age for elderly shielding: (0 to 100) | `r input$age_cocoon`            |
| Vaccination                           |                                                                           Time to reach target coverage (1 to 52) | `r input$vac_campaign`          |
| Vaccination                           |                                                                            (v16.2) Duration of efficacious period | `r input$vac_dur`               |
| Vaccination                           |                                                     (v16.2) Duration of efficacious period if previously infected | `r input$vac_dur_r`             |
| Vaccination                           |                                                                                                          Efficacy | `r input$vaccine_eff`           |
| Vaccination                           |                                                                           (v16.2) Efficacy if previously infected | `r input$vaccine_eff_r`         |
| Mass Testing                          |                                                                                                       Sensitivity | `r input$mass_test_sens`        |
| Mass Testing                          |                                                                                                    Isolation days | `r input$isolation_days`        |
| Dexamethasone                         |                                                               Relative risk of dying if needing O2 and taking Dex | `r input$dexo2`                 |
| Dexamethasone                         |                                                      Relative risk of dying if needing ventilation and taking Dex | `r input$dexv`                  |
| Dexamethasone                         |                                            Relative risk of dying if needing  but not receiving O2 and taking Dex | `r input$dexo2c`                |
| Dexamethasone                         |                                    Relative risk of dying if needing but not receiving ventilation and taking Dex | `r input$dexvc`                 |
| Dexamethasone                         |                                                                    Change in ventilation requirement if given Dex | `r input$vent_dex`              |


