Open Hanmeng-Xu opened 2 years ago
I am thinking that you might have meant the function update_sus_rasterStack_optimized
?
# popk is the pop in year k and popj is the pop in year j (k < j)
# pkj is the vaccinated proportion of population (taking into consideration deaths, new births, immigration, etc.) between year k and year j
pkj <- raster::overlay(popk, popj, fun = function(x, y){x*(1-((j-k)*mu))/y})
# the waned effectiveness of vaccines received in year k in year j
ve_j_k <- as.numeric(ve_direct(j-k+1))
# year-j-still-protected proportion of population that received vaccines in year k
prob_still_protected_admin1 <- raster::overlay(vacck_admin1, pkj, fun = function(x, y){return(x*y*ve_j_k)})
prob_still_protected_admin2 <- raster::overlay(vacck_admin2, pkj, fun = function(x, y){return(x*y*ve_j_k)})
To me, I think given that we only want to think about the still protected population that received year-k vaccines in year j, we only need to consider the general pop change between year k and j. If the vacc year is more than 5 years ago, we don't need to think about the protected population proportion anymore, so, we also don't need to think about the pop change that happened more than 5 years ago.
In this function, the multiplication is looping through only up to the most recent 5 years (because we know that there is no effect left from the vaccine campaign conducted more than 5 years age), while this does spare us time on looping all the previous vaccine campaign years, but just wondering in this way, whether the population changes in the previous years (more than 5 years ago) are not taken in to account in the calculation?