This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run full evaluation sequence for all forecast models saved in data-processed/ | |
# Sources for this code taken from: | |
# https://github.com/epiforecasts/covid19-forecast-hub-europe/blob/main/code/reports/compile-evaluation-reports.r | |
# https://github.com/epiforecasts/covid19-forecast-hub-europe/blob/main/code/reports/evaluation/evaluation-report.Rmd | |
# https://github.com/epiforecasts/EuroForecastHub/blob/main/R/score_models.R | |
# https://github.com/epiforecasts/covid19-forecast-hub-europe/tree/main/code/reports/rmdchunks | |
# Set up ------------------------------------------------------------------ | |
# R session working directory should be set to a local clone of covid19-forecast-hub-europe/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(covidHubUtils) | |
library(ggplot2) | |
# Set up | |
min_date <- Sys.Date() - 6 * 7 # set an earliest date to display (eg six weeks) | |
location_names <- hub_locations_ecdc$location_name # set which countries to display (eg all countries with data) | |
# Get data | |
ecdc_daily <- load_truth(truth_source = "ECDC", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test forecast file | |
library(dplyr) | |
library(tibble) | |
library(readr) | |
library(purrr) | |
library(here) | |
# `tests` contains 9 tibbles each to test one element of validation | |
# Each tibble is a forecast with one valid row (location A) and one invalid row (location B) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot Euro hub ensemble forecasts by European region | |
library(here) | |
library(covidHubUtils) | |
library(countrycode) | |
library(dplyr) | |
library(lubridate) | |
library(ggplot2) | |
library(tidyr) | |
library(purrr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Count teams contributing to European Forecast hub over time | |
library(gh) | |
library(purrr) | |
library(dplyr) | |
library(lubridate) | |
library(ggplot2) | |
library(ggrepel) | |
# Get model names / dates from github --------------------------- | |
model_names <- gh(paste0("/repos/covid19-forecast-hub-europe/covid19-", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a template scenario projection | |
library(dplyr) | |
library(tidyr) | |
library(readr) | |
# Variables | |
origin_date <- as.Date("2022-05-22") | |
scenario_id <- paste0(c("A", "B", "C", "D"), "-", origin_date) | |
age_group <- c("0-15", "16-64", "65-130", "0-130") | |
target_variables <- c("inc case", "inc hosp", "inc death", "inc inf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: code by Hugo Gruson (Github @Bisaloo) | |
# https://github.com/covid19-forecast-hub-europe/covid19-forecast-hub-europe/blob/main/.github/workflows/create-parquet.yml | |
library(readr) | |
library(arrow) | |
library(dplyr) | |
library(lubridate) | |
locations <- read_csv( | |
here::here("data-locations", "locations_eu.csv")) |> | |
dplyr::select(location, location_name, population) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gets variants of concern dataset from ECDC | |
# For each variant/country finds the first period | |
# with variant % greater than 5% and up to 50% | |
# before the first peak for that variant | |
# Note ECDC data are in weeks, dates are indexed to Saturdays to match target end dates | |
# | |
# Example | |
# variant_names <- c("B.1.617.2" = "Delta", "B.1.1.529" = "Omicron") | |
# forecast_variants <- download_variant_introduction(introduction_percent = 5, | |
# country_names = "Germany", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Appendix: Responses to improving conditions for outbreak modelling" | |
date: "2024" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE) | |
library(knitr) | |
library(googlesheets4) |