Skip to content

Commit

Permalink
Merge branch 'main' into fix-611
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Mar 20, 2024
2 parents 06f0471 + f6c707b commit 74ad6d9
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 151 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* The example in `estimate_truncation()` has been simplified. The package now ships with a dataset `example_truncated`, which is used in the `estimate_truncation()` example and tests. The steps for creating the `example_truncated` is stored in `./data-raw/estimate-truncation.R`. By @jamesmbaazam in #584 and reviewed by @seabbs and @sbfnk.
* Tests have been updated to only set random seeds before snapshot tests involving random number generation, and unset them subsequently. By @sbfnk in #590 and reviewed by @seabbs.
* A function `simulate_secondary()` was added to simulate from parameters of the `estimate_secondary` model. A function of the same name that was previously based on a reimplementation of that model in R with potentially time-varying scalings and delays has been renamed to `convolve_and_scale()`. By @sbfnk in #591 and reviewed by @seabbs.
* Fixed broken links in the README. By @jamesmbaazam in #617 and reviewed by @sbfnk.

## Model changes

Expand Down
33 changes: 0 additions & 33 deletions R/deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,39 +179,6 @@ lognorm_dist_def <- function(mean, mean_sd,
return(dist)
}

#' Tune an Inverse Gamma to Achieve the Target Truncation
#'
#' @description `r lifecycle::badge("deprecated")`
#' Allows an inverse gamma distribution to be. tuned so that less than 0.01 of
#' its probability mass function falls outside of the specified bounds. This is
#' required when using an inverse gamma prior, for example for a Gaussian
#' process. As no inverse gamma priors are currently in use and this function
#' has some stability issues it has been deprecated.
#'
#' @param lower Numeric, defaults to 2. Lower truncation bound.
#'
#' @param upper Numeric, defaults to 21. Upper truncation bound.
#'
#' @return A list of alpha and beta values that describe a inverse gamma
#' distribution that achieves the target truncation.
#' @export
#'
#' @keywords internal
#'
tune_inv_gamma <- function(lower = 2, upper = 21) {
lifecycle::deprecate_stop(
"1.3.6", "tune_inv_gamma()",
details = paste0(
"As no inverse gamma priors are currently in use and this function has ",
"some stability issues it has been deprecated. Please let the package ",
"authors know if deprecating this function has caused any issues. ",
"For the last active version of the function see the one contained ",
"in version 1.3.5 at ",
"https://github.com/epiforecasts/EpiNow2/blob/bad836ebd650ace73ad1ead887fd0eae98c52dd6/R/dist.R#L739" # nolint
)
)
}

#' Specify a distribution.
#'
#' @description `r lifecycle::badge("deprecated")`
Expand Down
3 changes: 2 additions & 1 deletion R/simulate_infections.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ simulate_infections <- function(estimates, R, initial_infections,

## check inputs
assert_data_frame(R, any.missing = FALSE)
assert_subset(colnames(R), c("date", "R"))
assert_subset(c("date", "R"), colnames(R))
assert_date(R$date)
assert_numeric(R$R, lower = 0)
assert_numeric(initial_infections, lower = 0)
assert_numeric(day_of_week_effect, lower = 0, null.ok = TRUE)
assert_numeric(pop, lower = 0)
assert_class(delays, "delay_opts")
assert_class(truncation, "trunc_opts")
assert_class(obs, "obs_opts")
assert_class(generation_time, "generation_time_opts")

Expand Down
24 changes: 15 additions & 9 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Windows users will need a working installation of Rtools in order to build the p

<details> <summary> Getting Started </summary>

The [Getting Started vignette](EpiNow2.html)
The Getting Started vignette (see `vignette("EpiNow2")`)
is your quickest entry point to the package. It provides a quick run through of
the two main functions in the package and how to set up them up. It also
discusses how to summarise and visualise the results after running the models.
Expand All @@ -115,24 +115,30 @@ discusses how to summarise and visualise the results after running the models.

<details> <summary> Package website </summary>

The [package website](index.html) provides
various resources for learning about the package, including the function
reference, details about each model (model definition), workflows for
each model (usage), and case studies or literature of applications of
the package.
The package has two websites: one for
[the stable release version on CRAN](https://epiforecasts.io/EpiNow2/), and
another for [the version in development](https://epiforecasts.io/EpiNow2/dev).
These two provide various resources for learning about the package, including
the function reference, details about each model (model definition), workflows
for each model (usage), and case studies or literature of applications of
the package. However, the development website may contain experimental features
and information not yet available in the stable release.

</details>

<details> <summary> End-to-end workflows </summary>

The [workflow vignette](articles/estimate_infections_workflow.html) provides guidance on the end-to-end process of estimating reproduction numbers and performing short-term forecasts for a disease spreading in a given setting.
The workflow vignette (see `vignette("estimate_infections_workflow")`)
provides guidance on the end-to-end process of estimating reproduction
numbers and performing short-term forecasts for a disease spreading in a

</details>

<details> <summary> Model definitions </summary>

On the website, we provide the mathematical definition of each model.
For example, the model definition vignette for `estimate_infections()` can be found [here](articles/estimate_infections.html).
In different vignettes we provide the mathematical definition of each model.
For example, the model definition vignette for `estimate_infections()` can be
found in `vignettes("estimate_infections")`.

</details>

Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,42 +164,47 @@ simple deployment/development a prebuilt docker image is also available
Getting Started
</summary>

The [Getting Started vignette](EpiNow2.html) is your quickest entry
point to the package. It provides a quick run through of the two main
functions in the package and how to set up them up. It also discusses
how to summarise and visualise the results after running the models.
The Getting Started vignette (see `vignette("EpiNow2")`) is your
quickest entry point to the package. It provides a quick run through of
the two main functions in the package and how to set up them up. It also
discusses how to summarise and visualise the results after running the
models.

</details>
<details>
<summary>
Package website
</summary>

The [package website](index.html) provides various resources for
learning about the package, including the function reference, details
about each model (model definition), workflows for each model (usage),
and case studies or literature of applications of the package.
The package has two websites: one for [the stable release version on
CRAN](https://epiforecasts.io/EpiNow2/), and another for [the version in
development](https://epiforecasts.io/EpiNow2/dev). These two provide
various resources for learning about the package, including the function
reference, details about each model (model definition), workflows for
each model (usage), and case studies or literature of applications of
the package. However, the development website may contain experimental
features and information not yet available in the stable release.

</details>
<details>
<summary>
End-to-end workflows
</summary>

The [workflow vignette](articles/estimate_infections_workflow.html)
The workflow vignette (see `vignette("estimate_infections_workflow")`)
provides guidance on the end-to-end process of estimating reproduction
numbers and performing short-term forecasts for a disease spreading in a
given setting.

</details>
<details>
<summary>
Model definitions
</summary>

On the website, we provide the mathematical definition of each model.
For example, the model definition vignette for `estimate_infections()`
can be found [here](articles/estimate_infections.html).
In different vignettes we provide the mathematical definition of each
model. For example, the model definition vignette for
`estimate_infections()` can be found in
`vignettes("estimate_infections")`.

</details>
<details>
Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: epiforecasts.io/EpiNow2/
url: https://epiforecasts.io/EpiNow2/
template:
bootstrap: 5
opengraph:
Expand Down

0 comments on commit 74ad6d9

Please sign in to comment.