Code Monkey home page Code Monkey logo

covid_logistic's Introduction

Logistic Regression Modeling For Covid

This is a simple way of predicting the total number of deaths or cases by assuming that the growth in these numbers will follow a logistic growth curve.

Virtually every major epidemic has resulted in growth curves that look like this (even in some cases where there is under-testing), and every country has been roughly following this pattern so far.

These results will be updated at midnight pacific time every day by pulling data from Johns Hopkins, and with more data, the predictions will improve. The model is not likely to work well when the data is still very noisy and a clear trend hasn't emerged, and to give a sense of which predictions are more noisy I have plotted the trends the model is using here:

Deaths

Image

Confirmed cases

Image

How the Model Works

One simple way to fit this model is to plot the number on the x axis and the percent growth from the previous point on the y axis. For a perfect logistic curve this relationship will be linear. So then I fit a line to the resulting points and project out to where the growth rate eventually falls to 0, indicating the total number has plateaued. I take that number as the prediction.

I assume that the larger the number of cases gets, the less noisy the data is getting, so I weight each example by the number of cases when fitting the linear model.

This model is not likely to work well when the total number is still small, so am focusing on countries that have reported more than 100 deaths. I am open to adding more countries: just suggest a color and a country and I can add it.

For a good primer on Logistic Growth, see this great video by 3Blue1Brown

I will be updating this data daily using the code in this Github repo.

Caveats:

  1. There is likely to be a second increase in cases after the summer. This surge will likely be another logistic curve on top of this one.
  2. If there is a huge change in policy or approach to managing the pandemic (people stop social distancing), then the model will most likely underpredict massively. Predictions from this model should never be used to justify ceasing effective preventative measures like social distancing.
  3. If there is a huge surge in testing, the model will probably get confused for a few days and then eventually recover.

covid_logistic's People

Contributors

ardila avatar dependabot[bot] avatar ruairidhwm avatar

Stargazers

 alex arsenovic avatar Conrad Sollitt avatar

Watchers

James Cloos avatar  avatar  avatar

covid_logistic's Issues

sliding window fit

hey this is a great simple analysis. thanks for making it.

one thing i did based on this idea, you might be interested in, is to make a sliding window for the fit. say, you take the last N days of data for the fit, compute the total #cases/deaths from the trendline on these N pts, and then slide the window backwards in time. this gives an idea of how the estimates are changing.

https://gist.github.com/arsenovic/a6df5f5f4ef879e8a67346cc0626b10a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.