Skip to content
Prev 383633 / 398502 Next

COVID-19 datasets...

Another option is

https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide

Together with instruments from

https://www.repidemicsconsortium.org/

Cheers
Petr

Here is some simple code

library(EpiEstim)
library(ggplot2)
library(lubridate)
library(incidence)
library(distcrete)
library(epitrix)
library(readxl)

mena <- c("Austria", "Czechia", "Germany", "Italy", "Japan", "Russia", "South_Korea", 
"Spain", "Sweden", "Taiwan", "United_States_of_America", "United_Kingdom")

plot_Ri <- function(estimate_R_obj) {
    p_I <- plot(estimate_R_obj, "incid") + ggtitle(staty[vyber][i])  # plots the incidence
    p_SI <- plot(estimate_R_obj, "SI")  # plots the serial interval distribution
    p_Ri <- plot(estimate_R_obj, "R") + ylim(c(0,5))
    return(gridExtra::grid.arrange(p_I, p_Ri, ncol = 1))
}

data <- read_excel("covid.xlsx")
data <- as.data.frame(data)
staty <- levels(factor(data[,7]))
vyber <- which(staty %in% mena)
staty[vyber]

# covid.xlsx is downloaded data

vyber <- which(staty %in% mena)
vyber <- vyber[-6]
staty[vyber]
ddd <- vector("list", length=length(vyber))
pdf("grafy2.pdf")
for (i in 1:length(vyber)) {
temp <- data[data[,7]==staty[vyber][i],]
temp$cas <- ymd(temp$dateRep)
ooo <- order(temp$cas)
temp <- temp[ooo,]
temp<- temp[-1,]
temp <- temp[-(1:min(which(temp$cases>0))-1),]
head(temp)
test <- temp[, c(12,5)]
names(test) <- c("date", "I")
test$I <- abs(test$I)
inc <- rep(test$date, test$I)
inci <- incidence(inc)
peak <- find_peak(inci)
fit <- incidence::fit(inci, split=peak)
print(plot(inci, fit = fit)+ggtitle(staty[vyber][i]))
ddd[[i]] <- rbind(fit$before$info$doubling.conf, fit$after$info$halving.conf)
vysled <- estimate_R(test, method = "uncertain_si",
    config = make_config(list(mean_si = 4, std_mean_si = 2,
        min_mean_si = 1, max_mean_si = 8.4, std_si = 2.4, std_std_si = 1,
        min_std_si = 0.5, max_std_si = 4, n1 = 1000, n2 = 1000)))
print(plot_Ri(vysled))
}
dev.off()
names(ddd) <- staty[vyber]
ddd