diff --git a/vignettes/internal-impact.Rmd b/vignettes/internal-impact.Rmd index f38abfd..122483d 100644 --- a/vignettes/internal-impact.Rmd +++ b/vignettes/internal-impact.Rmd @@ -1,7 +1,7 @@ --- title: "Using vimpact for estimating vaccine impact - internal" -author: "Rob Ashton" -date: "2022-02-02" +author: "Rob Ashton, Xiang Li, Katy Gaythorpe" +date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Using vimpact for estimating vaccine impact - internal} diff --git a/vignettes/internal-impact.html b/vignettes/internal-impact.html new file mode 100644 index 0000000..56ffa5f --- /dev/null +++ b/vignettes/internal-impact.html @@ -0,0 +1,628 @@ + + + + + + + + + + + + + + + + +Using vimpact for estimating vaccine impact - internal + + + + + + + + + + + + + + + + + + + + + + + + + + +

Using vimpact for estimating vaccine impact +- internal

+

Rob Ashton, Xiang Li, Katy Gaythorpe

+

2025-02-26

+ + + + +

This vignette describes how to use vimpact to calculate impact as a +member of VIMC. This requires a connection to the montagu database so +can only be used internally. Note that this is all in development and +the interface is likely to change.

+

N.B. For VIMC Rubella models, disease burden is measured in terms of +CRS cases affecting newborns, linked to their pregnant mothers. This is +different from many other diseases (e.g., HepB, measles or YF in this +vignette), where the burden is directly attributed to the infected +individual. Consequently, when you see vimpact outputs for Rubella, +please refer to the following interpretations.

+

a.) Age-specific calendar impact

+

Definition: The disease burden averted for newborns in a given +calendar year, attributed to mothers in specific age groups during that +year. Interpretation: How many CRS related burden are prevented among +newborns, broken down by the age of the mother in the year of +pregnancy.

+

b.) Calendar impact

+

Definition: The total disease burden averted for newborns in a given +calendar year (regardless of the mother’s age). Interpretation: How many +CRS related burden are prevented among newborns overall in that +year.

+

c.) Cohort impact

+

Definition: The disease burden averted for newborns whose mothers +were born in a specific birth year. Interpretation: How many CRS related +burden are prevented among newborns, categorized by the mother’s year of +birth.

+

d.) Impact by year of vaccination

+

Definition: The disease burden averted that is linked to immunization +programs carried out in a particular year. Interpretation: How many CRS +related burden are prevented among newborns, attributed to vaccinations +given in that specific year.

+
+

Impact by calendar year & impact by birth year

+
+

Function interface

+
impact <- vimpact::calculate_impact(
+  con, method = "calendar_year", touchstone = "201910gavi-5",
+  modelling_group = "CDA-Razavi",  disease = "HepB",
+  focal_scenario_type = "default", focal_vaccine_delivery = list(
+    list(vaccine = "HepB_BD", activity_type = "routine"),
+    list(vaccine = "HepB", activity_type = "routine")
+  ),
+  baseline_scenario_type = "novac",
+  burden_outcomes = c("hepb_deaths_acute", "hepb_deaths_dec_cirrh",
+                      "hepb_deaths_hcc"))
+str(impact)
+#> tibble [9,898 × 4] (S3: tbl_df/tbl/data.frame)
+#>  $ country       : chr [1:9898] "AFG" "AFG" "AFG" "AFG" ...
+#>  $ burden_outcome: chr [1:9898] "deaths" "deaths" "deaths" "deaths" ...
+#>  $ year          : int [1:9898] 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 ...
+#>  $ impact        : num [1:9898] 0 0 0 0 0 0 0 53 81 97 ...
+

Or for impact by birth year, use method = "birth_year". +This will get burden_estimate_set ids for the baseline and +focal scenarios for this particular touchstone, modelling group, +disease. Then uses those to pull the burden_estimate data +for specified burden_outcomes. Optionally filtering on +country via countries arg, year via +vaccination_years and under 5 age groups if +is_under5 = TRUE. We then use raw impact from +burden_estimate table and call relevant public facing +impact method. For method = "calendar_year" +impact_by_calendar_year. For +method = "birth_year" +impact_by_birth_year.

+
+
+

Recipe interface

+

Define a recipe either as a csv or using +recipe_template

+
recipe <- data.frame(
+  touchstone = "201910gavi-5",
+  modelling_group = "CDA-Razavi", disease = "HepB",
+  focal = "default:HepB_BD-routine;HepB-routine",
+  baseline = "novac",
+  burden_outcome = "hepb_deaths_acute,hepb_deaths_dec_cirrh,hepb_deaths_hcc;hepb_cases_acute_severe,hepb_cases_dec_cirrh,hepb_cases_hcc;dalys")
+t <- tempfile(fileext = ".csv")
+write.csv(recipe, t, row.names = FALSE)
+

This is a set of properties defining what data we want to extract +from the db e.g. touchstone, modelling_group, +disease, focal and baseline scenarios and +burden_outcome. It captures the same info as the args to +calculate_impact above. Then use the recipe to define meta +data frame

+
meta <- vimpact:::get_meta_from_recipe(default_recipe = FALSE, recipe = t, con = con)
+

And use this to calculate impact

+
old_impact <- vimpact:::get_raw_impact_details(con, meta, "deaths")
+str(old_impact)
+#> 'data.frame':    9898 obs. of  7 variables:
+#>  $ country       : int  104 104 104 104 104 104 104 104 104 104 ...
+#>  $ time          : int  2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 ...
+#>  $ baseline_value: num  5636 5765 5901 6034 6172 ...
+#>  $ focal_value   : num  5636 5765 5901 6015 6075 ...
+#>  $ value         : num  0 0 0 19 97 180 252 312 344 381 ...
+#>  $ index         : int  1 1 1 1 1 1 1 1 1 1 ...
+#>  $ burden_outcome: chr  "deaths" "deaths" "deaths" "deaths" ...
+
+
+
+

Impact by year of vaccination

+
+

Function interface

+

Very similar to examples for calendar year and birth year, to +calculate impact by year of vaccination stratified by activity type +run

+
impact <- vimpact::calculate_impact(
+  con, method = "yov_activity_type", touchstone = "201910gavi-5",
+  modelling_group = "CDA-Razavi",  disease = "HepB",
+  focal_scenario_type = "default", focal_vaccine_delivery = list(
+    list(vaccine = "HepB_BD", activity_type = "routine"),
+    list(vaccine = "HepB", activity_type = "routine")
+  ),
+  baseline_scenario_type = "novac",
+  burden_outcomes = "dalys")
+str(impact)
+#> tibble [4,279 × 8] (S3: tbl_df/tbl/data.frame)
+#>  $ country       : chr [1:4279] "AFG" "AFG" "AFG" "AFG" ...
+#>  $ vaccine       : chr [1:4279] "HepB" "HepB" "HepB" "HepB" ...
+#>  $ activity_type : chr [1:4279] "routine" "routine" "routine" "routine" ...
+#>  $ year          : int [1:4279] 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 ...
+#>  $ burden_outcome: chr [1:4279] "dalys" "dalys" "dalys" "dalys" ...
+#>  $ impact        : num [1:4279] 103859 106575 105852 111953 115165 ...
+#>  $ impact_ratio  : num [1:4279] 0.154 0.154 0.154 0.154 0.154 ...
+#>  $ fvps          : num [1:4279] 676396 694088 689380 729111 750028 ...
+

or use method = "yov_birth_cohort for impact by year of +vaccination stratified by birth cohort. This uses the same logic as +other impact methods but before calling the public facing impact +function it will also extract FVP data from the data base for this +touchstone and vaccine delivery. It then calls either +impact_by_year_of_vaccination_activity_type or +impact_by_year_of_vaccination_birth_cohort to get +impact.

+
+
+

Recipe interface

+

We can re-use the recipe from above and get meta table for this +method

+
meta <- vimpact:::get_meta_from_recipe(default_recipe = FALSE, recipe = t,
+                                      method = "method2a", con = con)
+

Then use this to get raw impact

+
old_raw_impact <- vimpact:::get_raw_impact_details(con, meta, "dalys")
+

Extract the fvp data and map output to required interface

+
fvps <- vimpact::extract_vaccination_history(con, "201910gavi-5", year_min = 2000,
+                                             year_max = 2030,
+                                             disease_to_extract = "HepB")
+#> User defined touchstone version is used.
+#> Converting input coverage data......
+#> Extracted interpolated population.
+#> Extracted raw coverage data...
+#> Transformed coverage data.
+fvps$fvps <- fvps$fvps_adjusted
+fvps$country <- fvps$country_nid
+

Then can use meta, raw_impact and +fvps to calculate impact by year of vaccination

+
old_impact <- vimpact:::impact_by_year_of_vaccination(
+  meta, old_raw_impact, fvps, vaccination_years = 2000:2030)
+str(old_impact)
+#> 'data.frame':    4964 obs. of  27 variables:
+#>  $ country             : int  4 4 4 4 4 4 4 4 4 4 ...
+#>  $ vaccine             : chr  "HepB_BD" "HepB" "HepB_BD" "HepB_BD" ...
+#>  $ activity_type       : chr  "routine" "routine" "routine" "routine" ...
+#>  $ scenario_description: chr  "best-estimates" "best-estimates" "best-estimates" "best-estimates" ...
+#>  $ coverage_set        : int  1750 1751 1750 1750 1751 1751 1751 1751 1751 1751 ...
+#>  $ delivery_id         : int  487 3093 1169 1175 3376 4029 4272 3375 4564 3096 ...
+#>  $ disease             : chr  "HepB" "HepB" "HepB" "HepB" ...
+#>  $ scenario_type       : chr  "default" "default" "default" "default" ...
+#>  $ gavi_support_level  : chr  "with" "with" "with" "with" ...
+#>  $ year                : int  2016 2017 2014 2025 2030 2015 2019 2027 2029 2020 ...
+#>  $ gavi_support        : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...
+#>  $ gender              : chr  "Both" "Both" "Both" "Both" ...
+#>  $ age                 : num  0 0 0 0 0 0 0 0 0 0 ...
+#>  $ target_source       : num  1118424 1131834 1103729 1180725 1188620 ...
+#>  $ coverage_source     : num  0.18 0.66 0.04 0.473 0.749 ...
+#>  $ cohort_size         : num  1118424 1131834 1103729 1180725 1188620 ...
+#>  $ delivery_population : num  1118424 1131834 1103729 1180725 1188620 ...
+#>  $ fvps_source         : num  201316 747010 44149 558483 890514 ...
+#>  $ fvps_adjusted       : num  201316 747010 44149 558483 890514 ...
+#>  $ coverage_adjusted   : num  0.18 0.66 0.04 0.473 0.749 ...
+#>  $ country_nid         : int  4 4 4 4 4 4 4 4 4 4 ...
+#>  $ fvps                : num  201316 747010 44149 558483 890514 ...
+#>  $ time                : num  2016 2017 2014 2025 2030 ...
+#>  $ burden_outcome      : chr  "dalys" "dalys" "dalys" "dalys" ...
+#>  $ impact_ratio        : num  0.154 0.154 0.154 0.154 0.154 ...
+#>  $ impact              : num  30912 114701 6779 85754 136736 ...
+#>  $ index               : int  1 1 1 1 1 1 1 1 1 1 ...
+
+
+
+

Comparison

+

calculate_impact has a very similar interface as a +single row in an impact recipe. The output is slightly different format +but output from previous method can be transformed into same format.

+
country <- dplyr::tbl(con, "country")
+old_impact <- old_impact %>%
+  dplyr::left_join(country, by = c("country" = "nid"), copy = TRUE) %>%
+  dplyr::select(country = id, vaccine, activity_type, year = time,
+                burden_outcome, impact) %>%
+  dplyr::filter(!is.na(impact)) %>%
+  dplyr::arrange(activity_type, country, year, vaccine)
+str(old_impact)
+#> 'data.frame':    4279 obs. of  6 variables:
+#>  $ country       : chr  "AFG" "AFG" "AFG" "AFG" ...
+#>  $ vaccine       : chr  "HepB" "HepB" "HepB" "HepB" ...
+#>  $ activity_type : chr  "routine" "routine" "routine" "routine" ...
+#>  $ year          : num  2007 2008 2009 2010 2011 ...
+#>  $ burden_outcome: chr  "dalys" "dalys" "dalys" "dalys" ...
+#>  $ impact        : num  103859 106575 105852 111953 115165 ...
+

and we can see from a plot that the output is very similar

+
+

HepB

+
htmltools::tags$iframe( 
+  src = "impact_comparisons_hepb.html", 
+  width = "100%", 
+  height = "400", 
+  scrolling = "no", 
+  seamless = "seamless", 
+  frameBorder = "0", 
+  `data-external` = "1" 
+)
+ +
+
+

Measles

+
htmltools::tags$iframe( 
+  src = "impact_comparisons_measles.html", 
+  width = "100%", 
+  height = "400", 
+  scrolling = "no", 
+  seamless = "seamless", 
+  frameBorder = "0", 
+  `data-external` = "1" 
+)
+ +
+
+

Comparisons of HepB, Measles & YF

+

This shows bars of mean difference between old impact & new +impact method for each country for HepB, Measles and YF. Tooltips show +the number of observations and the min and max order of the values. +i.e. an impact of 23432.342 has order 5.

+
htmltools::tags$iframe( 
+  src = "impact_comparisons.html", 
+  width = "100%", 
+  height = "400", 
+  scrolling = "no", 
+  seamless = "seamless", 
+  frameBorder = "0", 
+  `data-external` = "1" 
+)
+ +

There are small differences in impact because of differences in +precision. calculate_impact tries to do large parts of the +aggregation on the database where burden_estimate values +are stored as Postgres real type which has 4 bytes of +storage size and 6 decimal digits of precision. Whereas if we pull this +before aggregation the values are stored in R as doubles which are much +higher precision leading to small differences when aggregated.

+

calculate_impact at the moment won’t be able to generate +impact for you for more than 1 set of scenario comparisons. Next steps +will be to add a wrapper which can take some data like the impact recipe +and call calculate_imapct for multiple scenarios.

+
+
+ + + + + + + + + + + diff --git a/vignettes/using-vimpact.html b/vignettes/using-vimpact.html new file mode 100644 index 0000000..ed98e45 --- /dev/null +++ b/vignettes/using-vimpact.html @@ -0,0 +1,595 @@ + + + + + + + + + + + + + + + + +Using vimpact for estimating vaccine impact + + + + + + + + + + + + + + + + + + + + + + + + + + +

Using vimpact for estimating vaccine +impact

+

Rob Ashton, Xiang Li, Katy Gaythorpe

+

2025-02-26

+ + + +

This vignette describes how to use impact calculation methods used in +VIMC as an external user.

+

N.B. For VIMC Rubella models, disease burden is measured in terms of +CRS cases affecting newborns, linked to their pregnant mothers. This is +different from many other diseases (e.g., HepB, measles or YF in this +vignette), where the burden is directly attributed to the infected +individual. Consequently, when you see vimpact outputs for Rubella, +please refer to the following interpretations.

+

a.) Age-specific calendar impact

+

Definition: The disease burden averted for newborns in a given +calendar year, attributed to mothers in specific age groups during that +year. Interpretation: How many CRS related burden are prevented among +newborns, broken down by the age of the mother in the year of +pregnancy.

+

b.) Calendar impact

+

Definition: The total disease burden averted for newborns in a given +calendar year (regardless of the mother’s age). Interpretation: How many +CRS related burden are prevented among newborns overall in that +year.

+

c.) Cohort impact

+

Definition: The disease burden averted for newborns whose mothers +were born in a specific birth year. Interpretation: How many CRS related +burden are prevented among newborns, categorized by the mother’s year of +birth.

+

d.) Impact by year of vaccination

+

Definition: The disease burden averted that is linked to immunization +programs carried out in a particular year. Interpretation: How many CRS +related burden are prevented among newborns, attributed to vaccinations +given in that specific year.

+
+

Data

+

The simplest possible example is a static model with constant routine +immunisation and a one-off campaign. Burden estimates from a theoretical +country are found in 3 csv titled example_novax_burden.csv, +example_routine_burden.csv and +example_routine_campaign_burden.csv. These include +estimates of burden in years 1900 - 2100 and display the format used by +the functions.

+
example_novax <- read.csv(system.file("extdata/example_novax_burden.csv", package = "vimpact"))
+example_routine <- read.csv(system.file("extdata/example_routine_burden.csv", package = "vimpact"))
+example_routine_campaign <- read.csv(system.file("extdata/example_routine_campaign_burden.csv", package = "vimpact"))
+
+str(example_novax)
+#> 'data.frame':    10201 obs. of  6 variables:
+#>  $ country       : chr  "ABC" "ABC" "ABC" "ABC" ...
+#>  $ year          : int  2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 ...
+#>  $ age           : int  0 1 2 3 4 5 6 7 8 9 ...
+#>  $ value         : int  16 15 14 13 13 12 12 11 11 10 ...
+#>  $ activity_type : chr  "novax" "novax" "novax" "novax" ...
+#>  $ burden_outcome: chr  "deaths" "deaths" "deaths" "deaths" ...
+str(example_routine)
+#> 'data.frame':    10201 obs. of  6 variables:
+#>  $ country       : chr  "ABC" "ABC" "ABC" "ABC" ...
+#>  $ year          : int  2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 ...
+#>  $ age           : int  0 1 2 3 4 5 6 7 8 9 ...
+#>  $ value         : int  16 15 14 13 13 12 12 11 11 10 ...
+#>  $ activity_type : chr  "routine" "routine" "routine" "routine" ...
+#>  $ burden_outcome: chr  "deaths" "deaths" "deaths" "deaths" ...
+str(example_routine_campaign)
+#> 'data.frame':    10201 obs. of  6 variables:
+#>  $ country       : chr  "ABC" "ABC" "ABC" "ABC" ...
+#>  $ year          : int  2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 ...
+#>  $ age           : int  0 1 2 3 4 5 6 7 8 9 ...
+#>  $ value         : int  16 15 14 13 13 12 12 11 11 10 ...
+#>  $ activity_type : chr  "campaign" "campaign" "campaign" "campaign" ...
+#>  $ burden_outcome: chr  "deaths" "deaths" "deaths" "deaths" ...
+
+
+

Impact by calendar year (cross-sectional impact)

+

Impact by calendar year calculates 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.

+

To use this method you need to provide a data frame of baseline +impact and a data frame of focal impact for the vaccine of interest for +a given age, year and country.

+

These data frames must contain columns for country, burden_outcome +(e.g. cases, deaths, DALYs), year, age and value. It will sum the values +over all ages for each year and return the impact as the difference +between baseline and focal scenarios for each group.

+

If the baseline and focal impact data contains groups which do not +overlap then this will return impact only for groups contained in both +datasets.

+
calendar_year <- vimpact::impact_by_calendar_year(baseline_burden = example_novax, focal_burden = example_routine_campaign)
+str(calendar_year)
+#> tibble [101 × 4] (S3: tbl_df/tbl/data.frame)
+#>  $ country       : chr [1:101] "ABC" "ABC" "ABC" "ABC" ...
+#>  $ burden_outcome: chr [1:101] "deaths" "deaths" "deaths" "deaths" ...
+#>  $ year          : int [1:101] 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 ...
+#>  $ impact        : int [1:101] 0 0 0 0 0 3 11 18 27 35 ...
+
+
+

Impact by birth year (lifetime impact)

+

When calculating impact by birth year we account for the long-term +impact of vaccination by finding the sum of the difference in burden +between focal and baseline scenarios over the lifetime of a particular +cohort. This can be written as \(D(c, k) = +\sum_{y-a=k}D_{b-f}(a, c, y)\) where \(y \in Y_{m}\) and \(a \in A_{m}\) where \(D\) is the difference in burden, \(b\) is baseline, \(f\) is focal, \(a\) is age, \(c\) is country, \(y\) is year, \(k\) is birth cohort, \(Y_{m}\) are the years modelled and \(A_{m}\) are the ages modelled. This +requires the same data as impact_by_calendar_year. You need +to provide data frames containing baseline and focal impact for the +vaccine of interest for a given age, year and country.

+

These data frames must contain columns for country, burden_outcome +(e.g. cases, deaths, DALYs), year, age and value. It will sum the impact +grouped by country, burden_outcome, and birth year. Where birth year is +year - age. Then calculates the impact for these +groups.

+

If the baseline and focal impact data contains groups which do not +overlap then this will return impact only for groups contained in both +datasets.

+
birth_year <- vimpact::impact_by_birth_year(baseline_burden = example_novax, focal_burden = example_routine_campaign)
+str(birth_year)
+#> tibble [201 × 4] (S3: tbl_df/tbl/data.frame)
+#>  $ country       : chr [1:201] "ABC" "ABC" "ABC" "ABC" ...
+#>  $ burden_outcome: chr [1:201] "deaths" "deaths" "deaths" "deaths" ...
+#>  $ birth_cohort  : int [1:201] 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 ...
+#>  $ impact        : int [1:201] 0 0 0 0 0 0 0 0 0 0 ...
+
birth_year$year <- birth_year$birth_cohort
+birth_year$impact_birth_year <- birth_year$impact
+calendar_year$impact_calendar_year <- calendar_year$impact
+plot_data <- merge(birth_year, calendar_year, by = c("country", "burden_outcome", "year"))
+plot_data$year <- as.Date(paste(plot_data$year, "01", "01", sep = "-"))
+ggplot2::ggplot(plot_data, ggplot2::aes(x = year)) +
+  ggplot2::geom_line(ggplot2::aes(y = impact_birth_year, colour = "birth year")) +
+  ggplot2::geom_line(ggplot2::aes(y = impact_calendar_year, colour = "calendar year")) + 
+  ggplot2::expand_limits(y = 0) + 
+  ggplot2::ylab("Impact") + 
+  ggplot2::xlab("Year")
+

+
+
+

Impact by year of vaccination

+

The final view of impact is by attributing it to the year in which +vaccination took place. Impact by year of vaccination methods are vital +for determining the long-term impact of of vaccination due to activities +carried out in a particular year. We obtain the impact ratio as the +impact attributable per fully vaccinated person (FVP) calculated as the +coverage × cohort size. This ratio can be stratified by different +characteristics, such as birth cohort in order to catch temporal changes +in transmission or healthcare or by activity type to capture the +differing effects of routine and campaign vaccination. The impact ratio +allows effects due to a particular year’s worth of vaccination to be +attributed to that year.

+
+

Impact by year of vaccination: impact ratio stratified by activity +type

+

To calculate impact by year of vaccination with impact ratio +stratified by activity type use function +impact_by_year_of_vaccination_activity_type. You need to +provide 3 data frames. Like the previous two impact methods this needs a +data frame of baseline impact and focal impact. These must contain the +same columns as in the previous two methods with the addition of a +column for the activity_type of the vaccination - either +routine or campaign.

+

You also need to provide a data frame of FVP (fully vaccinated +person) data which contains country, year, activity type, age and fvp. +And a set of vaccination_years which is a range of years +for which you want calculate impact for. This will be used to filter the +baseline impact, focal impact and FVPs.

+

This method produces impact values for a particular disease +stratified by country, activity type, year and burden outcome.

+
example_fvps <- read.csv(system.file("extdata/example_fvps.csv", package = "vimpact"))
+
+routine <- vimpact::impact_by_year_of_vaccination_activity_type(baseline_burden = example_novax, focal_burden = example_routine, fvps = example_fvps[example_fvps$activity_type == "routine",], 2000:2030)
+
+campaign <- vimpact::impact_by_year_of_vaccination_activity_type(baseline_burden = example_routine, focal_burden = example_routine_campaign, fvps = example_fvps[example_fvps$activity_type == "campaign",], 2000:2030)
+
+activity_type <- rbind(routine, campaign)
+str(activity_type)
+#> tibble [35 × 8] (S3: tbl_df/tbl/data.frame)
+#>  $ country       : chr [1:35] "ABC" "ABC" "ABC" "ABC" ...
+#>  $ vaccine       : chr [1:35] "YF" "YF" "YF" "YF" ...
+#>  $ activity_type : chr [1:35] "routine" "routine" "routine" "routine" ...
+#>  $ year          : int [1:35] 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 ...
+#>  $ burden_outcome: chr [1:35] "deaths" "deaths" "deaths" "deaths" ...
+#>  $ impact        : num [1:35] 184 323 404 478 479 ...
+#>  $ impact_ratio  : num [1:35] 0.168 0.168 0.168 0.168 0.168 ...
+#>  $ fvps          : int [1:35] 1090 1919 2397 2838 2842 4008 2971 2310 1494 2996 ...
+
+
+

Impact by year of vaccination: impact ratio stratified by birth +cohort

+

Impact by year of vaccination can be stratified by birth cohort to +catch temporal changes in transmission or healthcare. This method is +invariant to vaccination activity type. However, vaccine effect is +assumed to vary over time through birth cohorts.

+

This method requires basline impact, focal impact and FVPs +disaggregated by country, burden outcome, year and age. The data doesn’t +have to be disaggregated by activity_type. This returns +impact for a particular vaccine by country, year and burden outcome.

+
cohort_type <- vimpact::impact_by_year_of_vaccination_birth_cohort(baseline_burden = example_novax, focal_burden = example_routine_campaign, fvps = example_fvps, 2000:2030)
+str(cohort_type)
+#> tibble [35 × 7] (S3: tbl_df/tbl/data.frame)
+#>  $ country       : chr [1:35] "ABC" "ABC" "ABC" "ABC" ...
+#>  $ year          : int [1:35] 2013 2018 2019 2020 2021 2022 2023 2024 2004 2005 ...
+#>  $ burden_outcome: chr [1:35] "deaths" "deaths" "deaths" "deaths" ...
+#>  $ vaccine       : chr [1:35] "YF" "YF" "YF" "YF" ...
+#>  $ activity_type : chr [1:35] "campaign" "campaign" "campaign" "campaign" ...
+#>  $ impact        : num [1:35] 619 868 1314 1348 1891 ...
+#>  $ fvps          : int [1:35] 9987 12378 18313 18310 25002 24999 24997 26681 1090 1919 ...
+
activity_sum <- stats::aggregate(impact ~ country + year + burden_outcome,
+                                 activity_type, sum)
+cohort_sum <- stats::aggregate(impact ~ country + year + burden_outcome,
+                                 cohort_type, sum)
+activity_sum$impact_activity_strat <- activity_sum$impact
+cohort_sum$impact_cohort_strat <- cohort_sum$impact
+plot_data <- merge(activity_sum, cohort_sum, by = c("country", "burden_outcome", "year"))
+plot_data$year <- as.Date(paste(plot_data$year, "01", "01", sep = "-"))
+ggplot2::ggplot(plot_data, ggplot2::aes(x = year)) +
+  ggplot2::geom_line(ggplot2::aes(y = impact_cohort_strat, colour = "cohort")) +
+  ggplot2::geom_line(ggplot2::aes(y = impact_activity_strat, colour = "activity")) +
+  ggplot2::expand_limits(y = 0) + 
+  ggplot2::ylab("Impact") + 
+  ggplot2::xlab("Year")
+

+
+
+
+

Glossary

+

All definitions and terminology can be found in the associated +manuscript available at: https://www.medrxiv.org/content/10.1101/2021.01.08.21249378v1.full-text +; we include a summary below.

+

FVP - Fully vaccinated person

+

Focal scenario - The vaccination scenario to be assessed in +comparison to a baseline scenario

+

Baseline scenario - The vaccination scenario to be compared against, +often the situation without any vaccination (no-vac)

+

Impact- The effect of vaccination often measure in deaths or cases +averted and calculated as the difference in burden between a focal +scenario and a baseline scenario

+

Impact ratios - The impact per fully vaccinated person

+
+ + + + + + + + + + +