This file contains hidden or 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(primarycensored) | |
library(ggplot2) | |
n <- 1e4 | |
mean <- 10 | |
sd <- 0.5 | |
obs_time <- 30 | |
pwindow <- 1 | |
# Random samples without primary event censoring |
This file contains hidden or 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(epinowcast) | |
library(data.table) | |
library(ggplot2) | |
# Load and filter germany hospitalisations | |
nat_germany_hosp <- germany_covid19_hosp[location == "DE"][age_group %in% "00+"] | |
nat_germany_hosp <- enw_filter_report_dates( | |
nat_germany_hosp, | |
latest_date = "2021-10-01" |
This file contains hidden or 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) | |
# Set up parallel cores | |
options(mc.cores = 4) | |
# Simulate some truncated and truncation data |
This file contains hidden or 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
functions{ | |
#include functions/ct_trajectory.stan | |
#include functions/truncated_normal_rng.stan | |
#include functions/censor.stan | |
} | |
data { | |
int P; // number of patients | |
int N; // number of tests | |
real c_lod; // Ct value at limit of detection |
This file contains hidden or 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(data.table) | |
library(snakecase) | |
library(ggplot2) | |
# make a convolution matrix | |
convolution_matrix <- function(vec1, vec2) { | |
lvec1 <- length(vec1) | |
lvec2 <- length(vec2) | |
conv <- matrix(0, nrow = lvec1, ncol = lvec1) | |
for (s in 1:lvec1) { |
This file contains hidden or 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(covidregionaldata) | |
# set up a data cache | |
start_using_memoise() | |
#> Using a cache at: /tmp/RtmphiSeWY | |
# check for supported countries | |
get_available_datasets() | |
#> # A tibble: 18 x 8 | |
#> origin class level_1_region level_2_region level_3_region type data_urls |
This file contains hidden or 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
# Packages ---------------------------------------------------------------- | |
require(data.table, quietly = TRUE) | |
require(EpiNow2, quietly = TRUE) | |
require(purrr) | |
require(ggplot2) | |
# Target date ------------------------------------------------------------- | |
creation_date <- Sys.Date() | |
extraction_date <- creation_date |
This file contains hidden or 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
# Packages ---------------------------------------------------------------- | |
library(covid19.nhs.data) | |
library(vroom) | |
library(dplyr) | |
library(tidyr) | |
library(lubridate) | |
library(gganimate) | |
#devtools::install_github("thomasp85/transformr") | |
library(transformr) | |
library(gifski) |
This file contains hidden or 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
# Packages ---------------------------------------------------------------- | |
library(covid19.nhs.data) | |
library(dplyr) | |
library(tidyr) | |
library(lubridate) | |
library(gganimate) | |
#devtools::install_github("thomasp85/transformr") | |
library(transformr) | |
library(gifski) | |
library(ggplot2) |
This file contains hidden or 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
# Packages ---------------------------------------------------------------- | |
library(covid19.nhs.data) | |
library(dplyr) | |
library(tidyr) | |
library(lubridate) | |
library(gganimate) | |
#devtools::install_github("thomasp85/transformr") | |
library(transformr) | |
library(gifski) | |
library(ggplot2) |
NewerOlder