Skip to content

Commit

Permalink
Using {epiparameter} instead of {distcrete} to discretise distributio…
Browse files Browse the repository at this point in the history
…n and plot results
  • Loading branch information
CarmenTamayo committed Nov 29, 2023
1 parent 5c983b2 commit 6e1e769
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions inst/rmarkdown/templates/transmissibility/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -400,26 +400,13 @@ si_params <- epiparameter::convert_summary_stats_to_params(
```

```{r}
# do.call() because we want to pass `si_params` names as the name of arguments.
# This is important if params in si_params are not the first arguments of the
# q...() function. For example, if a gamma distribution is define by its shape
# and scale, instead of shape and rate.
si <- do.call(
distcrete,
c(
list(si_dist,
interval = 1,
w = 0
),
si_params
)
)
si_x <- seq(1L, to = si$q(0.999), by = 1L)
si <- epiparameter::discretise(si_epiparameter)
si_x <- seq(1L, to = si$prob_dist$qf(0.999), by = 1L)
```

```{r}
ggplot(
data.frame(delay = si_x, prob = si$d(si_x)),
data.frame(delay = si_x, prob = si$prob_dist$d(si_x)),
aes(x = delay, y = prob)
) +
geom_col(fill = green_grey) +
Expand Down

0 comments on commit 6e1e769

Please sign in to comment.