Skip to content

Commit

Permalink
shorten seeding time
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Jul 3, 2023
1 parent d0bea23 commit 3867d5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/get.R
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ get_regions_with_most_reports <- function(reported_cases,
##' @param generation_time Generation time as specified using `dist_spec`
##' @return An integer seeding time
##' @author Sebastian Funk
##' @examples
##' gt1 <- dist_spec(mean = 5, sd = 1, max = 15)
##' gt2 <- dist_spec(mean = 10, sd = 2, max = 10)
##' delays <- dist_spec(mean = 5, sd = 1, max = 15)
##' get_seeding_time(delays, gt1 + gt2)
get_seeding_time <- function(delays, generation_time) {
# Estimate the mean delay -----------------------------------------------
seeding_time <- sum(mean(delays))
Expand All @@ -318,10 +323,11 @@ get_seeding_time <- function(delays, generation_time) {
} else {
seeding_time <- as.integer(seeding_time)
}
## make sure we have at least gt_max seeding time
## make sure we have at least (length of total gt pmf - 1) seeding time
seeding_time <- max(
seeding_time,
sum(generation_time$max) + sum(generation_time$np_pmf_max)
sum(generation_time$max) + sum(generation_time$np_pmf_max) -
length(generation_time$max) - length(generation_time$np_pmf_max)
)
return(seeding_time)
}
6 changes: 6 additions & 0 deletions man/get_seeding_time.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3867d5d

Please sign in to comment.