Type: Package
Title: Vaccine Coverage and Outbreak Risk Analysis
Version: 0.1.0
Description: Provides tools to analyze vaccine coverage data and simulate potential disease outbreak scenarios. It allows users to calculate key epidemiological metrics such as the effective reproduction number (Re), outbreak probabilities, and expected infection counts based on county-level vaccination rates, disease characteristics, and vaccine effectiveness. The package includes historical kindergarten vaccination data for Florida counties and offers functions for generating summary tables, visualizations, and exporting the underlying plot data.
License: GPL (≥ 3)
Encoding: UTF-8
LazyData: true
Imports: dplyr, tidyr, ggplot2, scales, purrr, tibble, openxlsx
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
RoxygenNote: 7.3.2
Depends: R (≥ 3.5)
NeedsCompilation: no
Packaged: 2025-09-10 00:41:47 UTC; TopSoarer
Author: Peiyu Liu [aut, cre], Matt Hitchings [ctb], Ira Longini [ctb]
Maintainer: Peiyu Liu <pyliu0620@outlook.com>
Repository: CRAN
Date/Publication: 2025-09-15 07:30:02 UTC

Calculate the expected number of infections in a cohort

Description

Calculate the expected number of infections in a cohort

Usage

calc_expected_infections(vc, disease, kindergarten_size, VE, r0_custom = NULL)

Arguments

vc

Vaccination coverage rate (proportion, 0 to 1).

disease

Character string: "Measles", "Pertussis", "Chickenpox", or "Custom".

kindergarten_size

Integer, the size of the school cohort.

VE

Vaccine effectiveness (proportion, 0 to 1).

r0_custom

The basic reproduction number (R0) for a custom disease. Required only if 'disease' is "Custom".

Value

The expected number of infected individuals.

Examples

calc_expected_infections(vc = 0.85, disease = "Measles", kindergarten_size = 200, VE = 0.97)
calc_expected_infections(
  vc = 0.90, disease = "Custom", kindergarten_size = 150, VE = 0.90, r0_custom = 7
)

Calculate the effective reproduction number (Re)

Description

Calculate the effective reproduction number (Re)

Usage

calc_re(vc, disease, VE, r0_custom = NULL)

Arguments

vc

Vaccination coverage rate (proportion, 0 to 1).

disease

Character string: "Measles", "Pertussis", "Chickenpox", or "Custom".

VE

Vaccine effectiveness (proportion, 0 to 1).

r0_custom

The basic reproduction number (R0) for a custom disease. Required only if 'disease' is "Custom".

Value

The effective reproduction number (Re).

Examples

# For a standard disease
calc_re(vc = 0.92, disease = "Measles", VE = 0.97)
# For a custom disease like mumps (R0 approx. 10-12)
calc_re(vc = 0.88, disease = "Custom", VE = 0.85, r0_custom = 11)

Kindergarten Vaccination Coverage for Florida Counties

Description

A dataset containing the percentage of kindergarten students who have completed required immunizations for school entry in Florida counties.

Usage

florida_vaccine_coverage

Format

A data frame with 748 rows and 3 variables:

County

The name of the county in Florida, plus a statewide "Florida" total.

Year

The calendar year of the report, from 2016 to 2024.

Coverage_Rate

The proportion (0 to 1) of kindergarten students with complete immunizations.

Source

Florida Department of Health, Bureau of Immunization.


Plot Historical Vaccination Coverage Rate

Description

Plot Historical Vaccination Coverage Rate

Usage

plot_coverage_history(county_name, save_data_to = NULL)

Arguments

county_name

A character vector of county names to plot.

save_data_to

Optional file path to save the plot's data.

Value

A ggplot object.

Examples

plot_coverage_history(county_name = c("Florida", "Miami-Dade", "Liberty"))

Plot Outbreak Probability vs. Coverage

Description

Plot Outbreak Probability vs. Coverage

Usage

plot_outbreak_prob(
  disease = "Measles",
  VE = NULL,
  r0_custom = NULL,
  save_data_to = NULL
)

Arguments

disease

The disease to model. Default is "Measles".

VE

Vaccine effectiveness. If NULL (the default), a sensible default is used for the chosen disease (e.g., 0.97 for Measles). A user-provided value (0 to 1) will override the default.

r0_custom

The basic reproduction number (R0) for a custom disease. Required only if 'disease' is "Custom".

save_data_to

Optional file path to save the plot's data.

Value

A ggplot object.

Examples

# Plot with default VE for Pertussis (~0.85)
plot_outbreak_prob(disease = "Pertussis")
# Override default VE for Pertussis
plot_outbreak_prob(disease = "Pertussis", VE = 0.91)

Plot the Risk Curve of Expected Infections

Description

Plot the Risk Curve of Expected Infections

Usage

plot_risk_curve(
  disease = "Measles",
  kindergarten_size = 200,
  VE = NULL,
  r0_custom = NULL,
  save_data_to = NULL
)

Arguments

disease

The disease to model. Default is "Measles".

kindergarten_size

The size of the school cohort. Default is 200.

VE

Vaccine effectiveness. If NULL (the default), a sensible default is used for the chosen disease (e.g., 0.97 for Measles). A user-provided value (0 to 1) will override the default.

r0_custom

The basic reproduction number (R0) for a custom disease. Required only if 'disease' is "Custom".

save_data_to

Optional file path to save the plot's underlying data.

Value

A ggplot object.

Examples

# Plot with default VE for Pertussis (~0.85)
plot_risk_curve(disease = "Pertussis")
# Plot for a custom disease, requires VE and r0_custom
plot_risk_curve(disease = "Custom", VE = 0.85, r0_custom = 12)

Calculate the probability of a major outbreak

Description

Calculate the probability of a major outbreak

Usage

prob_major_outbreak(Re)

Arguments

Re

The effective reproduction number.

Value

The probability of a major outbreak (1 - 1/Re).

Examples

prob_major_outbreak(Re = 2.05)

Calculate the probability of at least one secondary infection

Description

Calculate the probability of at least one secondary infection

Usage

prob_sec_case(Re)

Arguments

Re

The effective reproduction number.

Value

The probability of at least one secondary infection.

Examples

prob_sec_case(Re = 2.05)

Summarize Vaccination Coverage for a Given Year

Description

Retrieves and sorts the vaccination coverage rates for all Florida counties for a specified year.

Usage

summary_coverage(yr)

Arguments

yr

The year to summarize (e.g., 2024).

Value

A tibble with columns 'County' and 'Coverage_Rate' (as a numeric proportion), sorted in descending order of the coverage rate.

Examples

# Get a summary of vaccine coverage for 2024
summary_coverage(yr = 2024)

Generate an Outbreak Risk Simulation Table

Description

Creates a summary table of outbreak risk for a given year. The analysis includes scenarios for the statewide average coverage rate as well as for counties at the minimum, maximum, and quartile coverage rates. This function can model pre-set diseases or a custom disease with a user-specified R0.

Usage

summary_infection_risk(
  yr,
  disease = "Measles",
  kindergarten_size = 200,
  VE = NULL,
  r0_custom = NULL
)

Arguments

yr

The year for the analysis (e.g., 2024).

disease

The disease to model. Choose from "Measles", "Pertussis", "Chickenpox", or "Custom". Default is "Measles".

kindergarten_size

The size of the school cohort. Default is 200.

VE

Vaccine effectiveness. If NULL (the default), a sensible default is used for the chosen disease (e.g., 0.97 for Measles). A user-provided value (0 to 1) will override the default.

r0_custom

The basic reproduction number (R0) for a custom disease. This parameter is required and must be a positive number if 'disease' is set to "Custom".

Value

A data frame containing the formatted risk analysis table.

Examples

# Example 1: Standard analysis for Measles in 2024 (uses default VE of 0.97)
summary_infection_risk(yr = 2024, disease = "Measles")

# Example 2: Analysis for Pertussis, overriding the default VE
summary_infection_risk(yr = 2024, disease = "Pertussis", VE = 0.91)

# Example 3: Analysis for a custom disease (e.g., Mumps-like)
summary_infection_risk(yr = 2024, disease = "Custom", VE = 0.88, r0_custom = 11)