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("tidyr") | |
library("dplyr") | |
library("cowplot") | |
library("stringi") | |
library("scales") | |
library("ggplot2") | |
library("here") | |
dt_contacts <- readRDS("contacts.rds") |
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
#' Aggregate daily forecasts to weekly forecasts | |
#' | |
#' Aggregate daily case forecasts from regional_epinow2 to weekly forecasts. | |
#' | |
#' @param inf List output from `EpiNow2::regional_epinow()`. No default. | |
#' @param week_start Week start day. Default is 1 (Monday). | |
#' @param summary_quantiles Quantiles for forecast summary. Default is median, plus upper and lower bound for 20\%, 50\% and 90\% forecasts. | |
#' @importFrom dplyr group_by summarise filter mutate select case_when contains | |
#' @importFrom tidyr pivot_wider | |
#' @importFrom purrr map_df |
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
# Updated from https://gist.github.com/pkazmier to support yabai | |
# | |
# The following configuration heavily leverages modal keymaps to minimize the | |
# pollution of global keybindings. In addition, the modal keymaps facilitate | |
# the consistent use of the same keybindings across different modes. For | |
# example, this configuration uses 'h', 'l', 'j', and 'k' to represent west, | |
# east, south, and north when: changing focus, warping windows, resizing | |
# windows, swapping windows, and moving floating windows. Those four keys are | |
# mapped differently depending on the current mode to provide a consistent user | |
# experience. |
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("readr") | |
library("dplyr") | |
df <- readr::read_csv("https://raw.githubusercontent.com/epiforecasts/inc2prev/master/outputs/estimates_age_ab.csv") ## nolint | |
td <- df |> | |
dplyr::filter(name == "infections") |> | |
dplyr::select(t_index, date) |> | |
dplyr::distinct() |> | |
dplyr::arrange(t_index) |
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("devtools") | |
library("here") | |
library("socialmixr") | |
redo <- FALSE | |
files_file <- here::here("files.rds") | |
dir.create(here::here("surveys"), showWarnings = FALSE) | |
if (!file.exists(files_file) || redo) { | |
ls <- list_surveys() |
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
# Load packages | |
library(brms) | |
library(cmdstanr) | |
library(data.table) # here we use the development version of data.table install it with data.table::update_dev_pkg | |
library(purrr) | |
library(bpmodels) # devtools::install_github("sbfnk/bpmodels") | |
# Set up parallel cores | |
options(mc.cores = 4) |
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("readr") | |
library("dplyr") | |
library("janitor") | |
library("lubridate") | |
library("ggplot2") | |
## SOURCE 1: download data | |
df <- read_delim("https://www.sanidad.gob.es/profesionales/saludPublica/ccayes/alertasActual/nCov/documentos/Datos_Capacidad_Asistencial_Historico_19102022.csv", delim = ";", show_col_types = FALSE) | |
df_national <- df %>% |
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
##' Get estimates shown at \url{https://epiforecasts.io/covid} for all times | |
##' | |
##' Nowcasts at \url{https://epiforecasts.covid} and the related github repository at | |
##' \url{https://github.com/epiforecasts/covid-rt-estimates} only cover the last 3 | |
##' months. This function downloads all available estimates and applies a median | |
##' average to the provided quantiles to provide an estimate of a time series | |
##' covering all times available | |
##' | |
##' @param dataset character; data set corresponding to directories at | |
##' \url{https://github.com/epiforecasts/covid-rt-estimates}. Default is |
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("readr") | |
library("dplyr") | |
library("ggplot2") | |
highlight_models <- c( | |
"EuroCOVIDhub-ensemble", "KITmetricslab-bivar_branching", | |
"EuroCOVIDhub-baseline" | |
) | |
model_scores <- read_csv(paste0( |
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("readr") | |
library("dplyr") | |
library("lubridate") | |
library("here") | |
library("tidyr") | |
regional_estimates <- | |
read_csv(paste0("https://raw.githubusercontent.com/epiforecasts/inc2prev/", | |
"master/outputs/estimates_regional.csv")) | |
national_estimates <- |
NewerOlder