The goal of pviem is to estimate population-level immunity to poliovirus using routine immunization, live-birth, vaccine-efficacy, and vaccination-schedule data. Its modular workflow supports different administrative and temporal scales and can be adapted to other vaccine-preventable diseases.
You can install the development version of pviem from GitHub with:
# install.packages("devtools")
devtools::install_github("SACEMA/pviem", build_vignettes = TRUE, dependencies = TRUE)This basic example combines synthetic Fakeland boundaries and routine immunization data with literature-derived vaccine efficacy estimates included in the package. It illustrates the workflow; the synthetic country data should not be used to support scientific or public-health decisions.
For a guided introduction, read the vignettes in this order: setup, data requirements, getting started, and the detailed workflow.
library(pviem)
library(dplyr)
config_pviem(admin = c("prov_code", "dist_code"))
immunity_n <- compute_immunity_samples(
n_samples = 5,
ri_data = dummy_yearly_ri_data,
vs_info = prep_dummy_vs_info,
efficacy = prep_dummy_efficacy,
birth_seasonality = dummy_birth_seasonality,
neighbors = get_neighbors(fakeland, admin_cols = c("admin1_code", "admin2_code")),
max_level = 3,
imputation_mode = "stochastic",
sample_mode = "uniform",
seed = 42
) %>%
summarize_immunity_samples() %>%
mutate(type = factor(type, levels = c("mucosal", "humoral")))We can visualize the mean estimate and empirical interval across imputation samples for selected districts. Five samples keep this README example fast but are not sufficient for stable uncertainty estimates; use many more samples in a real analysis.
library(ggplot2)
imm_color_scheme <- c(
mucosal = "#0072B2",
humoral = "#D55E00"
# mucosal = "#66a61e",
# humoral = "#7570b3"
)
immunity_n[
dist_code %in% c("A01", "B01", "C01", "D01") & serotype == "PV1"
] |>
ggplot(aes(x = year, y = .mean, color = type, fill = type)) +
geom_line() +
geom_point(size = .75) +
geom_errorbar(aes(ymin = .lower, ymax = .upper), width = 0.25, linewidth = 0.5) +
facet_wrap(~dist_code, scales = "free_y") +
scale_x_continuous(breaks = scales::breaks_width(2)) +
scale_color_manual(values = imm_color_scheme) +
scale_fill_manual(values = imm_color_scheme) +
theme_minimal() +
labs(
title = "PV1 immunity estimates in some districts of Fakeland",
subtitle = "Mean and empirical 95% interval by birth cohort",
x = "Birth year",
y = "Immunity",
color = "Immunity type",
fill = "Immunity type"
)If you encounter a bug, please file an issue with a minimal reproducible example on GitHub. Feedback from applications to other vaccine-preventable diseases is also welcome.
