-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ladakh1.R
39 lines (36 loc) · 1.1 KB
/
Ladakh1.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
onset <- as.Date(c("2020-03-07", "2020-03-07",
"2020-03-12", "2020-03-16",
"2020-03-17", "2020-03-17", "2020-03-17", "2020-03-17",
"2020-03-20", "2020-03-20",
"2020-03-21", "2020-03-21", "2020-03-21",
"2020-04-03", "2020-04-10", "2020-04-15", "2020-04-15"))
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)