Gustavo D. Muzzillo
24/3/2020
Because of the COVID-19 Pandemia, Argentine Federal Goverment impossed a total quarantine for the whole national territory on March 19 of 2020. Since Argentine’s Public Health ministry publish the statistics to the World Health Organization I’ve decided to exploit the information extracted from the WHO by JHU CSSE to monitor the Argentinian case and somehow measure the effect of the quarentine.
The application hosted at: https://gdmuzzillo.shinyapps.io/COVID_19_Argentina is based on the following datasources prepared by JHU CSSE labs:
– Sumary of Confirmed cases
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0 18.0 128.0 455.9 782.5 1715.0
– Sumary of recovered patients
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 0.00 3.00 82.69 150.00 358.00
# Read CSV Datasets
dfConfirmed <- read.csv(file = "time_series_covid19_confirmed_global.csv")
dfDeaths <- read.csv(file= "time_series_covid19_deaths_global.csv")
dfRecovered <- read.csv(file = "time_series_covid19_recovered_global.csv")
# Filter for argentinian events
dfConf <- dfConfirmed[dfConfirmed$Country.Region=="Argentina",]
dfDth <- dfDeaths[dfDeaths$Country.Region=="Argentina",]
dfRec <- dfRecovered[dfRecovered$Country.Region=="Argentina",]
#Transform into a proper time series Data Frames
tsConfirm <- melt(dfConf,c("Province.State","Country.Region","Lat","Long"),na.rm = TRUE)
tsDeath <- melt(dfDth,c("Province.State","Country.Region","Lat","Long"),na.rm = TRUE)
tsRecovered <- melt(dfRec,c("Province.State","Country.Region","Lat","Long"),na.rm = TRUE)
#Transform date columns (Variable) to be ISO compatible Dates
tsConfirm$variable <- sub("X","",tsConfirm$variable)
tsDeath$variable <- sub("X","",tsDeath$variable)
tsRecovered$variable <- sub("X","",tsRecovered$variable)
tsConfirm$variable <- as.Date(tsConfirm$variable, format = "%m.%d.%y")
tsDeath$variable <- as.Date(tsDeath$variable, format = "%m.%d.%y")
tsRecovered$variable <- as.Date(tsRecovered$variable, format = "%m.%d.%y")
monthDate <- as.Date( paste( "2020", "03" , "01", sep = "-"), format = "%Y-%m-%d")
tsConfirm <- tsConfirm[tsConfirm$variable >= as.Date(monthDate),]
tsRecovered <- tsRecovered[tsRecovered$variable >= as.Date(monthDate),]
tsDeath <- tsDeath[tsDeath$variable >= as.Date(monthDate),]
tsPred <- xts(x = tsConfirm$value, order.by = tsConfirm$variable)
tsPredDm <- dynlm(formula=tsConfirm$value ~ trend(tsConfirm$value)+L(tsConfirm$value), data = tsConfirm )
tsPred1 <- predict(tsPredDm)
tsConfirm$pred <- as.ts(tsPred1)
tsConfirm$recovered <- tsRecovered$value
tsConfirm$deaths <- tsDeath$value
tsConfirm$diffConfirmed <- as.zoo(diff(tsPred,lag=1,differences=1, na.pad = TRUE))