SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
katastrofa
Posts: 8982
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 27th, 2020, 1:30 am

BTW, in one of my projects last year I used the Bayesian optimisation to find parameters of a model of a computer virus in the computer network. The model was a realistic microsimulation of the country internet infrastructure, including behavioural data on different users' behaviours, and the virus itself had a complex dynamical evolution and behaviour. It worked and we got sensible results.
IMHO, that's what should be done for the UK now. I can't understand why their boffins haven't done it. It's not something difficult.
 
User avatar
Paul
Posts: 10505
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 27th, 2020, 4:40 am

kat and Cuch, try and do the multiple-households version with leaky quarantine. And randomize the initial conditions for each household. Since the problem is nonlinear there is going to be a Jensen's-Inequality effect. It might be that this makes things worse. (All households having four people versus half being two and half being six, combined with the exponential growth.) That would be important because then we'd be able to say something like a chain is only as strong as its weakest link. And would back up limiting group sizes (two rather than 10!).
 
User avatar
katastrofa
Posts: 8982
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 27th, 2020, 12:48 pm

Doesn't the household effect amount to introducing a multiplicating constant equal to a typical hh size in the first equation?
 
User avatar
Paul
Posts: 10505
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 27th, 2020, 4:09 pm

If you set to zero all parameters responsible for recovery then without quarantine you can get the whole population infected from a single case. With quarantine only that household gets infected. So no, it's not just a parameter change. Or rather it's not a parameter change in that limiting case. It might be a parameter change for tiny leakage. But playing around with the equations suggests it might be quite subtle how that works. 

I haven't looked exhaustively at the literature. But I've only seen papers with two states (quarantine and not). Not with many households. And they tend to have a lot more parameters than ours. I think our leaky quarantine+hospital overload model hits the sweet spot of modelling. 

If someone in a household has it then everyone will get it. So it's a timescale thing for whether they pass it on outside the household, they recover or they go to hospital. 
 
User avatar
Paul
Posts: 10505
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 27th, 2020, 9:59 pm

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.
I like the SIREHD... models for the population and for hospital overload, but not for quarantine effects. 
 
User avatar
Paul
Posts: 10505
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 27th, 2020, 10:02 pm

BTW, in one of my projects last year I used the Bayesian optimisation to find parameters of a model of a computer virus in the computer network. The model was a realistic microsimulation of the country internet infrastructure, including behavioural data on different users' behaviours, and the virus itself had a complex dynamical evolution and behaviour. It worked and we got sensible results.
IMHO, that's what should be done for the UK now. I can't understand why their boffins haven't done it. It's not something difficult.
Can you adapt it to the current situation? I've seen some cellular automata models used to explain what is going on, but I don't think I've seen any with realistic modelling behind them. They are just demos.
 
User avatar
Alan
Posts: 10062
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

Re: Models for Covid-19

March 27th, 2020, 11:35 pm

If you set to zero all parameters responsible for recovery then without quarantine you can get the whole population infected from a single case. With quarantine only that household gets infected. So no, it's not just a parameter change. Or rather it's not a parameter change in that limiting case. It might be a parameter change for tiny leakage. But playing around with the equations suggests it might be quite subtle how that works. 

I haven't looked exhaustively at the literature. But I've only seen papers with two states (quarantine and not). Not with many households. And they tend to have a lot more parameters than ours. I think our leaky quarantine+hospital overload model hits the sweet spot of modelling. 

If someone in a household has it then everyone will get it. So it's a timescale thing for whether they pass it on outside the household, they recover or they go to hospital. 
A basic question about these types of models. If you start with a situation like today (the virus is widespread), then do the models say everyone gets infected eventually if they don't die of something else first, and don't stay quarantined forever? (I assume the absence of a vaccine).
 
User avatar
katastrofa
Posts: 8982
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 27th, 2020, 11:58 pm

If you set to zero all parameters responsible for recovery then without quarantine you can get the whole population infected from a single case. With quarantine only that household gets infected. So no, it's not just a parameter change. Or rather it's not a parameter change in that limiting case. It might be a parameter change for tiny leakage. But playing around with the equations suggests it might be quite subtle how that works. 

I haven't looked exhaustively at the literature. But I've only seen papers with two states (quarantine and not). Not with many households. And they tend to have a lot more parameters than ours. I think our leaky quarantine+hospital overload model hits the sweet spot of modelling. 

If someone in a household has it then everyone will get it. So it's a timescale thing for whether they pass it on outside the household, they recover or they go to hospital. 
Those non-linearities, individual cases, and other subtleties... You're starting to see why microstructure dynamics are the only way to model such problems.

Health Survey for England has data on households (afair), Censuses have detailed sex and age statistics, Passenger Surveys have international migration. Combining these data may be difficult, but it's possible. You can re-create the whole British population with simple life histories on your computer (I did it a couple of years ago). They have hordes of experts and uni people who should be able to do this too. Maybe they already have.
 
User avatar
Cuchulainn
Topic Author
Posts: 61609
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Models for Covid-19

March 28th, 2020, 12:08 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')
You are extending the requirements before Paul' SIRHD model tests have been posted (by me). It's becoming a moving target?
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
 
User avatar
katastrofa
Posts: 8982
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 28th, 2020, 12:19 am

You can ignore my posts if you find them problematic.
 
User avatar
Paul
Posts: 10505
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 28th, 2020, 12:29 am

If you set to zero all parameters responsible for recovery then without quarantine you can get the whole population infected from a single case. With quarantine only that household gets infected. So no, it's not just a parameter change. Or rather it's not a parameter change in that limiting case. It might be a parameter change for tiny leakage. But playing around with the equations suggests it might be quite subtle how that works. 

I haven't looked exhaustively at the literature. But I've only seen papers with two states (quarantine and not). Not with many households. And they tend to have a lot more parameters than ours. I think our leaky quarantine+hospital overload model hits the sweet spot of modelling. 

If someone in a household has it then everyone will get it. So it's a timescale thing for whether they pass it on outside the household, they recover or they go to hospital. 
A basic question about these types of models. If you start with a situation like today (the virus is widespread), then do the models say everyone gets infected eventually if they don't die of something else first, and don't stay quarantined forever? (I assume the absence of a vaccine).
I don't think so.
 
User avatar
Paul
Posts: 10505
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 28th, 2020, 12:32 am

If you set to zero all parameters responsible for recovery then without quarantine you can get the whole population infected from a single case. With quarantine only that household gets infected. So no, it's not just a parameter change. Or rather it's not a parameter change in that limiting case. It might be a parameter change for tiny leakage. But playing around with the equations suggests it might be quite subtle how that works. 

I haven't looked exhaustively at the literature. But I've only seen papers with two states (quarantine and not). Not with many households. And they tend to have a lot more parameters than ours. I think our leaky quarantine+hospital overload model hits the sweet spot of modelling. 

If someone in a household has it then everyone will get it. So it's a timescale thing for whether they pass it on outside the household, they recover or they go to hospital. 
Those non-linearities, individual cases, and other subtleties... You're starting to see why microstructure dynamics are the only way to model such problems.

Health Survey for England has data on households (afair), Censuses have detailed sex and age statistics, Passenger Surveys have international migration. Combining these data may be difficult, but it's possible. You can re-create the whole British population with simple life histories on your computer (I did it a couple of years ago). They have hordes of experts and uni people who should be able to do this too. Maybe they already have.
Yes and no! I can see pros and cons of the micro stuff. A con is that we haven't got much clue as to how people respond to being in lockdown. 
 
User avatar
katastrofa
Posts: 8982
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Models for Covid-19

March 28th, 2020, 12:36 am

Exactly! That's on what I'm starting to work now! Namely, how people respond to a new situation. The tendencies can be figured out based on past data and studies.
 
User avatar
Paul
Posts: 10505
Joined: July 20th, 2001, 3:28 pm

Re: Models for Covid-19

March 28th, 2020, 12:43 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')
You are extending the requirements before Paul' SIRHD model tests have been posted (by me). It's becoming a moving target?
I am still looking forward to your numbers and plots!!! (I almost said "with bated breath" but that would be in poor taste!)
 
User avatar
Cuchulainn
Topic Author
Posts: 61609
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Models for Covid-19

March 28th, 2020, 10:39 am

You can ignore my posts if you find them problematic.
Kind of. I call it requirements drift. Or do want to change  Paul's initial SIRHD requirements in mid-stream?

I recommend your first writing the analytic ODE on the COVID-19 analytic thread and then jump into code.

But I do like SEIRHD.. I can easily add it  to my design.
Last edited by Cuchulainn on March 28th, 2020, 11:34 am, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself
Jean Piaget
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On