Population_Study/Scripts/Load_Custom_Functions/Induced_Migration_Functions.r

21 lines
1.5 KiB
R

#Takes the added jobs table and downshift for people living outside of Kemmerer but in Lincoln
LOCAL_WORK_ADJ <- function(DF,MIN_LOCAL,MAX_LOCAL=1){
DF[,-1]<- runif(1,MIN_LOCAL,MAX_LOCAL)*DF[,-1]#Random range people choosing to live outside of Kemmerer assumed to be between 85% and 100%
DF[,-1:-2] <-round(DF[,-1:-2])
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 <- runif(1) #The percentage of the possible growth in industries like restaurants to add compared to the Kemmerer IMPLAN model which understates possible structural growth
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)
}