# Covid-19 Forecast based on ECDC Country Data

Posted 2 months ago
656 Views
|
2 Replies
|
4 Total Likes
|
 I'm working in as public nonprofit website to show Brazil Covid-19 cases (https://covid.looqbox.com), and would like to know how can I use the models in:In the forecast of Covid-19 spreading in my country (or any other).To get any country data, I'm using www.ecdc.europa.eu information getCovidDataECDC[date_String]:= Module[{r, url, file, heads}, heads = {"date","day","month","year","cases","deaths","country","geoId"}; url = "https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide-"<>date<>".xlsx"; r = First@Import@URLDownload[url]/.(d_DateObject :> DateString[d, {"Year", "-", "Month", "-", "Day"}]); r = AssociationThread[heads -> #]&/@Rest@r//KeyDrop[{"day", "month", "year"}]; r ] $covidDataECDC = getCovidDataECDC["2020-03-20"] And you can get a country data using: getCountryData // ClearAll getCountryData[countryCode_, arg_]:= getCountryData[countryCode][arg] getCountryData[countryCode_]:= Module[{data}, data = Select[$covidDataECDC, #[["geoId"]] == countryCode&]; data = SortBy[data, #[["data"]]&]; data[[All, "casesAcc"]] = Accumulate@data[[All, "cases"]]; data[[All, "deaths"]] = Accumulate@data[[All, "deaths"]]; <|"population"-> CountryData[countryCode, "Population"] , "data"-> data |> ] As you can see, things are starting to getting exponential here: DateListPlot[ getCountryData["BR", "data"][[All, {"date", "casesAcc"}]] , PlotRange->{{"2020-02-25", "2020-03-20"}, All} ] Any clue?
2 Replies
Sort By:
Posted 2 months ago
 "Getting the data into a model" is essentially the process of fitting the adjustable parameters of a model so that the model predicts the data as closely as possible. One needs to fit the data for each country separately. For the influenza models I was able to use NonlinearModelFit because there were data available for only one compartment. For the COVID-19 models, I'm trying to fit confirmed case, recovered cases, and deaths, so I've been using NMinimize along with a custom function that computes the sum of squared errors of the model with a given set of parameter values against the observed data. So far, I have not found a model structure that allows me to do this with a sufficient degree of accuracy. Success depends very much on the choice of terms in the model, which is equivalent to the compartments and connections in the compartmental models I'm using.