Check my Twitter thread for daily updates.
Data sources: @MontgomeryCoMD early on, and Maryland Department of Health, scraped daily.
This work began as a port of @psteinb's excellent chart for Dresden, Germany
Early work performed a least-squares fit to the available data. The number of
deaths due to COVID-19 and the number of confirmed cases were modeled using a
logistic function g(t)
.
A simpler model, which was useful at the start of the pandemic, is the
exponential growth equation,
f(t)
.
where t is time, in days since the first reported cases. The fitting parameters are a, b, and c. For the exponential, a is the initial number of cases and b is the growth rate. For the logistic, a is the reciprocal of the growth rate (steepness), b is the time-coordinate of the inflection point, and c is the size of the population.
The fitting process used in this analysis gives a covariance matrix for the model parameters. From the covariance matrix, it's possible to compute the one-standard-deviation (sigma) bounds on the parameters, assuming that the uncertainty on the number of COVID-19 cases for each day is the same. The gray bands are the plus-one-sigma (upper) and minus-one-sigma (lower) deviations from the least-squares fit.
As of the beginning of the second surge, the simple curve-fitting approach proved hopelessly incapable of representing reality, and that part of the project was disabled. Since then, the daily tweets visualize the past and current state of the virus, but make no attempt to predict the future.
-
Install Python 3
-
Install dependencies
$ conda install matplotlib numpy pandas scipy
-
Run the
exponential.py
script against the included dataset$ python exponential.py
-
Create your own dataset and compare your location, e.g.,
date,killed,diagnosed,source 2020-03-05,0,3,"https://www.montgomerycountymd.gov/HHS/RightNav/Coronavirus.html" 2020-03-08,0,4,"https://www2.montgomerycountymd.gov/mcgportalapps/Press_Detail.aspx?Item_ID=23951"
Gaps in the data are all right, just provide what you have. You will want to edit the script to set the proper title.
-
Share your findings to help others assess the spread of SARS-CoV-2, and to gauge the effectiveness of our collective response.
For non-linear curve fitting, the reduced chi-squared statistic provides an indication of the goodness-of-fit. It is also instructive to look at the residual, or difference between the real value and its fitted estimate each day,
Please DM me on Twitter.