Skip to content
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

Implement a simple SEIR model #2446

Merged
merged 11 commits into from
Apr 26, 2020
Merged

Implement a simple SEIR model #2446

merged 11 commits into from
Apr 26, 2020

Conversation

fritzo
Copy link
Member

@fritzo fritzo commented Apr 26, 2020

Addresses #2426

This adds a simple SEIR model with Binomial transitions and likelihoods. I plan to follow this up with an overdispersed SEIR model with BetaBinomial infections, but that will require deeper modifications from the SimpleSIRs model.

@martinjankowiak you should be able to test mixing by adding the -e command line arg e.g.

python examples/contrib/epidemiology/sir.py -e 2 -p 10000 -d 60

Tested

  • added unit tests
  • added cases to test_examples.py
  • ran locally on a largish example

for attempt in range(100):
samples = model.generate({"R0": args.basic_reproduction_number,
"rho": args.response_rate})
obs = samples["obs"][:args.duration]
S2I = samples["S2I"]
new_I = samples.get("S2I", samples.get("E2I"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's going on here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the SIR models, S2I is noisily observed. In SEIR models, E2I is noisily observed. This one-liner works for either model class.

self.data = data

series = ("S2E", "E2I", "I2R", "obs")
full_mass = [("R0", "rho")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be passed through infer like num_quant_bins?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it is already passed like num_quant_bins.

full_mass = options.pop("full_mass", self.full_mass)

This class attribute merely sets the default value.

@martinjankowiak martinjankowiak merged commit 06978ce into dev Apr 26, 2020
@fritzo
Copy link
Member Author

fritzo commented Apr 26, 2020

Thanks for reviewing @martinjankowiak !

@fritzo fritzo deleted the seir branch April 28, 2020 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants