Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

Pobeka

(4,999 posts)
Mon Mar 9, 2020, 09:34 PM Mar 2020

Anyone used the SIR for infectious disease?

https://en.wikipedia.org/wiki/Mathematical_modelling_of_infectious_disease#The_SIR_model

Super simple model. I coded it in Perl, whopping 40 lines of code, I added a nuance to quarantine a portion of the infected.

What I found, (regardless of total population). If beta (similar to R0) drops from 1.5 to 1.0, the peak number of cases is cut in half. Implication being that
if we can reduce interpersonal contacts by just 33% each day we'll push the peak case load down and out. If you can quarantine 50% of the infected cases the peak reduces by about 80%.

But you can't quarantine cases if you don't test for them...

[code]

use strict ;
use warnings ;

my $s_pop=10000000 ; # susceptible
my $i_pop=1 ; # infected
my $r_pop=0 ; #dead or immune
my $tot_pop = $s_pop + $i_pop + $r_pop ;

my $beta0=$ARGV[0] ; # per week
my $beta2=$ARGV[1] ; # per week
my $delay=$ARGV[2] ; # weeks

die "usage sir.pl <betaO> <beta2> <delay2>" if ! defined $beta0 ;

my $cases=1 ;
my $day=0 ;

my $beta=$beta0 ;
my $gamma=0.5 ; # assume it takes 1/(2 weeks) to recover
my $p_q = 0.0 ; # proportion of infected who are quarantined.
my $p_uq = 1.0-$p_q ; # proportion of population quarantined, but infected.

for(my $week=1 ; $week < 50 ; $week++) {
my $pct=$i_pop/$tot_pop*100 ;

print "week $week -- infected cases $i_pop, $pct %n" ;

if(defined($beta2) && defined($delay)) {
$beta = $beta2 if $week >= $delay ;
}

my $ds = -$p_uq*$beta*$s_pop*$i_pop/$tot_pop ;
my $di = $p_uq*$beta*$s_pop*$i_pop/$tot_pop - $gamma*$i_pop ;
my $dr = $gamma*$i_pop ;

$s_pop += $ds ;
$i_pop += $di ;
$r_pop += $dr ;
}
[/code]
6 replies = new reply since forum marked as read
Highlight: NoneDon't highlight anything 5 newestHighlight 5 most recent replies

Pobeka

(4,999 posts)
4. Tweaked the code and made a graph
Tue Mar 10, 2020, 11:50 AM
Mar 2020
http://imgur.com/a/2MHcy0A

The code tweak was to directly model the recovery/death time as 7 days. The code uses new cases from 7 days prior, as an estimate of how many cases to remove from the infected population.

The graph reflects just 10% of the total active cases, assuming they'd be the ones needing critical care/ventilators etc.

What's interesting is if you delay the social distancing measure by 33% at 4 weeks (approx now), you still reduce the peak by well over half. The peak comes sooner in this case because there are more cases at week 4 (due to no social distancing) than the 33% social distancing that starts immediately

Canoe52

(2,948 posts)
5. Great graph, I've shared it the last few days. Interesting that overall infections is roughly the
Fri Mar 13, 2020, 01:37 AM
Mar 2020

same for reduce interactions 33% and reduce interactions 33% at week four. (If I’m reading it right?) looks like the UK is taking the later action.

Pobeka

(4,999 posts)
6. CAUTION: Absolute numbers of the graph not going to be reasonable.
Fri Mar 13, 2020, 09:50 AM
Mar 2020

But the relative impacts comparing one peak to another are the important message.

Same stuff we're seeing in the "flatten the curve" folks.

And yes, you are reading it right. There is a grace period to implement these measures. BUT, it assumes *perfect* knowledge about when the first case appeared in the population. Wouldn't surprise me that we have a lag of 30 days of detecting a case, after the first actually appeared.

And now we know asymptomatic transmission has been occuring all along,

Bottom line, for Seattle at least, we're probably already 50 days into this already.

Latest Discussions»Culture Forums»Science»Anyone used the SIR for i...