Skip to content

Commit

Permalink
print summary table (#70) and use it for threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
avallecam committed May 4, 2024
1 parent 6790a8e commit 711edaa
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions episodes/superspreading-simulate.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ sim_chains_max <-
cases_total = max(cases_cumsum)
) %>%
ungroup()
sim_chains_max
```

Now, we are prepared for using the `{ggplot2}` package:
Expand Down Expand Up @@ -635,18 +637,13 @@ chains_null <- sim_chains_max %>%

Although most introductions of `r initial_cases` index case do not generate secondary cases (N = `r chains_null`) or most outbreaks rapidly become extinct (median duration of `r chains_extinct$extinct_duration_median` and median size of `r chains_extinct$extinct_size_median`), only `r threshhold_summary$chains_theshold` epidemic trajectories among `r threshhold_summary$chains_number` simulations (`r threshhold_summary$chains_percentage`%) can reach to more than 100 infected cases. This finding is particularly remarkable because the reproduction number $R$ is less than 1 (offspring distribution mean of `r mers_offspring[["mean"]]`), but, given an offspring distribution dispersion parameter of `r mers_offspring[["dispersion"]]`, it shows the potential for explosive outbreaks of MERS disease.

For a summary of the total time duration and size of each chain, we can use the `{dplyr}` "combo" of `group_by()` and `summarise()`:
We can count how many chains reached the 100-case threshold using `{dplyr}` functions:

```{r,eval=FALSE}
simulated_chains_day %>%
group_by(chain_id) %>%
summarise(
# duration
day_max = max(day),
# size
cases_total = max(cases_cumsum)
) %>%
ungroup()
```{r}
# number of chains that reached the 100-case threshold
sim_chains_max %>%
arrange(desc(day_max)) %>%
filter(cases_total > 100)
```


Expand Down

0 comments on commit 711edaa

Please sign in to comment.