Skip to content

Clean up estimate_secondary ESS warnings in the prior choice guide and deduplicate per-chain fit warnings - #1518

Merged
sbfnk merged 2 commits into
mainfrom
fix-secondary-ess
Sep 2, 2026
Merged

Clean up estimate_secondary ESS warnings in the prior choice guide and deduplicate per-chain fit warnings#1518
sbfnk merged 2 commits into
mainfrom
fix-secondary-ess

Conversation

@sbfnk-bot

Copy link
Copy Markdown
Collaborator

Description

Two small, related fixes for noisy diagnostics when fitting the auxiliary models.

Vignette — estimate_secondary() low tail-ESS. After the earlier warmup/sample bump, the prior choice guide render still showed low tail effective-sample-size warnings for estimate_secondary(). Reproducing the fit locally, bulk ESS already cleared at the fast settings (500 samples / 250 warmup) but tail ESS did not (min ESS ~384, just under the ~400 threshold). Giving the two estimate_secondary() examples a dedicated stan_secondary object (1000 samples / 500 warmup) clears it with comfortable margin (min ESS ~726, max R-hat 1.004). The change is scoped to the estimate_secondary() examples so the other models' rendered output is unaffected.

Logging — duplicated per-chain warnings. In the non-future fitting path, estimate_secondary() and estimate_truncation() fit all chains in one rstan::sampling() call, but the caught-warning handler in R/fit.R formatted each pooled warning with the whole chain vector, so sprintf recycled it and every message printed once per chain ((chain: 1), (chain: 2), ...). Collapsing the chain vector with toString() prints each pooled warning once as (chain: 1, 2). The future path (scalar chain id per call) is unchanged.

There is no dedicated issue for these; estimate_truncation()'s remaining ESS/divergence warnings are tracked separately.

Initial submission checklist

  • My PR is based on a package issue and I have explicitly linked it. (no dedicated issue)
  • I have tested my changes locally.
  • I have added or updated unit tests where necessary. (behaviour is stochastic sampler logging; verified manually)
  • I have updated the documentation if required.
  • I have followed the established coding standards (checked with lintr).
  • I have added a news item.

Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
@sbfnk-bot
sbfnk-bot requested a review from sbfnk September 2, 2026 11:53
@sbfnk
sbfnk marked this pull request as ready for review September 2, 2026 15:35
@sbfnk

sbfnk commented Sep 2, 2026

Copy link
Copy Markdown
Member

merging as docs only

@sbfnk
sbfnk merged commit 988fea6 into main Sep 2, 2026
13 checks passed
@sbfnk
sbfnk deleted the fix-secondary-ess branch September 2, 2026 15:36
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.

2 participants