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 fit in Stan; fully Bayesian (including sigma); different smoothing. #34

Open
wants to merge 48 commits into
base: master
Choose a base branch
from

Conversation

farr
Copy link

@farr farr commented Apr 22, 2020

This may be a work in progress; I'm finding some differences in the analysis between my model and yours (in general, mine prefers larger values of R_t, particularly for the states with small values in your model). I think my model is also more conservative about the range of R_t, probably because I'm marginalizing over sigma, and sigma may not be particularly well determined (so sometimes the "smoothing" from small random increments in the prior for R_t is not as strong as yours).

Nevertheless, the should be safe to merge. Here is what I did:

  • Added a LICENSE (I tried to make clear in the LICENSE file that it does not apply to your notebook file---but if you do want an MIT license, you can eliminate that caveat).
  • Added a conda environment file so that my notebook (and yours!) can be run in a binder instance, or so those following along at home can reconstruct the env.
  • Implemented your model in Stan, including treating sigma as a parameter, so one can marginalize over sigma instead of fitting it in a max-likelihood way as you do.
  • Smoothed a bit more (7-day exponential weighting---equivalent to a low-pass filter with a rolloff at f = 1/(7 day)) because of the weekly variation in testing and the (assumed) one-week serial timescale. This eliminates the "wavy" behavior of R_t in your plots---which is probably spurious (unless you think the current changes on social distancing on weekends---I'm sure there are some---is more important than the weekly variation in testing/data reporting).
  • Made some minor prior choices that are a bit different to yours (I put a---wide---prior on sigma that peaks at 0.3, for example).

I don't have the web skills to make the plots dynamical as your team does; but I did try to reproduce the "feel" of your plots for comparisons. Two key plots appear at the end of the notebook, and are reproduced here:

image

image

@farr
Copy link
Author

farr commented Apr 22, 2020

Oh---one more difference (and this is probably the true source of the larger uncertainty and R_t values). I treat the time series of exponential growth as the mean of a Poisson distribution that describes each day's new cases (this is similar to Bettencourt & Ribeiro (2008), where Delta-T is a stochastic process and the observations are drawn from it, though there is no really good reason to assume that the draw is Poisson, I suppose); but your model uses the prior day's observed case number to predict the next, and only applies the stochastic process in the prior. I can imagine that my approach leads to a lot more uncertainty in the time-series R_t (since it is truly a stochastic process, observed only through the Poisson draws; while you assume that the prior day's observations---which are perfectly known---grow exponentially to produce R_{t+1}).

1. Re-parameterized the model to efficiently fit states like NY where there is
lots of data (i.e. the posterior is likelihood-dominated).  It goes slower on
the low-data states, but with fewer divergences / bad fits overall.

2. More discussion / description of the model *including differences to
rt.live* in notebook, particularly the choice to have expected counts depend on
yesterday's *expected* rather than *observed* counts.

3. Marginalize over the serial interval, based on work from
https://epiforecasts.io/covid/
@farr
Copy link
Author

farr commented Apr 23, 2020

See commit message for major update today; should still be merge-able automatically, but the model has gotten a bit more sophisticated, and there is a lot more explanatory text in the notebook about how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant