# Tim Miller (tmiller@demog.berkeley.edu) # August 14, 2000 # # Econ Module # Simulates the annual consumption decision of households. # Generate consumption, earnings, income, and savings # by age of head, own age, and year (Out1). # Consumption decision is based on time series of # interest rate (In1) and productivity growth rate (In2). # Future needs are weighed against current needs based on expectations # about the future economy and the intertemporal elasticity of # substitution (In3), and the rate of time preference (In4). # Future labor earnings are based on average earnings by age (In5) and # the productivity growth rate. # Expectiations about future mortality can be based either on current # survivorship rates (myopia) or future surivivorship rates (foresight) # (See In6). # Attach Econ and Population Module attach ("/home/davis/lee1/TIM.DATA/Splus.Data.Dirs/econ.module.usa",pos=1) attach ("/home/davis/lee1/TIM.DATA/Splus.Data.Dirs/econ.module.functions",pos=2) attach ("/home/davis/lee1/TIM.DATA/Splus.Data.Dirs/pop.module.usa",pos=3) options(object.size=9e10) # large objects will be created #Economic Parameters # In1 and In2: Productivity growth rate and interest rate series. # 1890 to 1997: Use U.S. historical rates # pre-1890: Use 30 year average (1890-1919) # post-1997: Set prod. growth rate at 1.5% and # interest rate at 3.0% #usa.int.gnp <- read.table("us.int.gnp.txt",header=T) raw.prod.rate <- c(rep(.026,(1889-1800+1)), usa.int.gnp$GNP, rep(.015,(2300-1998+1))) raw.interest.rate <- c(rep(.034,(1889-1800+1)), usa.int.gnp$Interest, rep(.030,(2300-1998+1))) # Smooth the time-series using 31 year span # 15 years on either side of date. prod.rate <- spec.smo(raw.prod.rate,span=31) prod.rate5 <- spec.smo(raw.prod.rate,span=5) # using 5 year span prod.rate11 <- spec.smo(raw.prod.rate,span=11) # using 11 year span interest.rate <- spec.smo(raw.interest.rate,span=31) interest.rate5 <- spec.smo(raw.interest.rate,span=5) # using 5 year span interest.rate11 <- spec.smo(raw.interest.rate,span=11) # using 11 year span # Ultimate values of productivity growth rate and interest rate # are used in forming expectations about these rates ult.prod.rate <- prod.rate[length(prod.rate)] ult.interest.rate <- interest.rate[length(interest.rate)] #In3: Inverse of intertemporal elasticity of substitution gamma <- 1/0.64 #In4: Rate of time preference rho <- 0 # In5: The age profile of average earnings by age in the US for 1997-99 us.earnings <- get("smooth.earnings.percap.1997.99","cps.fica.1999/Data") producer.weights <- c(us.earnings,rep(0,20)) # Inflate earnings based on productivity growth before and after 1998 # This means all results are based on 1998 constant dollars. inflate.earnings <- cumprod(exp(c(0,prod.rate)))[1:run.length] inflate.earnings <- inflate.earnings/inflate.earnings[(1998-1800+1)] # Total earnings in the economy by age of household head total.earnings.matrix <- matrix(0,max.age,run.length) for (time in 1:run.length){ test <- household.array[,,time]*producer.weights*inflate.earnings[time] total.earnings.matrix[,time] <- apply(test,2,sum) } # Earnings per household by age of household head earnings.matrix <- total.earnings.matrix/head.matrix earnings.matrix[is.na(earnings.matrix)] <- 0 # Total number of consumers distributed by age of head consumption.weights <- c(rep(.3,5),rep(.4,5),rep(.6,5),rep(.7,4),rep(1,92)) total.consumers.matrix <- matrix(0,max.age,run.length) for (time in 1:run.length){ test <- household.array[,,time]*consumption.weights total.consumers.matrix[,time] <- apply(test,2,sum) } # Consumers per household by age of head and time consumers.matrix <- total.consumers.matrix/head.matrix # In6: Do households use current survivorship rates (mypoia) or # future rates in assessing the future? myopia.option <- c("no") # Wealth and consumption per household by age of head and year. wealth.matrix <- matrix(0,max.age,(run.length-max.age)) consumption.matrix <- matrix(0,max.age,(run.length-max.age)) sim.dates <- seq(1800,,,(run.length-max.age)) #simulation dates #Initialize wealth and consumption by repeating simulation for 50 years for (cnt in 1:50){ consumption.matrix[,1] <- set.consumption(1,myopia.option) wealth.matrix[22:111,1] <- set.wealth(2)[22:111]* (head.matrix[22:111,1]/head.matrix[22:111,2]) * exp(-interest.rate[1])} for (time in 2:111){ wealth.matrix[,time] <- set.wealth(time) consumption.matrix[,time] <- set.consumption(time,myopia.option)} unix.time({for (time in 112:200){ wealth.matrix[,time] <- set.wealth(time) consumption.matrix[,time] <- set.consumption(time,myopia.option)}}) unix.time({for (time in 201:300){ wealth.matrix[,time] <- set.wealth(time) consumption.matrix[,time] <- set.consumption(time,myopia.option)}}) unix.time({for (time in 301:390){ wealth.matrix[,time] <- set.wealth(time) consumption.matrix[,time] <- set.consumption(time,myopia.option)}}) # Calculate aggregate wealth (Wt), consumption (Ct), # labor income (Ylt), interest income (Yit), # total income (Yt), and savings rate (St). Wt <- apply(head.matrix[,1:390]*wealth.matrix,2,sum) Ct <- apply(head.matrix[,1:390]*consumption.matrix,2,sum) Ylt <- apply(head.matrix[,1:390]*earnings.matrix[,1:390],2,sum) Yit <- Wt*interest.rate[1:390] Yt <- Ylt + Yit St <- (Yt-Ct)/Yt #Out1: Save results for each run. #save("life cycle savings with mortality myopia") save("life cycle savings without mortality myopia")