Serving the Quantitative Finance Community

 
User avatar
Cuchulainn
Topic Author
Posts: 20256
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Models for Covid-19

March 26th, 2020, 8:01 pm

Some practical questions which will crop up, so I ask them now.

1. How can I print this figure only (and not the whole bunch of posts).
2. What are the axes' units (y = fraction?, s = S/N?, x = time (days etc.). I reckon absolute numbers for y? My chickenpox prototype used fractions.
3. Are the values of S.I, R, H and D of the same size to get them into a nice single plot? Of course, each one can get its own plot.

download/file.php?id=9079&t=1
 
User avatar
Paul
Posts: 6604
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 26th, 2020, 8:10 pm

1. Ask google, Bill Gates, etc.! 

2. I haven't mentioned units in the ODEs, so they are as they come out of the numerics. But good idea to think of units. Let's make time years, that will mean that when we get parameters they will have meaning.

3. I didn't scale in any way. Axis could go up to 10 i.e. N. Perhaps best to divide all output by N, to get fraction of population. With my parameters they all work on same scale. With better parameters we hope that deaths will need a different scaling.
 
User avatar
Cuchulainn
Topic Author
Posts: 20256
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Models for Covid-19

March 26th, 2020, 8:34 pm

2. For the chicken pox the annual birthrate had to be divided by 52 and e.g. the graph of [$]I(t)[$] is up to 20/25 weeks (it's 50 years since I did dimensional analysis). Realising this subtle point allowed me to reproduce the results. Not unimportant.


I learned a new word today "physiological time unit" [$]\neq[$] chrono time unit.
"degree days"
 
User avatar
Herd
Posts: 17
Joined: October 2nd, 2003, 12:48 pm

Re: Models for Covid-19

March 26th, 2020, 10:04 pm

New imperial paper: see link on Ferguson Twitter
 
User avatar
Paul
Posts: 6604
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 26th, 2020, 10:24 pm

Link?
 
User avatar
trackstar
Posts: 3420
Joined: January 1st, 1970, 12:00 am

Re: Models for Covid-19

March 26th, 2020, 10:34 pm

Link?
Paper link discussed on Twitter is here at IC:
 
The Global Impact of COVID-19 and Strategies for Mitigation and Suppression - Report 12 March 26 2020

and

https://www.imperial.ac.uk/media/imperi ... 3-2020.pdf

If any further information on this front, I will put it on the Pandemic Models thread in the OT for convenience.
 
User avatar
Paul
Posts: 6604
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 26th, 2020, 10:35 pm

Why are they so coy with their maths?
 
User avatar
trackstar
Posts: 3420
Joined: January 1st, 1970, 12:00 am

Re: Models for Covid-19

March 26th, 2020, 10:42 pm

Why are they so coy with their maths?
for the same reason that men are so coy with their XX,000 lines of code or their gigantic C and Fortran libraries from ancient times.

They need someone else to come in and tidy things up a bit?
 
User avatar
Cuchulainn
Topic Author
Posts: 20256
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Models for Covid-19

March 27th, 2020, 12:01 am

Why are they so coy with their maths?
Anyone remember Edward Woodward?

www.youtube.com/watch?v=Mpab1jO4DoI

 "Adding manpower to a late software project makes it later." Fred Brooks
You only need 2-3 key people for any software project.
Last edited by Cuchulainn on March 27th, 2020, 12:13 am, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20256
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: Models for Covid-19

March 27th, 2020, 12:07 am

Why are they so coy with their maths?
for the same reason that men are so coy with their XX,000 lines of code or their gigantic C and Fortran libraries from ancient times.

They need someone else to come in and tidy things up a bit?
Clean the decks, actually. I agree with the legendary Fred Brooks (father of IBM 360, before everyone's here time, lol). 
Start again!
https://en.wikipedia.org/wiki/Fred_Brooks

Image
 
User avatar
trackstar
Posts: 3420
Joined: January 1st, 1970, 12:00 am

Re: Models for Covid-19

March 27th, 2020, 12:15 am


Clean the decks, actually. I agree with the legendary Fred Brooks (father of IBM 360, before everyone's here time, lol). 
Start again!
Well, time is circular, is it not?
One more picture, for the road - patron saints of code
Enjoy your weekend!
 
User avatar
katastrofa
Posts: 7440
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 27th, 2020, 12:32 am

Quick implementation of SEIHR in Python (no differentiation between households and other yet):
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt

N = 6.6e6 #population size
N_INFECTED = N/1e3

def covid19(x,t):
    
    a1 = 0.1/14*100 #probability of contracting from infected (10% risk of infection if in contact for 14 days, 100 contacts within this period)
    a2 = a1/10 #probability of contracting from presymptomatic (during virus incubation period)
    d = 1/21 #rate of recovery from infection without hospitalisation (average recovery in 2.5 weeks)
    e = 1/35 #rate of complete recovery at hospital
    f = e*0.16 #rate of death at hospital (only hospitalised die in this model)
    g = d*0.2 #rate of intected degrading to critical cases requiring hospitalisation (20% requires hospitalisation)
    k = 1/4 #rate of developing infection, where the average incubation time is 1/k
    
    S = x[0]
    E = x[1]
    I = x[2]
    H = x[3]
    R = x[4]
    
    
    dSdt = -a1/N*S*I - a2/N*S*E #susceptible stock
    dEdt = a1/N*S*I + a2/N*S*E - k*E #exposed stock
    dIdt = k*E - g*I - d*I #infected stock
    dHdt = g*I - e*H - f*H #hospitalised stock
    dRdt = d*I + e*H #recovered stock

    return [dSdt,dEdt,dIdt,dHdt,dRdt]

x0 = [N-3*N_INFECTED,N_INFECTED,N_INFECTED,N_INFECTED,0]
t0 = 0
t1 = 180
dt = 0.01
t = np.linspace(t0,t1,int((t1-t0)/dt))

x = odeint(covid19,x0,t)

S = x[:,0]
E = x[:,1]
I = x[:,2]
H = x[:,3]
R = x[:,4]
D = N-(S+E+I+R+H)

plt.figure(figsize = (10,10))

plt.plot(t,S,label='Susceptible')
plt.plot(t,E,label='Exposed')
plt.plot(t,I,label='Infected')
plt.plot(t,R,label='Recovered')
plt.plot(t,H,label='Hospitalised')
plt.plot(t,D, label='Deceased')
plt.legend()

plt.figure(figsize = (10,10))

plt.plot(t,D/(R+D),label='Fatality rate')
 
User avatar
Paul
Posts: 6604
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 27th, 2020, 12:40 am

Your parameters are realistic?

You can make f a function of H easily, no?

If you don't want to do many households just do two: One group with infected, one group with no one infected.
 
User avatar
katastrofa
Posts: 7440
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 27th, 2020, 12:53 am

I tried to use realistic parameters based on available data and medical reports that I read daily, but I didn't research it thoroughly - they might have changed. That's why I plan to put the model in an optimiser to fit the params to data trends. First I want to remove some unrealistic assumptions of SIR models though.
 
User avatar
katastrofa
Posts: 7440
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 27th, 2020, 12:59 am

"You can make f a function of H easily, no?"

Good point.
    S = x[0]
    E = x[1]
    I = x[2]
    H = x[3]
    R = x[4]
    
    a1 = 0.1/14*100 #probability of contracting from infected (10% risk of infection if in contact for 14 days, 100 contacts within this period)
    a2 = a1/10 #probability of contracting from presymptomatic (during virus incubation period)
    d = 1/21 #rate of recovery from infection without hospitalisation (average recovery in 2.5 weeks)
    e = 1/35 #rate of complete recovery at hospital
    if H < 20000:
        f = e*0.16 #rate of death at hospital (only hospitalised die in this model)
    else: #overstretched hospitals
        f = 3*e*0.16
    g = d*0.2 #rate of intected degrading to critical cases requiring hospitalisation (20% requires hospitalisation)
    k = 1/4 #rate of developing infection, where the average incubation time is 1/k    

#the rest of the previous code