Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #319: Fixes to Ebola vignette sex-district figures #326

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions vignettes/ebola.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Using `epidist` to estimate stratified delays between symptom onset and positive test for the 2014-2016 Ebola outbreak in Sierra Leone"
description: "A more detailed guide to using the `epidist` R package"
title: "Using epidist to estimate delay between symptom onset and positive test for an Ebola outbreak in Sierra Leone"
description: "A more detailed guide to using the epidist R package"
output:
bookdown::html_document2:
fig_caption: yes
Expand Down Expand Up @@ -405,7 +405,7 @@ draws_sex_pmf <- obs_prep |>

pmf_sex_figure <- draws_sex_pmf |>
ggplot(aes(x = .prediction)) +
geom_bar(aes(y = after_stat(count / sum(count)))) +
geom_bar(aes(y = after_stat(count / ave(count, PANEL, FUN = sum)))) +
seabbs marked this conversation as resolved.
Show resolved Hide resolved
labs(x = "", y = "", title = "Sex-stratified", tag = "B") +
facet_grid(. ~ sex) +
scale_x_continuous(limits = c(0, 30)) +
Expand All @@ -418,8 +418,16 @@ draws_sex_district_pmf <- obs_prep |>
add_predicted_draws(fit_sex_district, ndraws = 1000)

pmf_sex_district_figure <- draws_sex_district_pmf |>
mutate(
district = case_when(
district == "Port Loko" ~ "Port\nLoko",
district == "Western Rural" ~ "Western\nRural",
district == "Western Urban" ~ "Western\nUrban",
.default = district
)
) |>
ggplot(aes(x = .prediction)) +
geom_bar(aes(y = after_stat(count / sum(count)))) +
geom_bar(aes(y = after_stat(count / ave(count, PANEL, FUN = sum)))) +
labs(
x = "PMF with daily censoring and no truncation", y = "",
title = "Sex-district-stratified", tag = "C"
Expand All @@ -431,9 +439,9 @@ pmf_sex_district_figure <- draws_sex_district_pmf |>

(ref:pmf) Posterior predictions of the discrete probability mass function for each of the fitted models.

```{r pmf, fig.cap="(ref:pmf)", fig.height = 9}
```{r pmf, fig.cap="(ref:pmf)", fig.height = 16}
pmf_base_figure / pmf_sex_figure / pmf_sex_district_figure +
plot_layout(heights = c(1, 1.5, 3))
plot_layout(heights = c(1, 1.5, 5.5))
```

### Continuous probability density function
Expand Down Expand Up @@ -474,6 +482,14 @@ draws_sex_district_pdf <- obs_prep |>
add_predicted_draws(fit_sex_district, ndraws = 1000)

pdf_sex_district_figure <- draws_sex_district_pdf |>
mutate(
district = case_when(
district == "Port Loko" ~ "Port\nLoko",
district == "Western Rural" ~ "Western\nRural",
district == "Western Urban" ~ "Western\nUrban",
.default = district
)
) |>
ggplot(aes(x = .prediction)) +
geom_density() +
labs(
Expand All @@ -487,9 +503,9 @@ pdf_sex_district_figure <- draws_sex_district_pdf |>

(ref:pdf) Posterior predictions of the continuous probability density function for each of the fitted models.

```{r pdf, fig.cap="(ref:pdf)", fig.height = 9}
```{r pdf, fig.cap="(ref:pdf)", fig.height = 16}
pdf_base_figure / pdf_sex_figure / pdf_sex_district_figure +
plot_layout(heights = c(1, 1.5, 3))
plot_layout(heights = c(1, 1.5, 5.5))
```

# Conclusion
Expand Down
Loading