diff --git a/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/EpiEstim.Rmd b/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/EpiEstim.Rmd index 65551c2f..ba8855b2 100644 --- a/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/EpiEstim.Rmd +++ b/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/EpiEstim.Rmd @@ -16,13 +16,12 @@ library(EpiEstim) # Function to process a distrcrete object and output `si_discr` argument for # EpiEstim::make_config -wrap_si <- function(x) { - stopifnot(inherits(x, "distcrete")) - max_x <- x$q(0.999) - x <- si$d(seq_len(max_x)) - x[1] <- 0 - x <- x / sum(x) - x +wrap_si <- function(si) { + domain <- seq(1L, to = si$prob_dist$qf(0.999), by = 1L) + pmf <- si$prob_dist$d(domain) + pmf[1] <- 0 + pmf <- pmf / sum(pmf) + pmf } diff --git a/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/i2extras.Rmd b/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/i2extras.Rmd index 44cd846e..b03fdc07 100644 --- a/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/i2extras.Rmd +++ b/inst/rmarkdown/templates/transmissibility/skeleton/rmdchunks/i2extras.Rmd @@ -141,7 +141,7 @@ This section contains: ```{r } res_R_wl <- last_trends %>% - mutate(R = map(model, epitrix::lm2R0_sample, w = si, 500)) %>% + mutate(R = map(model, epitrix::lm2R0_sample, w = si$prob_dist$d(si_x))) %>% dplyr::select({{ group_var }}, R) %>% unnest(R)