Plot the forecast reproduction number over the forecast horizon - #639
Merged
Conversation
The forecast model computed the reproduction number over the forecast horizon (f_R) in generated quantities but only returned the forecast onsets, so gather_draws(R[day]) on the forecast fit stopped at the cutoff and the forecast Rt was never plotted past the vertical line. Output forecast_R from the model and append it to the forecast Rt trajectory so it extends across the forecast horizon. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
seabbs
enabled auto-merge
June 21, 2026 15:33
Contributor
Author
|
Confirming this fixes the docs issue |
sbfnk
approved these changes
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the forecasting concepts session, the plot under "We can now plot the forecast and estimated reproduction numbers" did not show the forecast Rt extending past the cutoff.
Cause: the forecast model (
estimate-inf-and-r-rw-forecast.stan) computes the reproduction number over the forecast horizon (f_R) ingenerated quantities, but only returned the forecast onsets. Sogather_draws(R[day])on the forecast fit only covered days up to the cutoff, and the blue forecast Rt line stopped at the vertical dashed line.Fix:
forecast_R(the reproduction number over the forecast horizon) from the model.extract-Rtchunk (shifted bycutoff) so the forecast extends across the horizon, matching the onset forecast plots.Verified locally: the model compiles, and an end-to-end fit confirms
forecast_Rnow spans the full 28-day horizon (days 72–99) with finite values._freeze/is gitignored so CI renders fresh. The model is only used in this session.🤖 Generated with Claude Code