Using vaxineR for Outbreak Risk Analysis

library(vaxineR)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

The vaxineR package provides a suite of tools for analyzing kindergarten vaccination coverage data and modeling potential outbreak risks for various diseases. This vignette serves as a detailed guide to its core functionalities.

Included Data: florida_vaccine_coverage

The package comes with a built-in dataset containing annual data from 2016-2024 for all 67 Florida counties, plus the statewide average.

glimpse(florida_vaccine_coverage)
#> Rows: 680
#> Columns: 3
#> $ County        <chr> "Florida", "Florida", "Florida", "Florida", "Florida", "…
#> $ Year          <int> 2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 20…
#> $ Coverage_Rate <dbl> 0.887, 0.898, 0.906, 0.917, 0.933, 0.935, 0.938, 0.937, …

# Let's look at the data for a single county
florida_vaccine_coverage %>%
  filter(County == "Leon")
#> # A tibble: 10 × 3
#>    County  Year Coverage_Rate
#>    <chr>  <int>         <dbl>
#>  1 Leon    2025         0.938
#>  2 Leon    2024         0.945
#>  3 Leon    2023         0.953
#>  4 Leon    2022         0.955
#>  5 Leon    2021         0.937
#>  6 Leon    2020         0.953
#>  7 Leon    2019         0.944
#>  8 Leon    2018         0.952
#>  9 Leon    2017         0.941
#> 10 Leon    2016         0.933

Core Concepts: Smart Defaults

A key feature of vaxineR’s modeling functions (plot_risk_curve, plot_outbreak_prob, summary_infection_risk) is the use of smart defaults for Vaccine Effectiveness (VE).

Let’s see this in action. Here we model Pertussis without specifying VE, so the function uses its default of 85%. Notice the subtitle on the plot confirms this.

plot_outbreak_prob(disease = "Pertussis")

Now, let’s override this default to model a hypothetical, more effective Pertussis vaccine with 92% effectiveness.

plot_outbreak_prob(disease = "Pertussis", VE = 0.92)

Modeling a Custom Disease

You can model any disease by setting disease = "Custom" and providing your own r0_custom and VE. Let’s simulate a mumps-like illness, with an R0 of 11 and a VE of 88%.

summary_infection_risk(
  yr = 2024,
  disease = "Custom",
  VE = 0.88,
  r0_custom = 11
)
#> # A tibble: 6 × 7
#>   Scenario      `Vaccination Coverage` `Effective R (Re)` Susceptible (N = 200…¹
#>   <chr>         <chr>                               <dbl>                  <dbl>
#> 1 Statewide Av… 89.8%                                2.31                     42
#> 2 Minimum       83.4%                                2.93                     54
#> 3 25th Percent… 88.9%                                2.39                     44
#> 4 Median        91.4%                                2.15                     40
#> 5 75th Percent… 93.0%                                2                        37
#> 6 Maximum       96.6%                                1.65                     30
#> # ℹ abbreviated name: ¹​`Susceptible (N = 200)`
#> # ℹ 3 more variables: `Expected Infections` <dbl>,
#> #   `Prob >=1 Secondary Case` <chr>, `Prob Major Outbreak` <chr>

Visualization Functions

plot_coverage_history()

Track the vaccination coverage history for one or more counties.

plot_coverage_history(county_name = c("Florida", "Broward", "Leon"))

plot_risk_curve()

Visualize the non-linear relationship between vaccination coverage and expected infections. This plot shows the “tipping point” where risk escalates rapidly. Here we use the default VE for Measles (97%).

plot_risk_curve(disease = "Measles", kindergarten_size = 200)

Saving Plot Data

To save the data from any plot, simply provide a file path to the save_data_to argument. This creates an Excel file with both data and metadata.

plot_risk_curve(
  disease = "Chickenpox",
  save_data_to = "chickenpox_risk_data.xlsx"
)
#> Plot data and metadata saved to 'chickenpox_risk_data.xlsx'