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

restore alpha prior SD to 0.05 #840

Merged
merged 3 commits into from
Oct 30, 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
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Model changes

- A bug in the spectral densities of Matern kernels of order other than 3/2 has been fixed and the vignette updated accordingly. By @sbfnk in #835 and reviewed by @seabbs.
- Changed the prior on the (square root of the) magnitude alpha of the Gaussian Process back to HalfNormal(0, 0.05) based on user feedback of unexpected results. By @sbfnk in #840 and reviewed by @jamesmbaazam.

## Package changes

Expand All @@ -25,7 +26,7 @@ A release that introduces model improvements to the Gaussian Process models, alo
- When defining probability distributions these can now be truncated using the `tolerance` argument
- Ornstein-Uhlenbeck and 5 / 2 Matérn kernels have been added. By @sbfnk in #741 and reviewed by @seabbs.
- Gaussian processes have been vectorised, leading to some speed gains 🚀 , and the `gp_opts()` function has gained three more options, "periodic", "ou", and "se", to specify periodic and linear kernels respectively. By @seabbs in #742 and reviewed by @jamesmbaazam.
- Prior predictive checks have been used to update the following priors: the prior on the magnitude of the Gaussian process (from HalfNormal(0, 1) to HalfNormal(0, 0.1)), and the prior on the overdispersion (from 1 / HalfNormal(0, 1)^2 to 1 / HalfNormal(0, 0.25)). In the user-facing API, this is a change in default values of the `sd` of `phi` in `obs_opts()` from 1 to 0.25. By @seabbs in #742 and reviewed by @jamesmbaazam.
- Prior predictive checks have been used to update the following priors: the prior on the magnitude of the Gaussian process (from HalfNormal(0, 0.05)^2 to HalfNormal(0, 0.01)^2), and the prior on the overdispersion (from 1 / HalfNormal(0, 1)^2 to 1 / HalfNormal(0, 0.25)). In the user-facing API, this is a change in default values of the `sd` of `phi` in `obs_opts()` from 1 to 0.25. By @seabbs in #742 and reviewed by @jamesmbaazam.
- The default stan control options have been updated from `list(adapt_delta = 0.95, max_treedepth = 15)` to `list(adapt_delta = 0.9, max_treedepth = 12)` due to improved performance and to reduce the runtime of the default parameterisations. By @seabbs in #742 and reviewed by @jamesmbaazam.
- Initialisation has been simplified by sampling directly from the priors, where possible, rather than from a constrained space. By @seabbs in #742 and reviewed by @jamesmbaazam.
- Unnecessary normalisation of delay priors has been removed. By @seabbs in #742 and reviewed by @jamesmbaazam.
Expand Down
4 changes: 2 additions & 2 deletions R/opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ backcalc_opts <- function(prior = c("reports", "none", "infections"),
#' deviation of the Gaussian process (logged Rt in case of the renewal model,
#' logged infections in case of the nonmechanistic model).
#'
#' @param alpha_sd Numeric, defaults to 0.1. The standard deviation of the
#' @param alpha_sd Numeric, defaults to 0.05. The standard deviation of the
#' magnitude parameter of the Gaussian process kernel. Can be tuned to adjust
#' how far alpha is allowed to deviate form its prior mean (`alpha_mean`).
#'
Expand Down Expand Up @@ -509,7 +509,7 @@ gp_opts <- function(basis_prop = 0.2,
ls_min = 0,
ls_max = 60,
alpha_mean = 0,
alpha_sd = 0.01,
alpha_sd = 0.05,
kernel = c("matern", "se", "ou", "periodic"),
matern_order = 3 / 2,
matern_type,
Expand Down
4 changes: 2 additions & 2 deletions man/gp_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-create_gp_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_that("create_gp_data returns correct default values when GP is disabled", {
expect_equal(gp_data$ls_sdlog, convert_to_logsd(21, 7))
expect_equal(gp_data$ls_min, 0)
expect_equal(gp_data$ls_max, 3.54, tolerance = 0.01)
expect_equal(gp_data$alpha_sd, 0.01)
expect_equal(gp_data$alpha_sd, 0.05)
expect_equal(gp_data$gp_type, 2) # Default to Matern
expect_equal(gp_data$nu, 3 / 2)
expect_equal(gp_data$w0, 1.0)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-gp_opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_that("gp_opts returns correct default values", {
expect_equal(gp$ls_sd, 7)
expect_equal(gp$ls_min, 0)
expect_equal(gp$ls_max, 60)
expect_equal(gp$alpha_sd, 0.01)
expect_equal(gp$alpha_sd, 0.05)
expect_equal(gp$kernel, "matern")
expect_equal(gp$matern_order, 3 / 2)
expect_equal(gp$w0, 1.0)
Expand Down
Loading