diff --git a/R/predict_future_infections.R b/R/predict_future_infections.R index 4f22fd1f86b3caea3723414523a43b846fac9753..8bee90f763197312407c41be8fd3e6759b214bbc 100644 --- a/R/predict_future_infections.R +++ b/R/predict_future_infections.R @@ -6,9 +6,9 @@ #' meanlog and sdlog are the log-normal distribution parameters derived from #' the incubation period characteristics described in Xin et al. (2021). #' -#' @param last_day_reported_infection Number of days the last infection was reported after the event (1 = event day) -#' @param total_reported_infections Number of reported symptomatic infections so far -#' @param total_expected_infections Number of expected symptomatic infections in total +#' @param last_day_reported_infection Number of days the last infection was reported after the event (0 = event day). +#' @param total_reported_infections Number of reported symptomatic infections so far. +#' @param total_expected_infections Number of expected symptomatic infections in total. #' @param meanlog Number, the parameter of mean from the log-normal distribution. #' @param sdlog Number, the parameter of sd from the log-normal distribution. #' @return Vector with expected future infections per day after the event. diff --git a/vignettes/future_infections.Rmd b/vignettes/future_infections.Rmd index 2837240e67295a94d2d6d0c8cd3e53bb5a83fd9a..b87b1253a4d5e62aefe89852388cf6b50fc2fd26 100644 --- a/vignettes/future_infections.Rmd +++ b/vignettes/future_infections.Rmd @@ -119,7 +119,7 @@ When at some point the updated `total_reported_infections` is not smaller than ` ### Output ```{r predict_future_infections} -last_day_reported_infections = 4 # day 1 = event day +last_day_reported_infections = 3 # day 0 = event day total_reported_infections = 4 total_expected_infections = get_expected_total_infections(25, "mixed", "high risk") @@ -137,7 +137,7 @@ The function `predict_future_infections()` creates a vector with values represen ```{r libraries, foldcode = TRUE, message = FALSE} data <- data.frame("Erkrankungsdatum" = as.Date("2022-03-15") + 0:3, "Neue_Faelle" = c(0, 0, 1, 3)) -expected <- data.frame("Erkrankungsdatum" = as.Date("2022-03-15") + 0:(length(predicted_daily_infections) - 1), +expected <- data.frame("Erkrankungsdatum" = as.Date("2022-03-15") + 1:(length(predicted_daily_infections)), "ErwarteteWeitereFaelle" = predicted_daily_infections) g <- ggplot(expected) + geom_bar( @@ -155,8 +155,8 @@ g <- ggplot(expected) + ), stat = 'identity' ) + - geom_vline(xintercept = expected$Erkrankungsdatum[1]) + - geom_label(aes(x = expected$Erkrankungsdatum[1], y = data$Neue_Faelle[1] + 4, label = "Event"), + geom_vline(xintercept = data$Erkrankungsdatum[1]) + + geom_label(aes(x = data$Erkrankungsdatum[1], y = data$Neue_Faelle[1] + 4, label = "Event"), colour = "black", fill = "white", vjust = 1, size = 7) + scale_y_continuous(breaks = function(x) unique( floor(pretty(seq(0, (max(x) + 1) * 1.1))))) +