tjmckinley / SimBIID

GNU General Public License v3.0
1 stars 1 forks source link

When S is large the codes does not run #9

Closed NedaJalali-codes closed 4 years ago

NedaJalali-codes commented 4 years ago

Hey, I am trying to run a SIR model with initialzing values at iniStates <- c(S = 1000000, I = 1, R = 0). But the codes do can not give the results and the process gets stuck after the following lines: Initial states: state[0] = 1000000 state[1] = 1 state[2] = 0

Initialising system... Initialisation complete!

Initial parameter values:

beta = 3.54364 gamma = 2.1883

Starting runs...

Any idea why it happens?

Best, Neda

NedaJalali-codes commented 4 years ago

Sorry, S is equal to 10,000,000

tjmckinley commented 4 years ago

Hi Neda,

Can you clarify what you are running please? It looks like you're running PMCMC. Is this correct? If so, then with a population size of 10,000,000 the Gillespie simulation algorithm can be very slow. One thing you could do is to change the argument nprintsum in the PMCMC() function so that it prints to the screen more often (try nprintsum = 10 or something to test this out).

If this is too slow, then a package like pomp has a much faster simulation algorithm and will also implement PMCMC.

Many thanks,

TJ

NedaJalali-codes commented 4 years ago

Hi TJ, That is right. I am running PMCMC. Thank you so much for your help.

Best, Neda

tjmckinley commented 4 years ago

Hi Neda,

OK, let me know how it goes with the suggestions above.

Many thanks,

TJ

NedaJalali-codes commented 4 years ago

TJ, I tried "nprintsum = 1" to see how long each iteration takes. It was pretty fast until i = 252 and then after that, running each iteration was slow and it got stuck by i = 380.

Best, Neda

tjmckinley commented 4 years ago

Hi Neda,

I suspect this is caused by the PMCMC getting into a part of the parameter space which results in large numbers of infections. With the Gillespie simulation algorithm this can be very slow. It's not throwing an obvious error.

Do you have a minimal reproducible example to hand?

Many thanks,

TJ

NedaJalali-codes commented 4 years ago

You are right, TJ. It can not handle large number of infections. I tried 10 times with a large number of infections at each time and it was slow.

Thank you for your help. Neda

tjmckinley commented 4 years ago

Hi Neda,

I think it can handle it (i.e. there's no error), it's just rather slow because of the large number of infections in a large background population. You could look at pomp as an alternative, although PMCMC is likely to be slow in any population of that size unless you are restricted to areas of the parameter space that only induce low numbers of infections.

If there's no error, then I'll close the issue.

Good luck.

TJ