From 89b299161cb5c0f5e1fc7bbe17181f931e443136 Mon Sep 17 00:00:00 2001 From: Degoot-AM Date: Thu, 20 Jun 2024 18:56:27 +0000 Subject: [PATCH] add peak estimation section --- episodes/describe-cases.Rmd | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/episodes/describe-cases.Rmd b/episodes/describe-cases.Rmd index fd266a3e..d5e0884d 100644 --- a/episodes/describe-cases.Rmd +++ b/episodes/describe-cases.Rmd @@ -236,6 +236,26 @@ base::plot(cum_df) + Note that this function preserve grouping, i.e., if the the `incidence2` object contains groups, then it will accumlate the cases accrodingly. +## Peak estimation + +One can estimate the peak --the time with highest number of recorded cases-- using `estimate_peak()` function from the {incidence2} package. +This function employs a bootstrapping method to determine the peak time. + +```{r, message=FALSE, warning=FALSE} +peak <- incidence2::estimate_peak( + dialy_incidence_data, + n = 100, + alpha = 0.05, + first_only = TRUE, + progress = FALSE +) +print(peak) +``` +This example demonstrates how to estimate the peak time using the `estimate_peak()` function at $95%$ +confidence interval and using 100 bootstrap samples. + + + ::::::::::::::::::::::::::::::::::::: challenge ## Challenge 1: Can you do it?