Skip to content

Commit

Permalink
make all priors consistent with previous versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Dec 6, 2024
1 parent 7814bdf commit 617ed24
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/epinow.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#' out <- epinow(
#' data = reported_cases,
#' generation_time = gt_opts(generation_time),
#' rt = rt_opts(prior = Normal(mean = 2, sd = 0.1)),
#' rt = rt_opts(prior = LogNormal(mean = 2, sd = 0.1)),
#' delays = delay_opts(incubation_period + reporting_delay)
#' )
#' # summary of the latest estimates
Expand Down
2 changes: 1 addition & 1 deletion R/estimate_infections.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
#' def <- estimate_infections(reported_cases,
#' generation_time = gt_opts(generation_time),
#' delays = delay_opts(incubation_period + reporting_delay),
#' rt = rt_opts(prior = Normal(mean = 2, sd = 0.1))
#' rt = rt_opts(prior = LogNormal(mean = 2, sd = 0.1))
#' )
#' # real time estimates
#' summary(def)
Expand Down
2 changes: 1 addition & 1 deletion R/opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ trunc_opts <- function(dist = Fixed(0), default_cdf_cutoff = 0.001,
#' rt_opts()
#'
#' # add a custom length scale
#' rt_opts(prior = Normal(mean = 2, sd = 1))
#' rt_opts(prior = LogNormal(mean = 2, sd = 1))
#'
#' # add a weekly random walk
#' rt_opts(rw = 7)
Expand Down
2 changes: 1 addition & 1 deletion inst/dev/benchmark-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ create_profiles <- function(dir = file.path("inst", "stan"),
data = reported_cases,
generation_time = gt_opts(fixed_generation_time),
delays = delay_opts(delays),
rt = rt_opts(prior = Normal(mean = 2, sd = 0.2)),
rt = rt_opts(prior = LogNormal(mean = 2, sd = 0.2)),
stan = stan_opts(
samples = 1000, chains = 2, object = compiled_model,
cores = 2
Expand Down
2 changes: 1 addition & 1 deletion man/epinow.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/estimate_infections.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rt_opts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-rt_opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test_that("rt_opts returns expected default values", {

test_that("rt_opts handles custom inputs correctly", {
result <- suppressWarnings(rt_opts(
prior = Normal(mean = 2, sd = 0.5),
prior = LogNormal(mean = 2, sd = 0.5),
use_rt = FALSE,
rw = 7,
use_breakpoints = FALSE,
Expand Down
4 changes: 2 additions & 2 deletions vignettes/EpiNow2.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ estimates <- epinow(
data = reported_cases,
generation_time = gt_opts(example_generation_time),
delays = delay_opts(example_incubation_period + reporting_delay),
rt = rt_opts(prior = Normal(mean = 2, sd = 0.2)),
rt = rt_opts(prior = LogNormal(mean = 2, sd = 0.2)),
stan = stan_opts(cores = 4, control = list(adapt_delta = 0.99)),
verbose = interactive()
)
Expand Down Expand Up @@ -148,7 +148,7 @@ estimates <- regional_epinow(
data = reported_cases,
generation_time = gt_opts(example_generation_time),
delays = delay_opts(example_incubation_period + reporting_delay),
rt = rt_opts(prior = Normal(mean = 2, sd = 0.2), rw = 7),
rt = rt_opts(prior = LogNormal(mean = 2, sd = 0.2), rw = 7),
gp = NULL,
stan = stan_opts(cores = 4, warmup = 250, samples = 1000)
)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/epinow.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 <- Normal(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 Down
2 changes: 1 addition & 1 deletion vignettes/estimate_infections_options.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ example_generation_time
Lastly we need to choose a prior for the initial value of the reproduction number. This is assumed by the model to be normally distributed and we can set the mean and the standard deviation. We decide to set the mean to 2 and the standard deviation to 1.

```{r initial_r}
rt_prior <- Normal(mean = 2, sd = 0.1)
rt_prior <- LogNormal(mean = 2, sd = 0.1)
```

# Running the model
Expand Down

0 comments on commit 617ed24

Please sign in to comment.