rajeshrinet / pyross

PyRoss: inference, forecasts, and optimised control of epidemiological models in Python. github.com/rajeshrinet/pyross
https://pyross.readthedocs.io
MIT License
169 stars 57 forks source link

Add Contact Matrix and structure age in SEAIRQ Examples and death rate from the disease. #29

Closed Mouvoh closed 4 years ago

Mouvoh commented 4 years ago

Contact structure Hello, for my traineeship I have to use the seairq model. I definitely understood the concept of age structure but I have some problems to catch the syntaxes of how import the data. For example in this SEAIRQ script. What should I do If I want to import the matrix contact ?

Mouvoh commented 4 years ago

Contact structure 2 Contact structure 4 Contact structure 3

In order to improve my comprehension of the script I've been checking the SEIR Indian age structured but these 3 syntaxes are a bit difficult to understand. CH, CW, CS, are contact structure for House Work and school but please what are their values ? How can I modify them ? Also Is_0[4:12]=3; Is_0[3:4]=1 does it mean 3 infected for the age classes numbered 4,5...12 ? At last I do not really understand this syntax below : for i in range(M): IC += data['X'][:,3*M+i]

rajeshrinet commented 4 years ago

@Mouvoh this is a good question. The contact matrices CH, CW, CS and CO have been obtained from a previous work by Prem et al: Projecting social contact matrices in 152 countries using contact surveys and demographic data, Kiesha Prem, Alex R. Cook, Mark Jit, PLOS Computational Biology, (2017)

As far as the code is concerned, you can use any contact matrix which is of the size M x M. In this example the contact matrix passed for the integration is a simple sum,

C = CH+CW+CS+CO.

You could use

C = aH*CH+aW*CW+aS*CS+aO*CO.

Then vary the constants aH, aW, aS, aO...

See also examples in the folder contactMatrix and control at https://github.com/rajeshrinet/pyross/tree/master/examples.

Yes, Is_0[4:12]=3 mean 3 infected for the age classes numbered 4,5...11 at the start of the simulation.

The data for the SEIR model is stored as: first M points is S, then E, then Ia and then Is. So if you want to plot Is, you need to see points starting from 3*M. If you are interested in the net number of infections, then you have to sum it over all M age-groups. This is done by

for i in range(M):
    IC += data['X'][:,3*M+i]

Hope this is helpful.

Mouvoh commented 4 years ago

Thanks, all has been clarified but the first point is still misunderstood. After some research, I found the studies about contact Matrix I guess it has some empiric values. But in the script I see pyross.contactMatrix.(The country)() so where are theses contact matrix in the different folders ? what if I want for example for France which file should I import in the database ?

rajeshrinet commented 4 years ago

@Mouvoh you can now import contacts matrices for France as

import pyross
CH, CW, CS, CO = pyross.contactMatrix.France()     

To do it for some other country:

import pandas as pd
import numpy as np
CW=np.array(pd.read_excel(os.path.join(curDir,'data/contact_matrices_152_countries/MUestimates_work_1.xlsx'), sheet_name='France'))

here curDir is the path of the pyross/examples folder

Mouvoh commented 4 years ago

Thanks a lot

Mouvoh commented 4 years ago

Re Hello, thanks to you I made a lot of things since the beginning. About the covid-cases is there a syntax to import for any countries ? Because I've been on the site worlmeters but the data are not shaped as in the pyross data. Also about CW=np.array(pd.read_excel(os.path.join(curDir,'data/contact_matrices_152_countries/MUestimates_work_1.xlsx'), sheet_name='France')), do I do the same for CH , CS & CO ?

rajeshrinet commented 4 years ago

Yes, you do the same for CH, CS, CO.

Mouvoh commented 4 years ago

Thanks What can I do to obtain covid data cases from a country which is not in the data folder please ?

Mouvoh commented 4 years ago

Capture d’écran de 2020-05-09 12-03-50 image Requirement already satisfied: pytz in /home/kazuki/anaconda3/lib/python3.7/site-packages (2020.1) Please I am now in my pyross environment but havaing an issue with panda. I do not know why there is an error because i installed this module in my pyross environment once this issue raised. I see the issue come from Python 3.8

Mouvoh commented 4 years ago

Solved just put import panda before pyross