Git Product home page Git Product logo

seir's Introduction

Generalized SEIR Epidemic Model (fitting and computation)

View Generalized SEIR Epidemic Model (fitting and computation) on File Exchange DOI License

Description

A generalized SEIR model with seven states [2] is numerically implemented. The implementation is done from scratch except for the fitting, that relies on the function "lsqcurvfit". Therefore, the present implementation likely differs from the one used in ref.[2].

This Matlab implementation includes also some major differences with respect to ref. [2]. Among them is the expression of the death rate and recovery rate, which are analytical and empirical functions of the time. The idea behind this time-dependency is that the death and recovery rate should converge toward a constant value as the time increases. If the death rate is kept constant, the number of death may be overestimated. Births and natural death are not modelled here. This means that the total population, including the number of deceased cases, is kept constant. Note that ref. [2] is a preprint that is not peer-reviewed and I am not qualified enough to judge the quality of the paper.

Content

The present submission contains:

  • A function SEIQRDP.m that is used to simulate the time histories of the infectious, recovered and dead cases (among others)

  • A function fit_SEIQRDP.m that estimates the ten parameters used in SEIQRDP.m in the least square sense.

  • One example file Documentation.mlx, which presents the numerical implementation.

  • One example file Example_province_region.mlx, which uses data collected by the Johns Hopkins University for the COVID-19 epidemy [3] for Hubei province (China).

  • One example file Example_Country.mlx, which uses data collected by the Johns Hopkins University for the COVID-19 epidemy [3] for a coutnry.

  • One file "ItalianRegions.mlx" written by Matteo Secli (https://github.com/matteosecli) that I have modified for a slightly more robust fitting.

  • One example file ChineseProvinces.mlx, which illustrates how the function fit_SEIQRDP.m is used in a for loop to be fitted to the data [3] from the different Chinese provinces.

  • One example "uncertaintiesIssues.mlx", which illustrates the danger of fitting limited data sets.

  • One example "Example_US_cities.mlx" that illustrates the fitting when "recovered" data are not available.

  • One example simulateMultipleWaves,mlx that illustrates the fitting for multiple epidemic waves.

  • One function getDataCOVID, which read from [3] the data collected by Johns Hopkins University.

  • One function getDataCOVID_ITA written by Matteo Secli (https://github.com/matteosecli), that collects the updated data of the COVID-19 pandemic in Italy from the Italian government [4]

  • One function getDataCOVID_US that collects the updated data in the USA from [3]

  • One function checkRates.m that plots the fitted and computed death and recovery rates (quality check)

  • One function getMultipleWaves.m that simulate and fit the SEIRQDP model to the situations where multiple epidemic waves are detected.

Any question, comment or suggestion is welcome.

References

[1] https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#Bio-mathematical_deterministic_treatment_of_the_SIR_model

[2] Peng, L., Yang, W., Zhang, D., Zhuge, C., & Hong, L. (2020). Epidemic analysis of COVID-19 in China by dynamical modeling. arXiv preprint arXiv:2002.06563.

[3] https://github.com/CSSEGISandData/COVID-19

[4] https://github.com/pcm-dpc/COVID-19

Example 1 (case of COVID-19 in Italy)

The fitting of the extended SEIR model to real data provides the following results:

Active, recoverd and deceased cases in italy

Example 2 (case of COVID-19 in Hubei)

The fitting of the extended SEIR model to real data provides the following results:

Active, recoverd and deceased cases in Hubei

Example 3 (case of multiple waves)

The fitting of the extended SEIR model to real data provides the following results:

Active, recoverd and deceased cases for multiple waves

seir's People

Contributors

echeynet avatar matteosecli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seir's Issues

Multiple waves - a bit of explanation

Hello there,

Can you please document the multiple waves example a bit better?

  • If I understand correctly, you separate the two waves to two problems, and each of them is fit separately?

Error using griddedInterpolant Interpolation requires at least two sample points in each dimension.

First of all, great work @ECheynet thank you.

I'm trying to test your fitting/simulation on data concerning the Slovak infection. We have 0 recovered, and 0 deaths at the moment, and I'm getting the error message

Error using griddedInterpolant
Interpolation requires at least two sample points in
each dimension.

I'm guessing I have no data other than Suspectibles, therefore the fit is logically impossible and have to wait for more data?

trying the script

Hello,
Very interesting model and matlab codes. I have to tried to use it for Italy, France and other countries today but it is not so accurate than your examples. Do I need to change some parameters ?
(I have used the example3 with modifying country)
Thanks in advance and congratulations for your job

ERROR: opts = delimitedTextImportOptions

Hi, Thanks for your nice code
they are amazing, I have a problem with getDatacovid.me
error in this line : opts = delimitedTextImportOptions("NumVariables", Ndays+5);

your mlx file is working but when I wanna run it in m file, the error comes.

can you please help me, I wanna change the model to SEIRD model

Timestep in fit_SEIQRDP

Hi Etienne,

First of all, congratulations for your work.

I would like to suggest that the timestep in fit_SEIQRDP() could be 1/24 instead of 1/10.

p.addOptional('dt', 1/24); % time step for the fitting

Same for forecasting.

This way the function will be fitting every hour and time vector will look for readable for humans.

Kind regards.

Time error

Error using datetime (line 640)
Could not recognize the date/time format of '09-May-2020'. You can specify a format using the 'InputFormat' parameter. If the date/time text contains day, month, or time zone names in a language foreign to the 'zh_CN' locale, those might not be recognized. You can specify a different locale using the 'Locale' parameter.
Error in getDataCOVID (line 47)
time = datetime(2020,01,22):days(1):datetime(datestr(floor(datenum(now))))-datenum(1);

US States

Fantastic code. Unfortunately I'm a rookie and need help modeling US states. The granularity is not available (from what i can tell) in the time series data but there is data in the daily reports. What adjustments do I need to make to the code to model Illinois (US state), for example?

Slovakia: Small number of cases = bad fit?

Hello there @ECheynet ! Thank you for sharing your wonderful repo.

I've been trying to fit your model to the data for Slovakia, where, thanks to the fast and aggressive action, there is a little number of confirmed cases. Right now, there are <500 confirmed infections, 0 deaths, but statistics only show 8 recoveries.

I had no luck trying to find a reasonable fit, I was even spending some time to play around with the initial guesses. Do you think the low number of cases and no data in the "death" set could be the reason for this bad fit? Do you have any suggestions on how to improve this?

I've packed my data and script in a zip too:
SK-COVID-19.ZIP

Here is the fit quality (with data) I get:
image
Recoveries are a good fit, but infections are not even close.

Time dependent recovery and death rate

Dear @ECheynet

Again, not really an issue, more of a discussion.

Are the time-dependent recovery and death rate functions purely your creations, or have you run into something like that in other papers as well? They do make sense as far as your elaborations go, I'm just wondering if these approximations are accepted in literature (not an epidemiologist myself, so have no idea)?

I decided to re-do the model you are using, and I left the time dependent death rate to approach the "dogmatic" SEIR structure a bit more. However, I find that your recovery rate produces more stable fits - which could be (partly) explained by the additional parameter. However, when the "original" model by Peng. et. al. fits, it produces very same results - but it elongates the infectious curve after the peak much more than when using your idea w/ the time dependent recovery rate. Have you compared the two model versions? How does this idea fare with countries on the "other side" of the active infection curve?

Data quality

Not really the issue of this repo, just wanted to show you @ECheynet how the data from Johns Hopkins can be a little unreliable and funky, especially in the early stages of the infections as here for Slovakia:
image

(Feel free to close the issue.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.