Made a note for later work

This commit is contained in:
Alex 2025-11-21 18:02:55 -07:00
parent 353e531d0d
commit 16cf5be64c

View File

@ -22,6 +22,7 @@ MAX_BOUND <- BOUNDS %>% pull(MAX_RATE)
MIN_BOUND <- BOUNDS %>% pull(MIN_RATE) MIN_BOUND <- BOUNDS %>% pull(MIN_RATE)
#Create a proxy data set to simulate with #Create a proxy data set to simulate with
C_VAL <- REG_DATA %>% mutate(Year=Year+(2025-1999)) %>% select(Year,Sex,US_Adj_Death_Rate) C_VAL <- REG_DATA %>% mutate(Year=Year+(2025-1999)) %>% select(Year,Sex,US_Adj_Death_Rate)
#################NOTE YOU NEED TO ADJUST THE SINGLE AGE DEATH RATE DOWN TO MATCH LINCOLN IN SOME WAY
###Mostly Working: Pass in a data frame, with year, sex, and US age adjusted mortality rate. The years should go from the simulation start 2025, to the end roughly 2045. WHAT IS MISSING is to pass the arima results of the US age adjusted mortality rates as applied in Lincoln to replace the age adjusted mortality term. Once that is done, a new simulation will give the age specific mortality rates based on the forecasted Lincoln average rates. ###Mostly Working: Pass in a data frame, with year, sex, and US age adjusted mortality rate. The years should go from the simulation start 2025, to the end roughly 2045. WHAT IS MISSING is to pass the arima results of the US age adjusted mortality rates as applied in Lincoln to replace the age adjusted mortality term. Once that is done, a new simulation will give the age specific mortality rates based on the forecasted Lincoln average rates.
RES <- do.call(rbind,lapply(1:86,function(x){return(predict(MOD[[x]],C_VAL))}))#For each data frame containing each year and sex combination of the forecast, predict the data for each age 0-85. Bind these by row to create a result with ages by row, and year by column RES <- do.call(rbind,lapply(1:86,function(x){return(predict(MOD[[x]],C_VAL))}))#For each data frame containing each year and sex combination of the forecast, predict the data for each age 0-85. Bind these by row to create a result with ages by row, and year by column
RES <- ifelse(TEMP<MIN_BOUND,MIN_BOUND,TEMP) #Make sure the values are not too low to be reasonable estimates RES <- ifelse(TEMP<MIN_BOUND,MIN_BOUND,TEMP) #Make sure the values are not too low to be reasonable estimates