-
-
Notifications
You must be signed in to change notification settings - Fork 986
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
add branching flow example to epidemiology models #2552
Comments
HI @ibulu I agree it would be helpful, and I'd like to have an example. However I haven't been able to figure out how to implement a As a simple example to aid our discussion, consider compartments
Consider four time series over three time steps
At the first time step, the flux is unambiguously A simpler example is an One idea to implement Addresses #2426 |
yeah. I'd be happy to brainstorm together on this. I am available anytime tomorrow from 10:30AM to 4:30PM central time for Zoom call if that works on your end ([email protected]). Main reasons why I'd like to implement branching are:
|
@ibulu I sent an invite for 1pm Central tomorrow. I'd also like to hear more about your models, or read more if you have any preprints. (anyone else, feel free to ping me to attend the meeting) |
Thank you. RSVP'ed and invited few more people on our end. |
Hi @ibulu, I think your SEIRD model is actually easier than the looping models I described (and easier than your SEIRDS model). I believe you can simply define: class SEIRDModel(CompartmentalModel):
def __init__(self, ...):
compartments = ("S", "E", "IR", "ID", "D")
super().__init__(compartments, duration, population)
def compute_flows(self, prev, curr, t):
S2E = prev["S"] - curr["S"]
ID2D = curr["D"] - prev["D"]
E2ID = curr["ID"] - prev["ID"] + ID2D
E2IR = prev["E"] - curr["E"] + S2E - E2ID
IR2R = prev["IR"] - curr["IR"] + E2IR
return {
"S2E_{}".format(t): S2E,
"ID2D_{}".format(t): ID2D,
"E2ID_{}".format(t): E2ID,
"E2IR_{}".format(t): E2IR,
"IR2R_{}".format(t): IR2R,
} Let me know if you need any help getting that working, and I'll try to add an example when I get a chance. |
This is so cool! will combine this with boxcar model! |
It'd be quite helpful to add some examples for more complicated models with complicated flows such as SEIRD or SEIRDS, where, for example, E branches into ID (infectious individuals who'll die) and IR (infectious individuals who'll recover). It's very straightforward to write down the transition() function. However, it is not very obvious to write compute_flows()
The text was updated successfully, but these errors were encountered: