Skip to content

Commit 5d17a0f

Browse files
Automatic Vignette update (#1322)
Co-authored-by: sbfnk <1156307+sbfnk@users.noreply.github.com>
1 parent 7282f00 commit 5d17a0f

File tree

3 files changed

+51
-83
lines changed

3 files changed

+51
-83
lines changed
-40 Bytes
Loading
-529 Bytes
Loading

vignettes/prior_choice_guide.Rmd

Lines changed: 51 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -579,18 +579,12 @@ obs_opts(dispersion = Normal(mean = 0, sd = 0.5))
579579
#> - fixed value:
580580
#> 1
581581
#>
582-
#> $accumulate
583-
#> [1] 0
584-
#>
585582
#> $likelihood
586583
#> [1] TRUE
587584
#>
588585
#> $return_likelihood
589586
#> [1] FALSE
590587
#>
591-
#> $na_as_missing_default_used
592-
#> [1] TRUE
593-
#>
594588
#> attr(,"class")
595589
#> [1] "obs_opts" "list"
596590

@@ -619,18 +613,12 @@ obs_opts(family = "poisson") # No dispersion parameter needed
619613
#> - fixed value:
620614
#> 1
621615
#>
622-
#> $accumulate
623-
#> [1] 0
624-
#>
625616
#> $likelihood
626617
#> [1] TRUE
627618
#>
628619
#> $return_likelihood
629620
#> [1] FALSE
630621
#>
631-
#> $na_as_missing_default_used
632-
#> [1] TRUE
633-
#>
634622
#> attr(,"class")
635623
#> [1] "obs_opts" "list"
636624
```
@@ -702,18 +690,12 @@ obs_opts(scale = Normal(mean = 0.2, sd = 0.05, max = 1))
702690
#> sd:
703691
#> 0.05
704692
#>
705-
#> $accumulate
706-
#> [1] 0
707-
#>
708693
#> $likelihood
709694
#> [1] TRUE
710695
#>
711696
#> $return_likelihood
712697
#> [1] FALSE
713698
#>
714-
#> $na_as_missing_default_used
715-
#> [1] TRUE
716-
#>
717699
#> attr(,"class")
718700
#> [1] "obs_opts" "list"
719701

@@ -742,18 +724,12 @@ obs_opts(scale = Fixed(0.3))
742724
#> - fixed value:
743725
#> 0.3
744726
#>
745-
#> $accumulate
746-
#> [1] 0
747-
#>
748727
#> $likelihood
749728
#> [1] TRUE
750729
#>
751730
#> $return_likelihood
752731
#> [1] FALSE
753732
#>
754-
#> $na_as_missing_default_used
755-
#> [1] TRUE
756-
#>
757733
#> attr(,"class")
758734
#> [1] "obs_opts" "list"
759735

@@ -785,18 +761,12 @@ obs_opts(scale = Normal(mean = 0.01, sd = 0.005, max = 1))
785761
#> sd:
786762
#> 0.005
787763
#>
788-
#> $accumulate
789-
#> [1] 0
790-
#>
791764
#> $likelihood
792765
#> [1] TRUE
793766
#>
794767
#> $return_likelihood
795768
#> [1] FALSE
796769
#>
797-
#> $na_as_missing_default_used
798-
#> [1] TRUE
799-
#>
800770
#> attr(,"class")
801771
#> [1] "obs_opts" "list"
802772
```
@@ -986,13 +956,13 @@ trunc_opts(get_parameters(truncation_estimate)[["truncation"]])
986956
#> mean:
987957
#> 0.9
988958
#> sd:
989-
#> 0.006
959+
#> 0.005
990960
#> sdlog:
991961
#> - normal distribution:
992962
#> mean:
993963
#> 0.6
994964
#> sd:
995-
#> 0.007
965+
#> 0.006
996966
```
997967

998968
## Model choice in estimate_infections()
@@ -1047,7 +1017,7 @@ fit_nonmech <- estimate_infections(
10471017
#> day, i.e. the reproduction number is the same as the daily growth rate.
10481018
#> ℹ If this was intended then this warning can be silenced by setting `dist =
10491019
#> Fixed(1)`'.
1050-
#> Warning: The largest R-hat is 1.09, indicating chains have not mixed.
1020+
#> Warning: The largest R-hat is 1.14, indicating chains have not mixed.
10511021
#> Running the chains for more iterations may help. See
10521022
#> https://mc-stan.org/misc/warnings.html#r-hat
10531023
#> Warning: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
@@ -1090,22 +1060,22 @@ fit_secondary_fixed <- estimate_secondary(
10901060
delays = delay_opts(LogNormal(mean = 14, sd = 5, max = 30)),
10911061
stan = stan
10921062
)
1093-
#> WARN [2026-02-05 09:06:57] estimate_secondary (chain: 1): The largest R-hat is 1.06, indicating chains have not mixed.
1063+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 1): The largest R-hat is 1.08, indicating chains have not mixed.
10941064
#> Running the chains for more iterations may help. See
10951065
#> https://mc-stan.org/misc/warnings.html#r-hat -
1096-
#> WARN [2026-02-05 09:06:57] estimate_secondary (chain: 2): The largest R-hat is 1.06, indicating chains have not mixed.
1066+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 2): The largest R-hat is 1.08, indicating chains have not mixed.
10971067
#> Running the chains for more iterations may help. See
10981068
#> https://mc-stan.org/misc/warnings.html#r-hat -
1099-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1069+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
11001070
#> Running the chains for more iterations may help. See
11011071
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1102-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1072+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
11031073
#> Running the chains for more iterations may help. See
11041074
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1105-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1075+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
11061076
#> Running the chains for more iterations may help. See
11071077
#> https://mc-stan.org/misc/warnings.html#tail-ess -
1108-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1078+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
11091079
#> Running the chains for more iterations may help. See
11101080
#> https://mc-stan.org/misc/warnings.html#tail-ess -
11111081

@@ -1121,22 +1091,22 @@ fit_secondary_uncertain <- estimate_secondary(
11211091
),
11221092
stan = stan
11231093
)
1124-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 1): The largest R-hat is 1.31, indicating chains have not mixed.
1094+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 1): The largest R-hat is 1.63, indicating chains have not mixed.
11251095
#> Running the chains for more iterations may help. See
11261096
#> https://mc-stan.org/misc/warnings.html#r-hat -
1127-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 2): The largest R-hat is 1.31, indicating chains have not mixed.
1097+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 2): The largest R-hat is 1.63, indicating chains have not mixed.
11281098
#> Running the chains for more iterations may help. See
11291099
#> https://mc-stan.org/misc/warnings.html#r-hat -
1130-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1100+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
11311101
#> Running the chains for more iterations may help. See
11321102
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1133-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1103+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
11341104
#> Running the chains for more iterations may help. See
11351105
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1136-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1106+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
11371107
#> Running the chains for more iterations may help. See
11381108
#> https://mc-stan.org/misc/warnings.html#tail-ess -
1139-
#> WARN [2026-02-05 09:06:58] estimate_secondary (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1109+
#> WARN [2026-03-01 00:47:03] estimate_secondary (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
11401110
#> Running the chains for more iterations may help. See
11411111
#> https://mc-stan.org/misc/warnings.html#tail-ess -
11421112
```
@@ -1179,22 +1149,22 @@ fit_trunc_fast <- estimate_truncation(
11791149
),
11801150
stan = stan
11811151
)
1182-
#> WARN [2026-02-05 09:06:59] estimate_truncation (chain: 1): The largest R-hat is NA, indicating chains have not mixed.
1152+
#> WARN [2026-03-01 00:47:05] estimate_truncation (chain: 1): The largest R-hat is NA, indicating chains have not mixed.
11831153
#> Running the chains for more iterations may help. See
11841154
#> https://mc-stan.org/misc/warnings.html#r-hat -
1185-
#> WARN [2026-02-05 09:06:59] estimate_truncation (chain: 2): The largest R-hat is NA, indicating chains have not mixed.
1155+
#> WARN [2026-03-01 00:47:05] estimate_truncation (chain: 2): The largest R-hat is NA, indicating chains have not mixed.
11861156
#> Running the chains for more iterations may help. See
11871157
#> https://mc-stan.org/misc/warnings.html#r-hat -
1188-
#> WARN [2026-02-05 09:06:59] estimate_truncation (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1158+
#> WARN [2026-03-01 00:47:05] estimate_truncation (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
11891159
#> Running the chains for more iterations may help. See
11901160
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1191-
#> WARN [2026-02-05 09:06:59] estimate_truncation (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1161+
#> WARN [2026-03-01 00:47:05] estimate_truncation (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
11921162
#> Running the chains for more iterations may help. See
11931163
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1194-
#> WARN [2026-02-05 09:06:59] estimate_truncation (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1164+
#> WARN [2026-03-01 00:47:05] estimate_truncation (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
11951165
#> Running the chains for more iterations may help. See
11961166
#> https://mc-stan.org/misc/warnings.html#tail-ess -
1197-
#> WARN [2026-02-05 09:06:59] estimate_truncation (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1167+
#> WARN [2026-03-01 00:47:05] estimate_truncation (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
11981168
#> Running the chains for more iterations may help. See
11991169
#> https://mc-stan.org/misc/warnings.html#tail-ess -
12001170

@@ -1210,22 +1180,22 @@ fit_trunc_slow <- estimate_truncation(
12101180
),
12111181
stan = stan
12121182
)
1213-
#> WARN [2026-02-05 09:07:03] estimate_truncation (chain: 1): The largest R-hat is NA, indicating chains have not mixed.
1183+
#> WARN [2026-03-01 00:47:07] estimate_truncation (chain: 1): The largest R-hat is NA, indicating chains have not mixed.
12141184
#> Running the chains for more iterations may help. See
12151185
#> https://mc-stan.org/misc/warnings.html#r-hat -
1216-
#> WARN [2026-02-05 09:07:03] estimate_truncation (chain: 2): The largest R-hat is NA, indicating chains have not mixed.
1186+
#> WARN [2026-03-01 00:47:07] estimate_truncation (chain: 2): The largest R-hat is NA, indicating chains have not mixed.
12171187
#> Running the chains for more iterations may help. See
12181188
#> https://mc-stan.org/misc/warnings.html#r-hat -
1219-
#> WARN [2026-02-05 09:07:03] estimate_truncation (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1189+
#> WARN [2026-03-01 00:47:07] estimate_truncation (chain: 1): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
12201190
#> Running the chains for more iterations may help. See
12211191
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1222-
#> WARN [2026-02-05 09:07:03] estimate_truncation (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
1192+
#> WARN [2026-03-01 00:47:07] estimate_truncation (chain: 2): Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
12231193
#> Running the chains for more iterations may help. See
12241194
#> https://mc-stan.org/misc/warnings.html#bulk-ess -
1225-
#> WARN [2026-02-05 09:07:03] estimate_truncation (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1195+
#> WARN [2026-03-01 00:47:08] estimate_truncation (chain: 1): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
12261196
#> Running the chains for more iterations may help. See
12271197
#> https://mc-stan.org/misc/warnings.html#tail-ess -
1228-
#> WARN [2026-02-05 09:07:03] estimate_truncation (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
1198+
#> WARN [2026-03-01 00:47:08] estimate_truncation (chain: 2): Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
12291199
#> Running the chains for more iterations may help. See
12301200
#> https://mc-stan.org/misc/warnings.html#tail-ess -
12311201
```
@@ -1334,47 +1304,45 @@ summarise_draws(fit, "rhat")
13341304
#> # A tibble: 511 × 2
13351305
#> variable rhat
13361306
#> <chr> <dbl>
1337-
#> 1 params[1] 1.03
1338-
#> 2 params[2] 1.04
1339-
#> 3 params[3] 1.01
1340-
#> 4 params[4] 1.01
1341-
#> 5 eta[1] 1.01
1342-
#> 6 eta[2] 1.03
1343-
#> 7 eta[3] 1.01
1344-
#> 8 eta[4] 1.00
1345-
#> 9 eta[5] 1.02
1346-
#> 10 eta[6] 1.02
1307+
#> 1 params[1] 0.994
1308+
#> 2 params[2] 0.991
1309+
#> 3 params[3] 1.03
1310+
#> 4 params[4] 1.02
1311+
#> 5 eta[1] 0.988
1312+
#> 6 eta[2] 0.985
1313+
#> 7 eta[3] 0.989
1314+
#> 8 eta[4] 1.01
1315+
#> 9 eta[5] 1.04
1316+
#> 10 eta[6] 1.00
13471317
#> # ℹ 501 more rows
13481318

13491319
# Check effective sample size (should be > 400 for reliable inference)
13501320
summarise_draws(fit, "ess_bulk", "ess_tail")
13511321
#> Warning: The ESS has been capped to avoid unstable estimates.
1352-
#> Warning: The ESS has been capped to avoid unstable estimates.
1353-
#> Warning: The ESS has been capped to avoid unstable estimates.
13541322
#> # A tibble: 511 × 3
13551323
#> variable ess_bulk ess_tail
13561324
#> <chr> <dbl> <dbl>
1357-
#> 1 params[1] 110. 51.6
1358-
#> 2 params[2] 56.3 29.6
1359-
#> 3 params[3] 83.1 66.4
1360-
#> 4 params[4] 66.8 57.7
1361-
#> 5 eta[1] 102. 60.3
1362-
#> 6 eta[2] 106. 32.4
1363-
#> 7 eta[3] 109. 79.3
1364-
#> 8 eta[4] 102. 114.
1365-
#> 9 eta[5] 122. 88.2
1366-
#> 10 eta[6] 72.5 57.7
1325+
#> 1 params[1] 125. 92.6
1326+
#> 2 params[2] 119. 77.5
1327+
#> 3 params[3] 99.9 55.3
1328+
#> 4 params[4] 67.2 57.7
1329+
#> 5 eta[1] 200 97.4
1330+
#> 6 eta[2] 83.0 78.1
1331+
#> 7 eta[3] 84.3 78.0
1332+
#> 8 eta[4] 194. 105.
1333+
#> 9 eta[5] 84.6 76.4
1334+
#> 10 eta[6] 158. 117.
13671335
#> # ℹ 501 more rows
13681336

13691337
# You can also use the summary method which includes these diagnostics
13701338
summary(estimates_r0)
13711339
#> measure estimate
13721340
#> <char> <char>
1373-
#> 1: New infections per day 2342 (1264 -- 3747)
1341+
#> 1: New infections per day 2246 (1333 -- 3445)
13741342
#> 2: Expected change in reports Likely decreasing
1375-
#> 3: Effective reproduction no. 0.9 (0.7 -- 1.1)
1376-
#> 4: Rate of growth -0.023 (-0.091 -- 0.037)
1377-
#> 5: Doubling/halving time (days) -30 (19 -- -7.6)
1343+
#> 3: Effective reproduction no. 0.89 (0.71 -- 1.1)
1344+
#> 4: Rate of growth -0.027 (-0.096 -- 0.035)
1345+
#> 5: Doubling/halving time (days) -26 (20 -- -7.2)
13781346
```
13791347

13801348
Key diagnostics to check:

0 commit comments

Comments
 (0)