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 |
This depends on the DB format of VIMC and so is for internal use only.
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 )
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 )
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 |
Impact for this set of parameters.
This depends on the DB format of VIMC and so is for internal use only.
calculate_impact_from_recipe( con, recipe_path, method, countries = NULL, is_under5 = FALSE, vaccination_years = 2000:2030 )
calculate_impact_from_recipe( con, recipe_path, method, countries = NULL, is_under5 = FALSE, vaccination_years = 2000:2030 )
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 |
The impact for each row in the recipe
Extract demographic data - all couse mortality, live birth and under5 mortality rate
cohort_deaths_all_cause(con, touchstone_pop, cohorts, under_5 = TRUE)
cohort_deaths_all_cause(con, touchstone_pop, cohorts, under_5 = TRUE)
con |
Database connection |
touchstone_pop |
Demography touchstone |
cohorts |
birth cohorts for which to extract data |
under_5 |
whether constrain to under5 mortality |
Replace jenner:::fix_covreage_fvps() function
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 )
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 )
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. |
Can query from cross_all, cross_under5, cohort_all and cohort_under5
fetch_stochastic_data( annex, table, groups = c("disease", "country", "year"), filters = NULL )
fetch_stochastic_data( annex, table, groups = c("disease", "country", "year"), filters = NULL )
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 |
Mean, 0.025 and 0.975 quantiles for deaths_default, deaths_novac. deaths_impact, dalys_default, dalys_novac, dalys_impact with specified groupings.
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
fetch_stochastic_data_year_groups( annex, table, groups = c("disease", "country"), filters = NULL, year_groups = list(c(2000:2019)), include_proportion_averted = FALSE )
fetch_stochastic_data_year_groups( annex, table, groups = c("disease", "country"), filters = NULL, year_groups = list(c(2000:2019)), include_proportion_averted = FALSE )
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 |
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
get_population( con, touchstone_pop = "201710gavi-5", demographic_statistic = "int_pop", gender = "Both", country_ = NULL, year_ = NULL, age_ = NULL, demographic_source = NULL )
get_population( con, touchstone_pop = "201710gavi-5", demographic_statistic = "int_pop", gender = "Both", country_ = NULL, year_ = NULL, age_ = NULL, demographic_source = NULL )
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 |
Find latest touchstone given touchstone_name
get_touchstone(con, touchstone_name)
get_touchstone(con, touchstone_name)
con |
Database connection. |
touchstone_name |
touchstone_name |
Find latest touchstone if touchstone name is provided
get_touchstone_id(con, touchstone)
get_touchstone_id(con, touchstone)
con |
Database connection. |
touchstone |
touchstone name or id |
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).
impact_by_birth_year(baseline_burden, focal_burden)
impact_by_birth_year(baseline_burden, focal_burden)
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 |
Vaccine impact by country and birth year for burden outcomes as a data frame with columns country, year, burden_outcome and impact
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.
impact_by_calendar_year(baseline_burden, focal_burden)
impact_by_calendar_year(baseline_burden, focal_burden)
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 |
Vaccine impact by country and year for burden outcomes as a data frame with columns country, year, burden_outcome and impact
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.
impact_by_year_of_vaccination_activity_type( baseline_burden, focal_burden, fvps, vaccination_years )
impact_by_year_of_vaccination_activity_type( baseline_burden, focal_burden, fvps, vaccination_years )
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. |
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.
Vaccine impact by country, activity type (routine or campaign), year and burden outcome
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.
impact_by_year_of_vaccination_birth_cohort( baseline_burden, focal_burden, fvps, vaccination_years )
impact_by_year_of_vaccination_birth_cohort( baseline_burden, focal_burden, fvps, vaccination_years )
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. |
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.
Vaccine impact by country, activity type (routine or campaign), year and burden outcome
This will calculate the impact by year of vaccination by country, birth cohort and burden outcome for a single disease and vaccine.
impact_by_year_of_vaccination_cohort_perspective( raw_impact, fvps, vaccination_years )
impact_by_year_of_vaccination_cohort_perspective( raw_impact, fvps, vaccination_years )
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 |
This can take data either by vaccination year and age at vaccination or by birth cohort year.
Impact ratio by country, birth cohort and burden outcome
This will calculate the impact by year of vaccination by country and burden outcome for a single disease and vaccine.
impact_by_year_of_vaccination_country_perspective( raw_impact, fvps, activity_type, vaccination_years )
impact_by_year_of_vaccination_country_perspective( raw_impact, fvps, activity_type, vaccination_years )
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 |
This can take data either by vaccination year and age at vaccination or by birth cohort year.
Impact ratio by country and burden outcome
Generate impact recipe template
recipe_template(template_version = "201710", method)
recipe_template(template_version = "201710", method)
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 |