gpw13 / billionaiRe

Calculate the WHO Triple Billions
https://gpw13.github.io/billionaiRe/
GNU General Public License v3.0
7 stars 4 forks source link

extrapolate_campaign_vector carries values pass the bound fixed in n #20

Closed ElliottMess closed 1 year ago

ElliottMess commented 3 years ago

For instance, if meningitis campaign numerator are as follow:

library(tidyverse)
campaign_num <- tibble(
   meningitis_campaign_num= c(11133831, rep(NA,5),3956618, rep(NA, 7)),
   year = 2010:2023) 

As meningitis vaccination has a 10 years validity, we would expect the values to be carried for 10 years, as the parameter n passed extrapolate_campaign_vector in transform_prev_cmpgn_data suggests. The above data should then look something like meningitis_campaign_num_expected:

campaign_num_expected_data <- campaign_num %>%
   mutate(meningitis_campaign_num_expected = c(rep(11133831, 6), rep(11133831+ 3956618, 5), rep(3956618, 3)),
                meningitis_campaign_num_billionaiRe = billionaiRe:::extrapolate_campaign_vector(meningitis_campaign_num, 10))
ElliottMess commented 3 years ago

The issue identified is coming from the flat extrapolation code that was included. It basically carries the last value to the end of the time series, without any consideration for the . I assume this part of the code was included to avoid having a drop in the number of people reached by campaigns and thus with the overall pathogen value. This leads to an important change in the billions value:

With current data, the prevent billion contribution passes from 12 million to -91 million, so a swing of about 100million.

alicerobson commented 3 years ago

Sounds like a discussion is needed! (Would be a bit worried about reducing by 100 million.....)

ElliottMess commented 3 years ago

Indeed, it would be good to discus to make sure that I am the right track with this.