Population_Study/Scripts/Load_Custom_Functions/Induced_Migration_Functions.r
2025-12-11 17:31:11 -07:00

23 lines
1.3 KiB
R

#Takes the added jobs table and downshift for people living outside of Kemmerer but in Lincoln
#DF <- OPERATOR_MIGRATION
#MIN_LOCAL=0.85
#MAX_LOCAL=1
LOCAL_WORK_ADJ <- function(DF,MIN_LOCAL,MAX_LOCAL=1){
DF <- runif(1,MIN_LOCAL,MAX_LOCAL)*DF#Random range people choosing to live outside of Kemmerer assumed to be between 85% and 100%
DF <-round(DF)
return(DF)
}
#Find the expected total of new induced jobs from TerraPower (Includes construction entering and leaving, and operators entering)
INDUCED_SIMULATION <- function(CONSTRUCTION_MIGRATION,OPERATOR_MIGRATION,INDUCED_MIGRATION_TABLE,ADDED_FROM_BASELINE){
EST_CONST_INDUCED <- round(CONSTRUCTION_MIGRATION* as.numeric(INDUCED_MIGRATION_TABLE[INDUCED_MIGRATION_TABLE$Job_Type=="Construction",2]+ADDED_FROM_BASELINE *INDUCED_MIGRATION_TABLE[INDUCED_MIGRATION_TABLE$Job_Type=="Construction",3]))
EST_CONST_INDUCED[7] <- EST_CONST_INDUCED[7]-sum(EST_CONST_INDUCED) #Make sure the sums are still zero after rounding takes place, if not make the last year make up the difference
#########Induced migration from operating
EST_OP_INDUCED <- round(OPERATOR_MIGRATION * as.numeric(INDUCED_MIGRATION_TABLE[INDUCED_MIGRATION_TABLE$Job_Type=="Operator",2]+ADDED_FROM_BASELINE*INDUCED_MIGRATION_TABLE[INDUCED_MIGRATION_TABLE$Job_Type=="Operator",3]))
INDUCED <- EST_OP_INDUCED +EST_CONST_INDUCED
return(INDUCED)
}