Code to compute basis reproductive number R0 for Covid-19

If you are seeking RATS code for implementing a particular technique or replicating results from a paper, post your request here. Be sure to include complete citations for any papers or books.

Code to compute basis reproductive number R0 for Covid-19

Unread postby Gilbril » Fri Apr 24, 2020 8:21 am

Dear Tom, originally I am economist specialised in forecasting, but in the current environment a valid estimate of the basis reproductive number R0 of the spread of Covid 19 is quite helpful.
Is there any example to compute R0 like in this publication https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(20)30260-9/fulltext
They use a susceptible-exposed-infectious-recovered model and solve it via Gibbs sampling. Any first help would be great.

Thanks in advance

Paul
Gilbril
 
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Re: Code to compute basis reproductive number R0 for Covid-1

Unread postby TomDoan » Fri Apr 24, 2020 10:11 am

I don't know if I'm reading that wrong, but it looks like they are estimating the R0 based upon no observables other than a handful of cases exported outside of China.

That being said, below is the basic SEIR model. Their model augments that with a (time-varying) probability of getting exposed from zoonotic sources, which is where the initial exposure comes from (the program below assumes 1 person starts in the Exposed category) and movement of the infection through travel. The basic SEIR model is non-stochastic---randomness comes into their model as the probability of a traveler to outside China is infected is assumed to follow a Poisson process, whose mean would depend upon the R0 in the infection process.

seirsimulations.rpf
(1.02 KiB) Downloaded 475 times
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm

Re: Code to compute basis reproductive number R0 for Covid-1

Unread postby Gilbril » Wed Apr 29, 2020 7:39 am

Thanks, this is of great help. But the central parameters are set. I am still trying to estimate the parameters necessary to estimate R0 using observed data. Like they do on rt.live
There they even provide forecasts for R0.
Gilbril
 
Posts: 78
Joined: Thu Aug 19, 2010 2:00 pm

Re: Code to compute basis reproductive number R0 for Covid-1

Unread postby TomDoan » Thu Apr 30, 2020 10:06 am

At some point, there needs to be a probability model governed by the parameters. As I said, in the paper cited, that is the rather small (certainly relative to the population of Hubei province) number of repatriated foreigners; the probability of infection is small enough and the number of individuals in the subpopulation also small enough that a Poisson process isn't unreasonable. However, that's a remarkably indirect way to estimate the epidemiological parameters.

In the SEIR model, the R0 is the ratio between beta and gamma. The gamma (certainly) and sigma (probably) are governed by the behavior of the virus and would almost certainly be estimated from observations of individuals. The beta is subject to all kinds of things---for instance, if you have perfect quarantine, it would be zero, as susceptible people would never even come in contact with infected people. I've seen a couple of papers from a few years ago which indicate that there really isn't a good likelihood-based approach to estimating the parameters straight from the (time series) epidemiological data. If you've found a paper which details a way of doing that, I'd certainly be willing to look at it.
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm

Re: Code to compute basis reproductive number R0 for Covid-1

Unread postby TomDoan » Tue Jun 16, 2020 10:59 am

(Data updated on 14 June)

This is a (partially non-linear) dynamic model of COVID infection. Based upon the SEIR model, which has the population partitioned into S (susceptible), E (exposed), I (infectious) and R (recovered, and assumed to be no longer suspectible). The "beta" coefficient which governs how easily the virus spreads is modeled as a random walk, enabling it to adapt.

This uses US data, with the number of new cases used as the observable. Given that new cases are dependent upon the testing regime, which has changed over time, that is probably not ideal, but is offered as a start. (If applied to another country with a wider testing base, it probably would work better).

covidssm2.rpf
Program file
(6.43 KiB) Downloaded 422 times
uscovid.xlsx
Data file
(33.8 KiB) Downloaded 398 times


Last bumped by TomDoan on Tue Jun 16, 2020 10:59 am.
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm


Return to Looking for Code?

Who is online

Users browsing this forum: No registered users and 3 guests

cron