]>
nmode's Git Repositories - Rnaught/blob - R/WP_known.R
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
8 #' @return The function returns \code{Rhat}, the maximum likelihood estimator of R0.
11 WP_known
<- function(NT
, p
) {
17 Nt
<- NT
[i
:max(1, i
-k
+1)]
18 mu_t
[i
] <- sum(p
[1:min(k
, i
)] * Nt
)
21 Rhat
<- sum(NT
[-1]) / sum(mu_t
)