Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update epinow vignette #882

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified vignettes/epinow-epinow-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/epinow-regional_epinow-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/epinow-regional_epinow_multiple-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 49 additions & 44 deletions vignettes/epinow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ options(mc.cores = 4)
reported_cases <- example_confirmed[1:60]
reporting_delay <- LogNormal(mean = 2, sd = 1, max = 10)
delay <- example_incubation_period + reporting_delay
rt_prior <- list(mean = 2, sd = 0.1)
rt_prior <- LogNormal(mean = 2, sd = 0.1)
```

We can then run the `epinow()` function with the same arguments as `estimate_infections()`.
Expand All @@ -51,10 +51,15 @@ res <- epinow(reported_cases,
)
#> Logging threshold set at INFO for the name logger
#> Writing EpiNow2 logs to the console and:
#> '/tmp/RtmpdViclN/regional-epinow/2020-04-21.log'.
#> '/tmp/RtmpM4AQFy/regional-epinow/2020-04-21.log'.
#> Logging threshold set at INFO for the name logger
#> Writing EpiNow2.epinow logs to the console and:
#> '/tmp/RtmpdViclN/epinow/2020-04-21.log'.
#> '/tmp/RtmpM4AQFy/epinow/2020-04-21.log'.
#> WARN [2024-12-06 15:12:56] epinow: There were 2 divergent transitions after warmup. See
#> https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
#> to find out why this is a problem and how to eliminate them. -
#> WARN [2024-12-06 15:12:56] epinow: Examine the pairs() plot to diagnose sampling problems
#> -
res$plots$R
```

Expand Down Expand Up @@ -89,38 +94,38 @@ region_rt <- regional_epinow(
delays = delay_opts(delay),
rt = rt_opts(prior = rt_prior),
)
#> INFO [2024-12-01 00:33:34] Producing following optional outputs: regions, summary, samples, plots, latest
#> INFO [2024-12-06 15:12:59] Producing following optional outputs: regions, summary, samples, plots, latest
#> Logging threshold set at INFO for the name logger
#> Writing EpiNow2 logs to the console and:
#> '/tmp/RtmpdViclN/regional-epinow/2020-04-21.log'.
#> '/tmp/RtmpM4AQFy/regional-epinow/2020-04-21.log'.
#> Logging threshold set at INFO for the name logger
#> Writing EpiNow2.epinow logs to: '/tmp/RtmpdViclN/epinow/2020-04-21.log'.
#> INFO [2024-12-01 00:33:34] Reporting estimates using data up to: 2020-04-21
#> INFO [2024-12-01 00:33:34] No target directory specified so returning output
#> INFO [2024-12-01 00:33:34] Producing estimates for: testland, realland
#> INFO [2024-12-01 00:33:34] Regions excluded: none
#> INFO [2024-12-01 00:34:44] Completed estimates for: testland
#> INFO [2024-12-01 00:35:48] Completed estimates for: realland
#> INFO [2024-12-01 00:35:48] Completed regional estimates
#> INFO [2024-12-01 00:35:48] Regions with estimates: 2
#> INFO [2024-12-01 00:35:48] Regions with runtime errors: 0
#> INFO [2024-12-01 00:35:48] Producing summary
#> INFO [2024-12-01 00:35:48] No summary directory specified so returning summary output
#> INFO [2024-12-01 00:35:49] No target directory specified so returning timings
#> Writing EpiNow2.epinow logs to: '/tmp/RtmpM4AQFy/epinow/2020-04-21.log'.
#> INFO [2024-12-06 15:12:59] Reporting estimates using data up to: 2020-04-21
#> INFO [2024-12-06 15:12:59] No target directory specified so returning output
#> INFO [2024-12-06 15:12:59] Producing estimates for: testland, realland
#> INFO [2024-12-06 15:12:59] Regions excluded: none
#> INFO [2024-12-06 15:14:04] Completed estimates for: testland
#> INFO [2024-12-06 15:15:08] Completed estimates for: realland
#> INFO [2024-12-06 15:15:08] Completed regional estimates
#> INFO [2024-12-06 15:15:08] Regions with estimates: 2
#> INFO [2024-12-06 15:15:08] Regions with runtime errors: 0
#> INFO [2024-12-06 15:15:08] Producing summary
#> INFO [2024-12-06 15:15:08] No summary directory specified so returning summary output
#> INFO [2024-12-06 15:15:08] No target directory specified so returning timings
## summary
region_rt$summary$summarised_results$table
#> Region New infections per day Expected change in daily reports
#> <char> <char> <fctr>
#> 1: realland 2254 (1318 -- 4059) Likely decreasing
#> 2: testland 2217 (1328 -- 4054) Likely decreasing
#> 1: realland 2203 (1259 -- 3956) Likely decreasing
#> 2: testland 2237 (1281 -- 4185) Likely decreasing
#> Effective reproduction no. Rate of growth
#> <char> <char>
#> 1: 0.9 (0.71 -- 1.1) -0.028 (-0.097 -- 0.047)
#> 2: 0.89 (0.72 -- 1.1) -0.031 (-0.095 -- 0.049)
#> 1: 0.89 (0.71 -- 1.1) -0.031 (-0.096 -- 0.041)
#> 2: 0.9 (0.71 -- 1.1) -0.027 (-0.097 -- 0.051)
#> Doubling/halving time (days)
#> <char>
#> 1: -25 (15 -- -7.2)
#> 2: -22 (14 -- -7.3)
#> 1: -22 (17 -- -7.2)
#> 2: -26 (14 -- -7.2)
## plot
region_rt$summary$plots$R
```
Expand All @@ -140,38 +145,38 @@ region_separate_rt <- regional_epinow(
delays = delay_opts(delay),
rt = rt, gp = gp,
)
#> INFO [2024-12-01 00:35:49] Producing following optional outputs: regions, summary, samples, plots, latest
#> INFO [2024-12-06 15:15:09] Producing following optional outputs: regions, summary, samples, plots, latest
#> Logging threshold set at INFO for the name logger
#> Writing EpiNow2 logs to the console and:
#> '/tmp/RtmpdViclN/regional-epinow/2020-04-21.log'.
#> '/tmp/RtmpM4AQFy/regional-epinow/2020-04-21.log'.
#> Logging threshold set at INFO for the name logger
#> Writing EpiNow2.epinow logs to: '/tmp/RtmpdViclN/epinow/2020-04-21.log'.
#> INFO [2024-12-01 00:35:49] Reporting estimates using data up to: 2020-04-21
#> INFO [2024-12-01 00:35:49] No target directory specified so returning output
#> INFO [2024-12-01 00:35:49] Producing estimates for: testland, realland
#> INFO [2024-12-01 00:35:49] Regions excluded: none
#> INFO [2024-12-01 00:37:03] Completed estimates for: testland
#> INFO [2024-12-01 00:37:37] Completed estimates for: realland
#> INFO [2024-12-01 00:37:37] Completed regional estimates
#> INFO [2024-12-01 00:37:38] Regions with estimates: 2
#> INFO [2024-12-01 00:37:38] Regions with runtime errors: 0
#> INFO [2024-12-01 00:37:38] Producing summary
#> INFO [2024-12-01 00:37:38] No summary directory specified so returning summary output
#> INFO [2024-12-01 00:37:38] No target directory specified so returning timings
#> Writing EpiNow2.epinow logs to: '/tmp/RtmpM4AQFy/epinow/2020-04-21.log'.
#> INFO [2024-12-06 15:15:09] Reporting estimates using data up to: 2020-04-21
#> INFO [2024-12-06 15:15:09] No target directory specified so returning output
#> INFO [2024-12-06 15:15:09] Producing estimates for: testland, realland
#> INFO [2024-12-06 15:15:09] Regions excluded: none
#> INFO [2024-12-06 15:16:23] Completed estimates for: testland
#> INFO [2024-12-06 15:17:02] Completed estimates for: realland
#> INFO [2024-12-06 15:17:02] Completed regional estimates
#> INFO [2024-12-06 15:17:02] Regions with estimates: 2
#> INFO [2024-12-06 15:17:02] Regions with runtime errors: 0
#> INFO [2024-12-06 15:17:02] Producing summary
#> INFO [2024-12-06 15:17:02] No summary directory specified so returning summary output
#> INFO [2024-12-06 15:17:02] No target directory specified so returning timings
## summary
region_separate_rt$summary$summarised_results$table
#> Region New infections per day Expected change in daily reports
#> <char> <char> <fctr>
#> 1: realland 2094 (1035 -- 4404) Likely decreasing
#> 2: testland 2225 (1305 -- 3875) Likely decreasing
#> 1: realland 2072 (1008 -- 4386) Likely decreasing
#> 2: testland 2264 (1344 -- 3892) Likely decreasing
#> Effective reproduction no. Rate of growth
#> <char> <char>
#> 1: 0.86 (0.6 -- 1.2) -0.038 (-0.11 -- 0.049)
#> 2: 0.89 (0.7 -- 1.1) -0.029 (-0.093 -- 0.041)
#> 1: 0.85 (0.6 -- 1.2) -0.039 (-0.11 -- 0.049)
#> 2: 0.9 (0.71 -- 1.1) -0.026 (-0.091 -- 0.041)
#> Doubling/halving time (days)
#> <char>
#> 1: -18 (14 -- -6.2)
#> 2: -24 (17 -- -7.4)
#> 2: -26 (17 -- -7.6)
## plot
region_separate_rt$summary$plots$R
```
Expand Down
Loading