]>
nmode's Git Repositories - Rnaught/blob - R/computeLL.R
01c0d57b4ca8a1831627806fd5a4b56e85f804b4
1 #' WP method background function computeLL
3 #' This is a background/internal function called by \code{WP}. It computes the log-likelihood.
5 #' @param NT Vector of case counts.
6 #' @param p Discretized version of the serial distribution.
7 #' @param R0 Basic reproductive ratio.
9 #' @return This function returns the log-likelihood at the input variables and parameters.
12 computeLL
<- function(p
, NT
, R0
) {
18 Nt
<- NT
[i
:max(1, i
-k
+1)]
19 mu_t
[i
] <- sum(p
[1:min(k
, i
)] * Nt
)
23 LL
<- sum(NT
[-1] * log(mu_t
)) - sum(mu_t
)