Skip to content

Commit

Permalink
Merge pull request #380 from epiforecasts/fixes
Browse files Browse the repository at this point in the history
fix errors introduced in #378
  • Loading branch information
seabbs committed Apr 27, 2023
2 parents 304043e + 35fd1d7 commit c38963d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion R/create.R
Expand Up @@ -396,7 +396,7 @@ create_gp_data <- function(gp = gp_opts(), data) {
#' create_obs_model(obs_opts(week_length = 3), dates = dates)
create_obs_model <- function(obs = obs_opts(), dates) {
data <- list(
model_type = as.numeric(obs$family %in% "poisson"),
model_type = as.numeric(obs$family %in% "negbin"),
phi_mean = obs$phi[1],
phi_sd = obs$phi[2],
week_effect = ifelse(obs$week_effect, obs$week_length, 1),
Expand Down
6 changes: 4 additions & 2 deletions R/estimate_secondary.R
Expand Up @@ -88,7 +88,9 @@
#' plot(inc, primary = TRUE)
#'
#' # forecast future secondary cases from primary
#' inc_preds <- forecast_secondary(inc, cases[seq_len(.N)][, value := primary])
#' inc_preds <- forecast_secondary(
#' inc, cases[seq(61, .N)][, value := primary]
#' )
#' plot(inc_preds, new_obs = cases, from = "2020-05-01")
#'
#' #### Prevalence data example ####
Expand Down Expand Up @@ -116,7 +118,7 @@
#'
#' # forecast future secondary cases from primary
#' prev_preds <- forecast_secondary(
#' prev, cases[10seq_len(.N)][, value := primary]
#' prev, cases[seq(101, .N)][, value := primary]
#' )
#' plot(prev_preds, new_obs = cases, from = "2020-06-01")
#'
Expand Down
6 changes: 4 additions & 2 deletions man/estimate_secondary.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-estimate_secondary.R
Expand Up @@ -97,7 +97,7 @@ test_that("estimate_secondary can recover simulated parameters", {

test_that("forecast_secondary can return values from simulated data and plot
them", {
inc_preds <- forecast_secondary(inc, cases[seq_len(.N)][, value := primary])
inc_preds <- forecast_secondary(inc, cases[seq(61, .N)][, value := primary])
expect_equal(names(inc_preds), c("samples", "forecast", "predictions"))
# validation plot of observations vs estimates
expect_error(plot(inc_preds, new_obs = cases, from = "2020-05-01"), NA)
Expand Down

0 comments on commit c38963d

Please sign in to comment.