Stop spurious NA R-hat warnings from estimate_secondary - #1516
Merged
Conversation
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
sbfnk
approved these changes
Sep 1, 2026
sbfnk
approved these changes
Sep 1, 2026
sbfnk
marked this pull request as ready for review
September 1, 2026 10:12
Member
|
merging as minimal change to output |
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.
Description
This PR closes #1497.
The remaining case of that issue was
estimate_secondary(), which still emitted the spuriousThe largest R-hat is NA, indicating chains have not mixed.warning (plus the accompanying near-zero-ESS warnings) for both chains.estimate_infections()(#1499) andestimate_truncation()(#1501) were already handled; secondary was never covered because the monitoring-exclusion increate_stan_args()was gated onidentical(model, "estimate_infections").Reproducing
fit_secondary_fixedfrom the prior choice guide, the only parameters withNAR-hat aredelay_np_pmf_use[1..31], the structurally-constant nonparametric delay PMF, which is the same quantity already excluded forestimate_infections. Every real parameter is well converged. This PR extends the exclusion toestimate_secondaryso that quantity is no longer monitored, which removes the spuriousNAR-hat (verified: 0NA-R-hat parameters afterwards).It also bumps the prior choice guide's MCMC settings from
samples = 100, warmup = 100tosamples = 500, warmup = 250. At 100 samples the genuine Bulk/Tail ESS warnings appear across the guide's fits simply because 100 post-warmup draws is too few (forestimate_secondary, 54 to 85 of 115 real parameters fell below an ESS of 100). At500/250those fits converge cleanly (0 real parameters below ESS 100, max R-hat 1.01) at roughly 8 s per secondary fit. The bakedprior_choice_guide.Rmdis regenerated by therender-prior_choice_guide.yamlworkflow, which fires on push tomainwhen the.origchanges, so it is not committed here.Initial submission checklist