]>
nmode's Git Repositories - Rnaught/blob - R/WP_known.R
4c43ed2dc1eb76ec3b72031ff22a77c0587d0415
1 #' WP method background function WP_known
3 #' This is a background/internal function called by \code{WP}. It computes the maximum
4 #' likelihood estimator of R0 assuming that the serial distribution is known and finite discrete.
6 #' @param NT Vector of case counts.
7 #' @param p Discretized version of the serial distribution.
9 #' @return The function returns the maximum likelihood estimator of R0.
12 WP_known
<- function(NT
, p
) {
18 Nt
<- NT
[i
:max(1, i
-k
+1)]
19 mu_t
[i
] <- sum(p
[1:min(k
, i
)] * Nt
)
22 Rhat
<- sum(NT
[-1]) / sum(mu_t
)