rajeshrinet / pyross

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

Questions regarding parameters 'fsa' and 'alpha' #15

Closed technOslerphile closed 4 years ago

technOslerphile commented 4 years ago

Hello,

I was trying to simulate age-structured SIR model by tweaking the alpha (proportion of asymptomatic individuals) and fsa (fraction/weight of the contact matrix of the symptomatics as compared to asymptomatics). In my model, I set both these to 0.5. This means that the contact matrix of the symptomatics will be half that of asymptomatics which is in line with the fact that symptomatics tend to remain in quarantine or isolation and hence their contacts is less.

Questions:-

  1. Why the beta (probability of infection on contact) decreases with increasing fsa? I thought it should be the other way around. More fsa means, symptomatics contact is more and hence beta should be more. The default fsa of 1 means that symptomatics remain in contact with each other just like the way asymptomatics are. This should increase beta, right? But it seems the other way around. Maybe I am missing something.

  2. Why beta decreases with increasing alpha? More alpha means you have more asymtomatics running around contacting people at will. So, intuitivel beta should increase. But it decreases with increasing alpha. Now I can think of another scenario. More alpha means more asymtomatics. And on an average the one-to-one transmission capability of an asymptomatic person to another person is supposedly lesser than that of a symptomatic person given that there is a contact with a susceptible person. If this is the case, then perhaps a decrease in beta with increase in alpha is understandable. Can you please throw some light on this?

  3. In the 'Infected Cases (IC)' vs 'Time' plot, does the IC takes into account the number of asymptomatic cases also if alpha is set to something less than 1? Or does it only include cases that are symptomatic?

I will have many more questions in the coming few days, please do bear with me :-)

rajeshrinet commented 4 years ago

@technOslerphile I am replying with the assumption that you are using https://github.com/rajeshrinet/pyross/blob/master/examples/deterministic/fitParamBeta.ipynb to compute beta given the data, i.e., how can you get a given number of infected people as you vary all the other parameters.

  1. As you increase fsa, more and more people are coming in contact. So even at a lower level of probability of infection on contact (beta), you get the same number of infected individuals.

  2. As you increase alpha, you have effectively more infected individuals. This again means that to get a fixed number of individuals, a lower beta will be needed.

  3. IC, as it was defined earlier, was only Is (symptomatic individuals). To get both Is and Ia, please use the updated code.

technOslerphile commented 4 years ago

Thank you very much. I guess my concept of beta was different. Yes, I am referring to the fitParamBeta notebook for the first 2 questions. I got clarifications now for questions 1 and 2.

3. IC, as it was defined earlier, was only Is (symptomatic individuals). To get both Is and Ia, please use the updated code.

Here, I was referring to the plot in: https://github.com/rajeshrinet/pyross/blob/master/examples/deterministic/ex3-age-structured-SIR-for-India.ipynb

plot

Does the Y-axis here will reflect both asymptomatic as well as symptomatic cases OR only the symptomatic cases?

This is what it is there now in the ex3-age-structured-SIR-for-India notebook

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

I presume this would change (as per your modified fitParamBeta notebook) to:

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

And the above IC will have both asymptomatic as well as symptomatic counts.

rajeshrinet commented 4 years ago

@technOslerphile, yes, you are right. I have only been accounting for symptomatic cases in the example notebook.

technOslerphile commented 4 years ago

Thanks!

technOslerphile commented 4 years ago

download Getting more or less same results with a different beta, alpha =0.5 and fas = 0.5. I was expecting the second wave to start sooner. Any thoughts? Attached is the HTML version of the executed notebook. Note that I ran only till 'One Closure'

ex4-age-structured-SIR-india-with-interventions.zip

rajeshrinet commented 4 years ago

@technOslerphile please can you try fitting the data of infected people to only symptomatic cases, Is?

I think if you fit it to both Is and Ia with a reduced beta, then it essentially the same as only Is at a higher value of beta.

technOslerphile commented 4 years ago

@technOslerphile please can you try fitting the data of infected people to only symptomatic cases, Is?

I think if you fit it to both Is and Ia with a reduced beta, then it essentially the same as only Is at a higher value of beta.

Fitting the data of infected people to only symptomatic cases is what is already there by default and that is what is in your paper, right? What I am trying to do is to set alpha and fsa both to 0.5 and get the best fit beta. After this, with the new beta, I simulate the age-structured SIR model and in here also alpha and fsa is set to 0.5 because this is what I am interested in. This resulted in more or less same result as what is already there in your paper where alpha is 0 and fsa is 1.

The input data contains only symptomatic cases till March 25th. I don't think I will need to double the case numbers in this file because my assumption is that half of the cases are asymptomatic. I am assuming this will be taken care of in the simulation itself and we don't have to explicitly put the numbers of asymptomatic cases also in the input data. Correct?

For example, the last three rows of the current case data for India is like this:

53  37  2020-03-23     434
54  50  2020-03-24     519
55  55  2020-03-25     606

Now, if I assume my alpha is 0.5 (and not 0 which is the value by default) and this means my actual number of cases corresponding to the table above would be (forget the first column):

53  37  2020-03-23     868
54  50  2020-03-24     1039
55  55  2020-03-25     1212

My assumption, as I mentioned before, is that I do not have to change my input data depending on my alpha because it should be taken care of in the model itself during simulation. Correct?

rajeshrinet commented 4 years ago

@technOslerphile I see your point. Here is what I would do.

Fit only symptomatic cases as this is what we know from data available. And then from this Is, I will obtain Ia. Does this make sense?

It seems we are saying similar things. But I do not understand why do double the last row in the data file.

technOslerphile commented 4 years ago

@technOslerphile I see your point. Here is what I would do.

Fit only symptomatic cases as this is what we know from data available. And then from this Is, I will obtain Ia. Does this make sense?

It seems we are saying similar things. But I do not understand why do double the last row in the data file.

Yes, that is what I was doing (fit only symptomatic cases and from this I can easily obtain Ia from Is).

Doubling the counts of cases in the last row is NOT something that I'd done. I just wanted to verify whether the input data needs to be altered based on alpha. My assumption is that we should not be doing that because the model takes care of the alpha parameter to estimate asymptomatic cases. I think you are also saying the same.

rajeshrinet commented 4 years ago

@technOslerphile please also note that in the ex4 I only plot Is since Ia is zero for me. But you need to plot a sum of these.

In my notation for SIR, the first M points are S, then Ia, then Is. So if you plot S, you will see it is different from the example with alpha=0. Please can check this? Thanks

technOslerphile commented 4 years ago

@technOslerphile please also note that in the ex4 I only plot Is since Ia is zero for me. But you need to plot a sum of these.

In my notation for SIR, the first M points are S, then Ia, then Is. So if you plot S, you will see it is different from the example with alpha=0. Please can check this? Thanks

With the new computation of IC in SIR model (code below), I presume the variable 'IC' is already containing Is + Ia. Also, I have changed the Ia cases at start from 0 to same numbers as that of Is because my assumption is that alpha is 0.5

    for i in range(2*M):
        IC += data['X'][:,M+i] 
# initial conditions    
Is_0 = np.zeros((M));  Is_0[6:13]=3;  Is_0[2:6]=1
Ia_0 = np.zeros((M)); Ia_0[6:13]=3; Ia_0[2:6]=1
R_0  = np.zeros((M))
S_0  = Ni - (Ia_0 + Is_0 + R_0)

With this, I fitted new beta and then ran both SIR (ex4) and SEIR (ex8) models. I get more or less similar results on a high level as compared to the SIR and SEIR results when alpha is 0 although the number of infected cases is quite higher when alpha is 0.5 (much more higher when alpha is 0.5, but fsa is 1). In the SEIR model, I changed the code like this below to accomodate asymtomatic cases in IC:

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

Please take a look at the executed notebooks. I am attaching the 3 notebooks (fit beta, SIR and SEIR) here. Let me know your thoughts, please.

pyrosstests.zip

One question regarding SIR model plot is that the cases seem to decline IMMEDIATELY when the lockdown starts which is unrealistic from an epidemiological point of view. The same lockdown intervention in SEIR seems to generate a more realistic plot. Any comments on this? SIR_Age_Structured_alpha0fsa1_singleclosure

SEIR

rajeshrinet commented 4 years ago

@technOslerphile quick reply about SEIR: it has an additional exposed class E. For some infections, including COVID-19, there is an incubation period during which individuals have been infected but are not yet infectious. SEIR accounts for this. That is why it seems more 'realistic' than the SIR model. In SEIR, the cases literally have to go from these stages S->E->I->R. Since E->I have a typical N_E-day scale, the infection case will increase in this window. For SIR, there is no such intermediate stage, and thus, the cases start to decline immediately.

technOslerphile commented 4 years ago

@technOslerphile quick reply about SEIR: it has an additional exposed class E. For some infections, including COVID-19, there is an incubation period during which individuals have been infected but are not yet infectious. SEIR accounts for this. That is why it seems more 'realistic' than the SIR model.

Great, that makes sense with respect to the SEIR model. But the SIR model also has a recovery rate for infected people. When the lockdown starts, the infected people will/should not suddenly goes to the 'recovery' compartment all of a sudden. I would assume the curve will go up, albeit slowly, when the lockdown starts, and then see a flattening/decaying. In the graph, it starts the decay right at the point where lockdown starts.

rajeshrinet commented 4 years ago

@technOslerphile this has to do with what is called the basic reproductive ratio R_0. See Eq.7-10 of our paper for more details when computed for SIR.

The main idea is that if R_0 is greater than 1, then I(t) will increase, else it will decrease. When you do an ideal lockdown, you reduce R_0 to less than 1, and that is why I(t) starts decreasing instantaneously in a SIR model. Had there been another way to increase I(t), such as in SEIR, where there is an influx from E to I, there would still be an increase briefly. Hope this helps.

technOslerphile commented 4 years ago

@technOslerphile this has to do with what is called the basic reproductive ratio R_0. See Eq.7-10 of our paper for more details when computed for SIR.

The main idea is that if R_0 is greater than 1, then I(t) will increase, else it will decrease. When you do an ideal lockdown, you reduce R_0 to less than 1, and that is why I(t) starts decreasing instantaneously in a SIR model. Had there been another way to increase I(t), such as in SEIR, where there is an influx from E to I, there would still be an increase briefly. Hope this helps.

Thanks, it makes sense now. The math says it all, I believe. Let's say the rate of change of infected cases is denoted by I'(t) and in SIR this equates to: I'(t) = lambda*I - gamma*I S is the number of susceptible subjects at time 't'. If I has to decrease, then I'(t) has got to be negative and this means that the ratio of lambda to gamma should be less than 1. And this ratio happens to be R nought. And in case of lockdown, as you said, the R nought instantaneously decreases to less than one in an IDEAL lockdown and I'(t) goes negative instantaneously.

rajeshrinet commented 4 years ago

@technOslerphile you have put it quite well.