-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - Stochastic Logistic Growth (ABC Toy problem) #1025
Conversation
…city birth-only growth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial self-review
Codecov Report
@@ Coverage Diff @@
## master #1025 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 83 84 +1
Lines 8730 8799 +69
=========================================
+ Hits 8730 8799 +69
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jarthur36 Looking good. Thanks. If you look through my and @MichaelClerx 's comments here, and make these few changes, then we can get it merged.
- Can we add a full references to the notebook? I.e. Simpson et al. and Gillespie et al. should be given in full at the bottom of the first block of text.
- Can we add a reference to Radek Erban's book please? This was our main reference for the Gillespie algorithm.
- In the example noetbook, at the moment, we aren't converging on the deterministic mean? Can we either change the text or up the number of particles so that we do?
- We need value-based tests of the stochastic degradation model outputs? @MichaelClerx suggests we do this by seeding the random number generator, which sounds reasonable.
- We need docstrings for the class itself.
Just found out why there was the discrepancy between the deterministic model and the 1000-realisation average. Long in short, it all depends on the choice of parameters (in particular the initial size of the population)! With the parameters that Jack used, the population was small, so each step gave a big variation, so it had a large 'noise'. Although we thought by running more simulations it'd converge to the deterministic solution, it'd not be the case when the initial population size is small (with some quick experiments, seems like n_0 > 10 would be a reasonable size, but needs some proper sensitivity anaylsis to give a better estimate). The reason seems to be that with a small initial population, the big noise at the beginning can drift (or shift?) the whole process (e.g., to delay the growth at a later time), then the 'time point-wise' average from these shifted solutions would give a bias. So a simple fix to that is simply scaling up the whole population which solves the bias seen in the plot above, see below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chonlei -- looks really good. Only a few minor comments then fine to go.
Just wondering -- did you see #1067 ? This was Jack's attempt to create a more generic stochastic simulation approach (basically it should automate the Gillespie algorithm for many types of stochastic reaction equation). I just remembered it, sorry. Do you think merge this then later someone tries to adapt it to fit into such a framework?
Think I would go for merging this first then adapt it to fit into a better framework later, since we've been quite slow on SDE and/or ABC... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chonlei and @jarthur36 !
Two tiny comments now, happy for this to be merged without further review once they're done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chonlei happy for this to go in now (after tests complete). I'm not sure why the "build-and-test" check isn't executing?
@MichaelClerx Any idea why the "build-and-test" thing isn't running? |
I think that's an old test name that no longer exist. Will investigate! |
Adds the spatially implicit birth-only logistic growth model (Simpson et al., 2019) to pints. Simulated using the interpretation of the Gillespie algorithm from (Erban et al., 2007)
This version is work in progress as the empirical mean of n stochastic runs does not converge to the deterministic mean as n->∞ as shown below