-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bihar.R
49 lines (46 loc) · 1.89 KB
/
Bihar.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
onset <- as.Date(c("2020-03-22", "2020-03-22",
"2020-03-24", "2020-03-26", "2020-03-26", "2020-03-26",
"2020-03-27", "2020-03-27", "2020-03-27",
"2020-03-29", "2020-03-29",
"2020-03-30", "2020-03-30", "2020-03-30", "2020-03-30",
"2020-04-01", "2020-04-01", "2020-04-01", "2020-04-01", "2020-04-01", "2020-04-01", "2020-04-01", "2020-04-01",
"2020-04-02",
"2020-04-03", "2020-04-03", "2020-04-03", "2020-04-03", "2020-04-03",
"2020-04-04", "2020-04-06", "2020-04-06",
"2020-04-08", "2020-04-08", "2020-04-08", "2020-04-08", "2020-04-08", "2020-04-08",
"2020-04-09",
"2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10", "2020-04-10",
"2020-04-12", "2020-04-12", "2020-04-12", "2020-04-12",
"2020-04-14", "2020-04-14",
"2020-04-15", "2020-04-15", "2020-04-15", "2020-04-15",
"2020-04-16", "2020-04-16", "2020-04-16", "2020-04-16"))
library(incidence)
i1 <- incidence(onset)
i1
plot(i1, border = "white")
mu <- 4.7 # mean in days days
sigma <- 2.9 # standard deviation in days
library(earlyR)
res <- get_R(i1, si_mean = mu, si_sd = sigma)
res
plot(res)
plot(res, "lambdas", scale = length(onset) + 1)
abline(v = onset, lwd = 3, col = "grey")
abline(v = today, col = "blue", lty = 2, lwd = 2)
points(onset, seq_along(onset), pch = 20, cex = 3)
R_val <- sample_R(res, 1000)
summary(R_val)
quantile(R_val)
quantile(R_val, c(0.025, 0.975))
hist(R_val, border = "grey", col = "navy",
xlab = "Values of R",
main = "Sample of likely R values")
si <- res$si
si
library(projections)
future_i <- project(i1, R = R_val, n_sim = 1000, si = res$si, n_days = 30)
future_i
mean(future_i)
plot(future_i)
predicted_n <- colSums(future_i)
summary(predicted_n)