hunterecon2 / epidemics

A place to share code and ideas about epidemics and economics
MIT License
1 stars 0 forks source link

The Susceptible-Infected-Recovered (SIR) model #1

Open jhconning opened 4 years ago

jhconning commented 4 years ago

Many recent economics papers on the coronavirus outbreak use or extend the SIR model (see a list of some on this wiki page which you can edit).

To get a feel for the model I wrote up short jupyter notebook SIRmodel.ipynb which you can run as a web app here

We started to discuss this in a department email chain. I'm moving the discussion here for those who want to follow because it's easier to link to materials on the repository and we don't have to bombard everyone's email box. Click on the 'Watch' button on top of github page to get email notifications.

Tim asks:

On Wed, Apr 1, 2020, at 2:57 PM Timothy j Goodspeed tgoodspe@hunter.cuny.edu wrote: Is it the case that if the recovery rate gamma (not alpha sorry) is pretty high nothing else really matters?  Isn’t that the case for this particular virus?

I'm no expert on the SIR model (I only just wrote up that notebook last night!) but from a quick search a few things:

Using that web app, here is the model with an R0=Beta/Gamma = 0.5/0.1. You see the infection rising quickly and reaching ~50 percent ('overwhelming the hospitals')

image

If we lower to an R0=Beta/Gamma = 0.5/0.3 the curve is flattened, here done by raising the recovery rate, but it could have been done just the same by instead lowering the (beta) infection rate via 'social distancing'

image

I'm not sure what numbers are begin used for Covid19. In this model (where the time units haven't been specified) the gamma recovery rate presumably maps onto how quickly people recover (or drop dead). The paper by Moll and others seems to get at these calibration issues.

jhconning commented 4 years ago

This article, just published in Science, goes quite a bit deeper into the same basic SIR model but elaborates a good deal on different pathways that affect the Reproduction rate R0 (including accounting for asymptomatics) and estimation of parameters: https://science.sciencemag.org/content/early/2020/03/30/science.abb6936

They decompose their point estimate of 2.0 for the reproduction rate R0 into transmission components

They advocate for testing with "instant digital contact tracing" (basically phone app to track and limit movements) to bring the R0 to under 1.

image image

tgoodspeed commented 4 years ago

I think it is easier to understand by adding the fourth identity equation: N = St+It+Rt so that dN = dSt + dIt + dRt = 0 with fixed N. This is what Stock is assuming and is also captured in your equations and graph (the three categories always add up to 1 or some constant). So the recovered are not dead, the population is just shifting around among the categories S, I, R. That's why he has in the first equation dS = negative newly infected. The newly infected go from S to I. That's why he has dI = newly infected - recovered. And the recovered go from I to R. That's why he has dR = gamma times infected, a certain proportion of infected last period recover and move to the R category.

jhconning commented 4 years ago

OK, but I don't think there is any change to the model if we do count the dead. As they leave the infected group the grim reaper splits the 'removed/recovered' Rt into two groups. One is labeled living and the other dead:

Rt = Lt + Dt

The main model is exactly as before

dIdt = beta * St * It - gamma* It dRdt = gamma * It dSdt = - gamma * It

But as they are moved from infected to 'removed' a fraction a of them labeled as 'dead' and we keep them in the total count N. Nothing has changed except now we track the proportion labeled as dead:

dDdt = a*dRdt = a*gamma*It

tgoodspeed commented 4 years ago

Well just a slight change. There aren’t any dead in this model. But you can add them. Just say that a certain proportion alpha of R survive and 1 - alpha die. The dead can be captured in some variable D and then N including D stays constant. Or you can graph N-D to show the effects of mortality. I don’t know if this is how it’s done in the literature but it is an easy way. Stock mentions a mortality model, I don’t know what they do in those.

Sent from my iPhone

On Apr 1, 2020, at 6:17 PM, Jonathan Conning notifications@github.com wrote:



OK, but I don't think there is any change to the model if we do count the dead. As they leave the infected group the grim reaper splits the 'removed/recovered' Rt into two groups. One is labeled living and the other dead:

Rt = Lt + Dt

The main model is exactly as before

dIdt = beta St It - gamma It dRdt = gamma It dSdt = - gamma * It

But as they are moved from infected to 'removed' a fraction a of them labeled as 'dead' and we keep them in the total count N. Nothing has changed except now we track the proportion labeled as dead:

dDdt = adRdt = agamma*It

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/hunterecon2/epidemics/issues/1#issuecomment-607517495, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APA2EWVZ6SKD543LKXALR3LRKO4QBANCNFSM4LZQRTEA.

tgoodspeed commented 4 years ago

Oh, sorry I think you already wrote that.

Sent from my iPhone

On Apr 1, 2020, at 6:17 PM, Jonathan Conning notifications@github.com wrote:



OK, but I don't think there is any change to the model if we do count the dead. As they leave the infected group the grim reaper splits the 'removed/recovered' Rt into two groups. One is labeled living and the other dead:

Rt = Lt + Dt

The main model is exactly as before

dIdt = beta St It - gamma It dRdt = gamma It dSdt = - gamma * It

But as they are moved from infected to 'removed' a fraction a of them labeled as 'dead' and we keep them in the total count N. Nothing has changed except now we track the proportion labeled as dead:

dDdt = adRdt = agamma*It

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/hunterecon2/epidemics/issues/1#issuecomment-607517495, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APA2EWVZ6SKD543LKXALR3LRKO4QBANCNFSM4LZQRTEA.

jhconning commented 4 years ago

Crossed posts..Great minds think alike...

jhconning commented 4 years ago

Very good, didactic, video from 3Blue1Brown on simulating epidemics, and effects of social distancing, testing etc via simulation in a random SIR model framework.

Demonstrates relative (what if people don't move at random but instead regularly go to some central location like a train station, or commute to a center and back, etc, the effect of testing and isolation, effect of having asymptomatics, etc) https://www.youtube.com/watch?v=gxAaO2rsdIs

tgoodspeed commented 4 years ago

Attached is a relatively easy sketch of the graphical solution to the model with comparative statics for gamma, beta.


Timothy J. Goodspeed Professor of Economics Department of Economics Hunter College and Graduate Center - CUNY 695 Park Avenue New York, NY 10065 USA

Telephone: 212-772-5434 Telefax: 212-772-5398 e-mail: timothy.goodspeed@hunter.cuny.edumailto:timothy.goodspeed@hunter.cuny.edu http://econ.hunter.cuny.edu/faculty/economics-faculty/timothy-j-goodspeed

From: Jonathan Conning [mailto:notifications@github.com] Sent: Wednesday, April 01, 2020 7:10 PM To: hunterecon2/epidemics Cc: Timothy j Goodspeed; Comment Subject: Re: [hunterecon2/epidemics] The Survived-Infected-Recovered (SIR) model (#1)

Crossed posts..Great minds think alike...

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/hunterecon2/epidemics/issues/1#issuecomment-607533522, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APA2EWS6J3RQYP5QBIETCNLRKPCT7ANCNFSM4LZQRTEA.

jhconning commented 4 years ago

Tim, For anyone following online, I put Tim's file here

Thanks for that visual approach. How do you show dS(t) is concave in I(t) ?

jhconning commented 4 years ago

A nice set of online slides on probabilistic and deterministic versions of the SIR:

http://www.stat.cmu.edu/~cshalizi/dm/20/lectures/special/epidemics.html