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
diff --git a/t/010_cpu.t b/t/010_cpu.t | |
index d71bfa4..497bdfb 100644 | |
--- a/t/010_cpu.t | |
+++ b/t/010_cpu.t | |
@@ -1,3 +1,4 @@ | |
use Test::More tests => 1; | |
-is(system('script/libbi sample @test.conf') >> 8, 0, 'CPU'); | |
+system('env 1>&2'); | |
+is(system('script/libbi sample @test.conf --verbose') >> 8, 0, 'CPU'); |
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('tidyverse') | |
library('bpmodels') | |
library('epicontacts') | |
obs_tree <- function(obs_prob=0.5, stop_threshold=100, ...) { | |
## generate chains | |
chains <- chain_sim(infinite=stop_threshold, tree=T, ...) | |
observed <- chains %>% | |
mutate(observed=factor(rbinom(n=n(), size=1, prob=obs_prob), |
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
## devtools::install_github("sbfnk/bpmodels") | |
library('bpmodels') | |
## 41 initial exposure events | |
n <- 41 | |
## exposure events distributed over `nexp` days | |
nexp <- 26 ## 8 Dec - 2 Jan according to http://virological.org/t/epidemiological-data-from-the-ncov-2019-outbreak-early-descriptions-from-publicly-available-data/337/1 | |
## randomly sample exposure events | |
t0 <- sample(seq(1, 26), n, replace = TRUE) | |
## mean of serial interval distribution | |
mean_si <- 8.4 ## from Lispsitch et al. (2003) |
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('tidyverse') | |
library('ggplot2') | |
##' Samples size (the number of trials) of a binomial distribution | |
##' copied from https://github.com/sbfnk/bpmodels/blob/master/R/utils.r | |
rbinom_size <- function(n, x, prob) { | |
x + stats::rnbinom(n, x + 1, prob) | |
} | |
## |
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('socialmixr') | |
library('tidyverse') | |
## get China survey | |
s <- get_survey("https://doi.org/10.5281/zenodo.3366396") | |
## contact matrix | |
contact_matrix(s, age.limits = seq(0, 15, 5)) | |
## $matrix |
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("tidyverse") | |
library("ggplot2") | |
library("cowplot") | |
## get mobility data | |
dm <- read_csv("https://www.gstatic.com/covid19/mobility/Global_Mobility_Report.csv") %>% | |
mutate(date = as.Date(date, format = "%d/%m/%Y")) %>% | |
filter(is.na(sub_region_1)) %>% | |
rename(country = country_region) %>% | |
gather(type, value, 6:ncol(.)) %>% |
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
data <- list( | |
est1 = c(`0.025` = 0.84, `0.5` = 0.9, `0.975` = 0.96), | |
est2 = c(`0.025` = 0.32, `0.5` = 0.53, `0.975` = 0.66) | |
) | |
fn_gamma <- function(par, x) { | |
quantiles <- as.numeric(names(x)) | |
return(sum((qgamma(quantiles, shape = par[1], rate = par[2]) - x)**2)) | |
} |
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("gh") | |
library("vroom") | |
owner <- "epiforecasts" | |
repo <- "covid-rt-estimates" | |
path <- "subnational/united-kingdom-local/cases/summary/rt.csv" | |
rt_commits <- | |
gh("/repos/{owner}/{repo}/commits?path={path}", | |
owner = owner, |
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
##' 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 |
OlderNewer