Skip to content

Use natural parameters when specifying uncertain distributions #893

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

Merged
merged 18 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove use of Fixed() for specifying fixed parameters
  • Loading branch information
jamesmbaazam committed Dec 13, 2024
commit 19be97ebb89e99ccc261261971c593e7e008673c
4 changes: 2 additions & 2 deletions R/epinow.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
#' # set an example reporting delay. In practice this should use an estimate
#' # from the literature or be estimated from data
#' reporting_delay <- LogNormal(
#' meanlog = Fixed(2),
#' sdlog = Fixed(1),
#' meanlog = 2,
#' sdlog = 1,
#' max = 10
#' )
#'
Expand Down
4 changes: 2 additions & 2 deletions R/estimate_infections.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
#' # set an example reporting delay. In practice this should use an estimate
#' # from the literature or be estimated from data
#' reporting_delay <- LogNormal(
#' meanlog = Fixed(2),
#' sdlog = Fixed(1),
#' meanlog = 2,
#' sdlog = 1,
#' max = 10
#' )
#'
Expand Down
4 changes: 2 additions & 2 deletions R/regional_epinow.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
#' delays = delay_opts(example_incubation_period + example_reporting_delay),
#' rt = rt_opts(
#' prior = LogNormal(
#' meanlog = Fixed(2),
#' sdlog = Fixed(0.2)
#' meanlog = 2,
#' sdlog = 0.2
#' ),
#' stan = stan_opts(
#' samples = 100, warmup = 200
Expand Down
4 changes: 2 additions & 2 deletions R/simulate_infections.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ simulate_infections <- function(estimates, R, initial_infections,
#' generation_time = generation_time_opts(example_generation_time),
#' delays = delay_opts(example_incubation_period + example_reporting_delay),
#' rt = rt_opts(prior = LogNormal(
#' meanlog = Fixed(2),
#' sdlog = Fixed(0.1)
#' meanlog = 2,
#' sdlog = 0.1
#' ),
#' rw = 7
#' ),
Expand Down
12 changes: 6 additions & 6 deletions vignettes/EpiNow2.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ To demonstrate, we choose a lognormal distribution with mean 2, standard deviati

```{r}
reporting_delay <- LogNormal(
meanlog = Fixed(2),
sdlog = Fixed(1),
meanlog = 2,
sdlog = 1,
max = 10
)
reporting_delay
Expand Down Expand Up @@ -99,8 +99,8 @@ estimates <- epinow(
generation_time = gt_opts(example_generation_time),
delays = delay_opts(example_incubation_period + reporting_delay),
rt = rt_opts(prior = LogNormal(
meanlog = Fixed(2),
sdlog = Fixed(0.2)
meanlog = 2,
sdlog = 0.2
)),
stan = stan_opts(cores = 4, control = list(adapt_delta = 0.99)),
verbose = interactive()
Expand Down Expand Up @@ -157,8 +157,8 @@ estimates <- regional_epinow(
delays = delay_opts(example_incubation_period + reporting_delay),
rt = rt_opts(
prior = LogNormal(
meanlog = Fixed(2),
sdlog = Fixed(0.2)
meanlog = 2,
sdlog = 0.2
),
rw = 7
),
Expand Down
8 changes: 4 additions & 4 deletions vignettes/epinow.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ library("EpiNow2")
options(mc.cores = 4)
reported_cases <- example_confirmed[1:60]
reporting_delay <- LogNormal(
meanlog = Fixed(2),
sdlog = Fixed(1),
meanlog = 2,
sdlog = 1,
max = 10
)
delay <- example_incubation_period + reporting_delay
rt_prior <- LogNormal(
meanlog = Fixed(2),
sdlog = Fixed(0.1)
meanlog = 2,
sdlog = 0.1
)
```

Expand Down
8 changes: 4 additions & 4 deletions vignettes/estimate_infections_options.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Note that the mean and standard deviation must be converted to the log scale, wh

```{r reporting_delay}
reporting_delay <- LogNormal(
meanlog = Fixed(2),
sdlog = Fixed(1),
meanlog = 2,
sdlog = 1,
max = 10
)
reporting_delay
Expand All @@ -102,8 +102,8 @@ Lastly we need to choose a prior for the initial value of the reproduction numbe

```{r initial_r}
rt_prior <- LogNormal(
meanlog = Fixed(2),
sdlog = Fixed(0.1)
meanlog = 2,
sdlog = 0.1
)
```

Expand Down
2 changes: 1 addition & 1 deletion vignettes/estimate_infections_workflow.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ It can be changed using the `rt_opts()` function.
For example, if the user believes that at the very start of the data the reproduction number was 2, with uncertainty in this belief represented by a standard deviation of 1, they would use

```{r results = 'hide'}
rt_prior <- LogNormal(meanlog = Fixed(2), sdlog = Fixed(1))
rt_prior <- LogNormal(meanlog = 2, sdlog = 1)
rt_opts(prior = rt_prior)
```

Expand Down