Giter VIP home page Giter VIP logo

rt-simulator's Introduction

An interactive simulation that demonstrates how important it is to keep COVID-19's reproduction number (Rt) below 1.

I think most folks understand how dangerous it would be if each infected person spread the virus to 2 more people, but I imagine many would be surprised at how quickly cases rise if each person with COVID "only" infects an average of 1.1 people.

A preview of the animated Rt simulation chart, showing the 13-fold growth of new cases in the next four months if Rt = 1.1, then moving to show how quickly new cases shrink if Rt = 0.9.

The simulation also allows the user to choose a U.S. state to fill its current Rt estimate (sourced from Rt Live) and average daily cases, so they can see their own state's current outlook.

A similar chart showing the projection of the next four months given the State of New York's current Rt estimate and average daily cases. At the time of this screenshot, the median Rt estimate was 0.92, with an 80% confidence interval between 0.73 and 1.09.

Methodology, Data, & Tools

I adapted my simulation model from Rt Live's model as they lay out in their tutorial notebook. It accounts for the fact that it takes a few days for an infected person to pass on the virus by incorporating that delay (called the generation time) as a log-normal probability distribution with a mean of 4.7 days and standard deviation 2.9 days. Then, the number of newly infected people on a given day (yt) is a sum that looks at all previous days, weighing the number of newly infected people i days ago (yt - i​) by the generation time probability (gi​) for that number of days and the effective reproduction number (which for the purposes of this simulation is being kept constant at Re​). More succinctly,

y_t = sum_{i = 1}^{M}{y_(t - 1) R_e g_i}

Simulations run from today's date to four months in the future, and they treat every day prior to the start date as having a number of new infections equal to the "Initial daily infections" setting below the chart.

For the "Pick a U.S. state" dropdown, current Rt estimates and average daily cases are fetched directly from Rt Live, and they source their case count data from The COVID Tracking Project. These real-time Rt estimates have an inherent degree of uncertainty, so each estimate includes an 80% confidence interval, which essentially means that we can be 80% sure that the actual Rt value lies somewhere between those upper and lower bounds. You'll notice if you visit Rt Live's homepage that as you look further back in time, these confidence intervals become smaller with the benefit of more data.

These are the primary tools I used in this project:

Also, I have to say, while the focus of this project was the data visualization, not the web development, this project contains the most beautiful React code I've ever written. ⚛️

rt-simulator's People

Contributors

dependabot[bot] avatar tymick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.