diff options
Diffstat (limited to 'R/idea.R')
-rw-r--r-- | R/idea.R | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -42,6 +42,13 @@ #' # Obtain R0 when the serial distribution has a mean of three days. #' idea(cases, mu = 3 / 7) idea <- function(cases, mu) { + validate_cases(cases, min_length = 2, min_count = 1) + if (!is_real(mu) || mu <= 0) { + stop("The serial interval (`mu`) must be a number greater than 0.", + call. = FALSE + ) + } + s <- seq_along(cases) / mu x1 <- sum(s) |