Skip to content

Plot the forecast reproduction number over the forecast horizon - #639

Merged
seabbs merged 1 commit into
mainfrom
fix/forecast-rt-plot
Jun 21, 2026
Merged

Plot the forecast reproduction number over the forecast horizon#639
seabbs merged 1 commit into
mainfrom
fix/forecast-rt-plot

Conversation

@seabbs

@seabbs seabbs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

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) in generated quantities, but only returned the forecast onsets. So gather_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:

  • Output forecast_R (the reproduction number over the forecast horizon) from the model.
  • Append it to the forecast Rt trajectory in the extract-Rt chunk (shifted by cutoff) 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_R now 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 by an agent; please review.

🤖 Generated with Claude Code

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 seabbs left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LGTM

@seabbs
seabbs requested a review from sbfnk June 21, 2026 15:33
@seabbs
seabbs enabled auto-merge June 21, 2026 15:33
@seabbs

seabbs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Confirming this fixes the docs issue

@seabbs
seabbs added this pull request to the merge queue Jun 21, 2026
Merged via the queue into main with commit ff9ac41 Jun 21, 2026
8 checks passed
@seabbs
seabbs deleted the fix/forecast-rt-plot branch June 21, 2026 18:06
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.

3 participants