summaryrefslogtreecommitdiff
path: root/R/computeLL.R
diff options
context:
space:
mode:
authorNaeem Model <me@nmode.ca>2023-06-29 21:37:15 +0000
committerNaeem Model <me@nmode.ca>2023-06-29 21:37:15 +0000
commitff1d5fa81a10cc374aa40fa13c697baa6ade136c (patch)
tree79ca60a8f5af3f9a09adcede670ba9c37a17eb41 /R/computeLL.R
parent18358add05e58e466ba7098f771e20d8d0599d0e (diff)
Group internal functions for WP method
Diffstat (limited to 'R/computeLL.R')
-rw-r--r--R/computeLL.R26
1 files changed, 0 insertions, 26 deletions
diff --git a/R/computeLL.R b/R/computeLL.R
deleted file mode 100644
index 01c0d57..0000000
--- a/R/computeLL.R
+++ /dev/null
@@ -1,26 +0,0 @@
-#' WP method background function computeLL
-#'
-#' This is a background/internal function called by \code{WP}. It computes the log-likelihood.
-#'
-#' @param NT Vector of case counts.
-#' @param p Discretized version of the serial distribution.
-#' @param R0 Basic reproductive ratio.
-#'
-#' @return This function returns the log-likelihood at the input variables and parameters.
-#'
-#' @keywords internal
-computeLL <- function(p, NT, R0) {
- 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)
- }
-
- mu_t <- R0 * mu_t
- LL <- sum(NT[-1] * log(mu_t)) - sum(mu_t)
-
- return(LL)
-}