Package 'vimpact'

Title: Vaccine Impact Calculation
Description: VIMC IMPACT CALCULATION PACKAGE. This package is mainly for the VIMC Science Team to investigate vaccination impact.
Authors: Rich FitzJohn [aut, cre], Imperial College of Science, Technology and Medicine [cph]
Maintainer: Rich FitzJohn <[email protected]>
License: MIT + file LICENSE
Version: 0.1.3
Built: 2024-10-25 04:47:53 UTC
Source: https://github.com/vimc/vimpact

Help Index


Calculate impact - requires a DB connection to montagu.

Description

This depends on the DB format of VIMC and so is for internal use only.

Usage

calculate_impact(
  con,
  method,
  touchstone,
  modelling_group,
  disease,
  focal_scenario_type,
  baseline_scenario_type,
  focal_vaccine_delivery = NULL,
  baseline_vaccine_delivery = NULL,
  burden_outcomes = c("deaths", "cases", "dalys"),
  countries = NULL,
  is_under5 = FALSE,
  vaccination_years = 2000:2030
)

Arguments

con

Connection to database.

method

Impact method to use one of calendar_year, birth_year, yov_activity_type, yov_birth_cohort.

touchstone

The montagu touchstone to calculate impact for. Either touchstone ID or touchstone name.

modelling_group

The modelling group to calculate impact for.

disease

The disease to calculate impact for.

focal_scenario_type

The focal scenario scenario type e.g. "default"

baseline_scenario_type

The baseline scenario scenario type e.g. "novac"

focal_vaccine_delivery

The focal vaccine delivery methods. This should be a list of lists or NULL if scenario type is novac. Each element of first list needs to specify the vaccination and activity type. e.g. list( list( vaccine = "HepB", activity_type = "routine" ), list( vaccine = "HepB_BD", activity_type = "routine" ) )

baseline_vaccine_delivery

Like 'focal_vaccine_delivery' this should be a list of lists, each element containing vaccination and activity type. If 'baseline_vaccine_delivery' is 'novac' then this should be NULL.

burden_outcomes

List of burden outcomes, defaults to "deaths", "cases" and "dalys".

countries

Vector of countries to get impact for. If NULL then impact calculated for all countries.

is_under5

If TRUE then only include data for age under 5, otherwise calculate impact for all ages

vaccination_years

Years of vaccination of interest, only used for year of vaccination (yov) methods

Value

Impact for this set of parameters.


Calculate impact from a recipe - requires a DB connection to montagu.

Description

This depends on the DB format of VIMC and so is for internal use only.

Usage

calculate_impact_from_recipe(
  con,
  recipe_path,
  method,
  countries = NULL,
  is_under5 = FALSE,
  vaccination_years = 2000:2030
)

Arguments

con

Connection to database

recipe_path

Path to file containing recipe for burden outcome calculation. For more details see vignette("vignette").

method

Impact method to use one of calendar_year, birth_year, yov_activity_type, yov_birth_cohort.

countries

Vector of countries to get impact for. If NULL then impact calculated for all countries.

is_under5

If TRUE then only include data for age under 5, otherwise calculate impact for all ages

vaccination_years

Years of vaccination of interest, only used for year of vaccination (yov) methods

Value

The impact for each row in the recipe


Extract demographic data - all couse mortality, live birth and under5 mortality rate

Description

Extract demographic data - all couse mortality, live birth and under5 mortality rate

Usage

cohort_deaths_all_cause(con, touchstone_pop, cohorts, under_5 = TRUE)

Arguments

con

Database connection

touchstone_pop

Demography touchstone

cohorts

birth cohorts for which to extract data

under_5

whether constrain to under5 mortality


Generate target, fvps, coverage for a touchstone This function pulls vaccination and population data from Montagu database, and transform them into target, coverage and fvps. There are two modes of pulling population data: 1.) through touchstone_pop parameter 2.) through demographic_source parameter touchstone_pop is one of touchstone_demographic_dataset.touchstone; this parameter is null-able, when it is null, touchstone_cov is used demographic_source is one of demographic_source.code; by default it is null, when it is not null, it rulls out touchstone_pop parameter

Description

Replace jenner:::fix_covreage_fvps() function

Usage

extract_vaccination_history(
  con,
  touchstone_cov = "201710gavi",
  touchstone_pop = NULL,
  year_min = 2000,
  year_max = 2100,
  vaccine_to_ignore = c("DTP3", "HepB_BD_home", "none"),
  disease_to_extract = NULL,
  countries_to_extract = NULL,
  gavi_support_levels = c("with", "bestminus"),
  scenario_type = "default",
  external_population_estimates = NULL,
  full_description = FALSE,
  demographic_source = NULL,
  coverage_scenario_type = NULL
)

Arguments

con

Datebase connection

touchstone_cov

Coverage touchstone

touchstone_pop

touchstone_demographic_dataset.touchstone

year_min

extract data from year_min

year_max

extract data to year_max

vaccine_to_ignore

Ignore defined vaccines

disease_to_extract

extract data for specific diseases

countries_to_extract

extract data for specific countries

gavi_support_levels

gavi support levels

scenario_type

scenario type

external_population_estimates

The rationales are 1. we can use external population estimates if any and if necessary; 2. demographic uncertainty not only affects models, but also FVPs. If we are to conduct sensitivity analysis on impact_by_year_of_vaccination, we need to vary population input for adjusting FVPs.

full_description

TRUE if including scenario_descriptions (coverage estimates will be duplicated for scenarios); and FALSE if only providing coverage estimates

demographic_source

Demographic_source.code

coverage_scenario_type

Coverage scenario type. This is particularly useful for a coverage touchstone. Montagu coverage.name follows <disease>:<vaccine>,<activity_type>,<gavi_support_level>:<coverage_scenario_type> It is NULL by default. When it is not null, only pulls coverage.name that contains specified pattern.


Get data from stochastic tables with specified grouping and filters

Description

Can query from cross_all, cross_under5, cohort_all and cohort_under5

Usage

fetch_stochastic_data(
  annex,
  table,
  groups = c("disease", "country", "year"),
  filters = NULL
)

Arguments

annex

Connection to annex db

table

One of cross_all, cross_under5, cohort_all or cohort_under5

groups

Categories to group by for aggregating in query

filters

Filters to apply before aggregation

Value

Mean, 0.025 and 0.975 quantiles for deaths_default, deaths_novac. deaths_impact, dalys_default, dalys_novac, dalys_impact with specified groupings.


Get data from stochastic tables with specified grouping and filters

Description

This will retrieve mean, 0.025 and 0.975 quantiles from cross_all_2019, cross_under5_2019, cohort_all_2019 and cohort_under5_2019. You can pass a set of year groups to initially aggregate over a range of years. Pass individual years to get mean and quantiles for a year alone.d

Usage

fetch_stochastic_data_year_groups(
  annex,
  table,
  groups = c("disease", "country"),
  filters = NULL,
  year_groups = list(c(2000:2019)),
  include_proportion_averted = FALSE
)

Arguments

annex

Connection to annex db

table

One of cross_all, cross_under5, cohort_all or cohort_under5

groups

Categories to group by for aggregating in query, can be any combination of disease and/or country

filters

Filters to apply before aggregation

year_groups

List of year groups to sum over before calculating mean and quantiles. This will sum over all years within range from min & max of each year group. Note that passing a range of years wider than the data itself will only aggregate over the years for which there is data available

include_proportion_averted

If TRUE then calculates mean and quantiles for proportion_deaths_averted = deaths_impact / deaths_novac and for proportion_dalys_averted = dalys_impact / dalys_novac

Value

Mean, 0.025 and 0.975 quantiles for deaths_default, deaths_novac. deaths_impact, dalys_default, dalys_novac, dalys_impact with specified groupings.


Extract demographic data

Description

Extract demographic data

Usage

get_population(
  con,
  touchstone_pop = "201710gavi-5",
  demographic_statistic = "int_pop",
  gender = "Both",
  country_ = NULL,
  year_ = NULL,
  age_ = NULL,
  demographic_source = NULL
)

Arguments

con

Datebase connection

touchstone_pop

Demography touchstone

demographic_statistic

Demographic statistic to extract

gender

Gender codes - "Male", "Female", "Both"

country_

All countries if NULL. Or specify a vector of countries

year_

All years if NULL. Or specify a vector of years

age_

All age groups if NULL. Or specify a vector of age groups

demographic_source

one of demographic_source.code, this works for IU where demography is not a model run version


Determine touchstone

Description

Find latest touchstone given touchstone_name

Usage

get_touchstone(con, touchstone_name)

Arguments

con

Database connection.

touchstone_name

touchstone_name


Determine touchstone id

Description

Find latest touchstone if touchstone name is provided

Usage

get_touchstone_id(con, touchstone)

Arguments

con

Database connection.

touchstone

touchstone name or id


Calculate impact by birth year (lifetime impact)

Description

The birth year method accounts for the long-term impact accrued over the lifetime of a particular birth cohort. The duration of modelling needs to be appropriate to the pathogen of interest as in some cases, such as HepB, disease occurs later in life. For example if we model vaccination for birth cohorts born from 2000 to 2030 and model disease burden until 2100 we do not account for the vaccine impact for those born in 2030 once they are over 70 years old. The method also does not specifically account for the impact of vaccinating a cohort outside the cohort vaccinated (e.g. because of herd protection).

Usage

impact_by_birth_year(baseline_burden, focal_burden)

Arguments

baseline_burden

Data frame of baseline burden data this needs to have columns country, burden_outcome, year, age, value

focal_burden

Data frame of focal burden data this needs to have columns country, burden_outcome, year, age, value

Value

Vaccine impact by country and birth year for burden outcomes as a data frame with columns country, year, burden_outcome and impact


Calculate impact by calendar year

Description

Calculate impact accrued over all ages for a specific year. This calculates the difference in disease burden between baseline and focal scenarios for a given year. The baseline scenario can have no vaccination or different coverage to the focal scenario. This aggregates the impact over all ages modelled. This does not account for the future disease burden averted through current vaccine activities.

Usage

impact_by_calendar_year(baseline_burden, focal_burden)

Arguments

baseline_burden

Data frame of baseline burden data this needs to have columns country, burden_outcome, year, age, value

focal_burden

Data frame of focal burden data this needs to have columns country, burden_outcome, year, age, value

Value

Vaccine impact by country and year for burden outcomes as a data frame with columns country, year, burden_outcome and impact


Calculate impact by year of vaccination: activity type

Description

Impact by year of vaccination with impact ratio stratified by activity type. Stratifying impact ratio by activity type captures the differing effects of routine and campaign vaccination.

Usage

impact_by_year_of_vaccination_activity_type(
  baseline_burden,
  focal_burden,
  fvps,
  vaccination_years
)

Arguments

baseline_burden

Data frame of baseline burden data this needs to have columns country, burden_outcome, vaccine_delivery, year, age, value

focal_burden

Data frame of focal burden data this needs to have columns country, burden_outcome, vaccine_delivery, year, age, value

fvps

Data frame of additional FVPs (fully vaccinated persons) of focal compared to baseline scenarios. This needs to have columns country, year, activity_type and fvps. Other columns can be included and will be aggregated over.

vaccination_years

Years of vaccination of interest.

Details

To calculate impact by year of vaccination using impact ratios stratified by activity type, we assume that routine vaccination and campaign vaccination, which target multiple age groups, have different effects; for example due to dosage clustering. Hence, this method produces multiple, activity-specific impact ratios which we then multiply by the number of FVPs (fully vaccinated persons) to calculate impact.

Value

Vaccine impact by country, activity type (routine or campaign), year and burden outcome


Calculate impact by year of vaccination: birth cohort

Description

Impact by year of vaccination with impact ratio stratified by birth cohort. Stratifying impact ratio by birth cohort aims to catch temporal changes in transmission or healthcare.

Usage

impact_by_year_of_vaccination_birth_cohort(
  baseline_burden,
  focal_burden,
  fvps,
  vaccination_years
)

Arguments

baseline_burden

Data frame of baseline burden data this needs to have columns country, burden_outcome, vaccine_delivery, year, age, value

focal_burden

Data frame of focal burden data this needs to have columns country, burden_outcome, vaccine_delivery, year, age, value

fvps

Data frame of FVPs (fully vaccinated persons) needs to have columns country, year, activity_type, fvps other columns can be included and will be aggregated over.

vaccination_years

Years of vaccination of interest.

Details

This method is invariant to activity type. Vaccine effect is assumed to vary over time through birth cohorts. This means that rather than averaging the effect of vaccination over time, we account for the variation in transmission and health of the population. This influences how one year's vaccination may work compared to another. For example, if therapeutic treatments for a disease improve over time, we may expect the impact of vaccination in 2050 to be less than that now as the population is generally healthier.

Value

Vaccine impact by country, activity type (routine or campaign), year and burden outcome


Calculate impact by year of vaccination cohort perspective

Description

This will calculate the impact by year of vaccination by country, birth cohort and burden outcome for a single disease and vaccine.

Usage

impact_by_year_of_vaccination_cohort_perspective(
  raw_impact,
  fvps,
  vaccination_years
)

Arguments

raw_impact

Data frame of raw impact data this needs to have columns country, value, burden_outcome and either year & age or birth_cohort

fvps

Data frame of fully vaccination person data with columns country, fvps and either year & age or birth_cohort

vaccination_years

Years of vaccination of interest

Details

This can take data either by vaccination year and age at vaccination or by birth cohort year.

Value

Impact ratio by country, birth cohort and burden outcome


Calculate impact by year of vaccination country perspective

Description

This will calculate the impact by year of vaccination by country and burden outcome for a single disease and vaccine.

Usage

impact_by_year_of_vaccination_country_perspective(
  raw_impact,
  fvps,
  activity_type,
  vaccination_years
)

Arguments

raw_impact

Data frame of raw impact data this needs to have columns country, value, burden_outcome and either year & age or birth_cohort

fvps

Data frame of fully vaccination person data with columns country, fvps and either year & age or birth_cohort

activity_type

'routine' or 'campaign' activity type

vaccination_years

Years of vaccination of interest

Details

This can take data either by vaccination year and age at vaccination or by birth cohort year.

Value

Impact ratio by country and burden outcome


Impact recipe template

Description

Generate impact recipe template

Usage

recipe_template(template_version = "201710", method)

Arguments

template_version

version can be any VIMC model run - e.g. 201710, 201910

method

method can be any VIMC impact methods - method0, method1, method2a, method2b