Skip to content

Commit 6bccf43

Browse files
sbfnk-botsbfnk
andauthored
Stop spurious NA R-hat warnings from estimate_secondary (#1516)
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
1 parent f519ad3 commit 6bccf43

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- A bug was fixed where disabling the weekly reporting effect produced a spurious convergence warning from a degenerate day-of-week simplex.
1616
- A bug was fixed where `estimate_infections()` could emit a spurious "the largest R-hat is NA" convergence warning caused by deterministic delay PMFs being monitored; these are no longer monitored.
17+
- A bug was fixed where `estimate_secondary()` emitted the same spurious "the largest R-hat is NA" convergence warning from a deterministic delay PMF being monitored; it is no longer monitored.
1718
- A bug was fixed where `get_predictions()` on an `estimate_truncation()` result assigned reconstructed observations to the wrong datasets and dates.
1819
- A bug was fixed where the prior on the initial reproduction number was applied with an incorrect Jacobian, shifting it upwards by a factor of `exp(sdlog^2)`. A `LogNormal(mean = 2, sd = 1)` prior was applied as though it had a mean of 2.5.
1920
- A bug was fixed where the mean reproduction number over the observation window was left uninitialised, so chains started from a value drawn across the whole of `exp(-2)` to `exp(2)` rather than from the user's Rt prior.

R/create.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,11 @@ create_stan_args <- function(stan = stan_opts(),
727727
if (!fixed_param && inherits(stan_args$object, "stanmodel") &&
728728
is.null(stan_args$pars)) {
729729
exclude <- character(0)
730+
if (model %in% c("estimate_infections", "estimate_secondary")) {
731+
exclude <- c(exclude, "delay_np_pmf_use")
732+
}
730733
if (identical(model, "estimate_infections")) {
731-
exclude <- c(exclude, "delay_np_pmf_use", "gt_rev_pmf")
734+
exclude <- c(exclude, "gt_rev_pmf")
732735
}
733736
if (isTRUE(data$week_effect == 1)) {
734737
exclude <- c(exclude, "day_of_week_simplex")

vignettes/prior_choice_guide.Rmd.orig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ delay <- example_incubation_period + reporting_delay
8383
# Fast Stan settings for vignette building
8484
# (Use default settings for actual analyses)
8585
stan <- stan_opts(
86-
samples = 100,
87-
warmup = 100,
86+
samples = 500,
87+
warmup = 250,
8888
chains = 2,
8989
control = list(adapt_delta = 0.9)
9090
)

0 commit comments

Comments
 (0)