diff options
author | Naeem Model <me@nmode.ca> | 2023-06-29 21:37:15 +0000 |
---|---|---|
committer | Naeem Model <me@nmode.ca> | 2023-06-29 21:37:15 +0000 |
commit | ff1d5fa81a10cc374aa40fa13c697baa6ade136c (patch) | |
tree | 79ca60a8f5af3f9a09adcede670ba9c37a17eb41 /R/WP_known.R | |
parent | 18358add05e58e466ba7098f771e20d8d0599d0e (diff) |
Group internal functions for WP method
Diffstat (limited to 'R/WP_known.R')
-rw-r--r-- | R/WP_known.R | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/R/WP_known.R b/R/WP_known.R deleted file mode 100644 index 4c43ed2..0000000 --- a/R/WP_known.R +++ /dev/null @@ -1,24 +0,0 @@ -#' WP method background function WP_known -#' -#' This is a background/internal function called by \code{WP}. It computes the maximum -#' likelihood estimator of R0 assuming that the serial distribution is known and finite discrete. -#' -#' @param NT Vector of case counts. -#' @param p Discretized version of the serial distribution. -#' -#' @return The function returns the maximum likelihood estimator of R0. -#' -#' @keywords internal -WP_known <- function(NT, p) { - k <- length(p) - TT <- length(NT) - 1 - mu_t <- rep(0, TT) - - for (i in 1:TT) { - Nt <- NT[i:max(1, i-k+1)] - mu_t[i] <- sum(p[1:min(k, i)] * Nt) - } - - Rhat <- sum(NT[-1]) / sum(mu_t) - return(Rhat) -} |