Behavioral Economics class incorporates a discussion about *consumption smoothing, *the idea that people prefer gradual changes in consumption over time, and so agents have a smooth relationship between consumption in one period and the next. In fact, it can be shown (with simple log utility functions) that the ratio between consumption today () and consumption tomorrow () is:

Where delta is the “discount rate”, the relative value of today vs tomorrow for the agent.

Below is a simulation I designed to help demonstrate this concept to my class. It shows an agent struggling to optimize a three-period consumption model. We always pause to note how the marginal value of consumption smoothly declines every period, and that the discounted marginal utility is nearly the same each period. (The model simulation residuals are surprisingly large, but nevertheless illustrative.) The simulation output indicates the consumption in each period with the red line, and a good estimate of the other possible consumption points in black.

#Define Terms

delta<-.85

p1<-1

p2<-1

p3<-1

y<-10

#Checking any options inside the constraint or on the constraint

x1<-runif(100000, min=0, max=y/p1)

x2<-runif(100000, min=0, max=(y-p1*x1)/p2)

#Checking only on the constraint. Assumes no leftover resources.

x3<-y-p1*x1-p2*x2

#Typical Utility Function

U<-log(x1)+ delta * log(x2) + delta^2 * log(x3)

U1<-log(x1)

U2<-delta * log(x2) # undiscounted utility of period 2.

U3<-delta^2 * log(x3) # undiscounted utility of period 3.

par(mfrow=c(1,3))

plot(x1, U1, ylim=c(0,2.5))

abline(v=x1[which(U==max(U))], col=”red”)

plot(x2, delta*U2, ylim=c(0,2.5))

abline(v=x2[which(U==max(U))], col=”red”)

plot(x3, delta^3*U3, ylim=c(0,2.5))

abline(v=x3[which(U==max(U))], col=”red”)

x1_star<-x1[which(U==max(U))]

x2_star<-x2[which(U==max(U))]

x3_star<-x3[which(U==max(U))]

x1_star

x2_star

x3_star

delta

#Marginal Utility

1/log(x1_star); 1/log(x2_star); 1/log(x3_star);

#Discounted Marginal Utility

1/log(x1_star); delta*1/log(x2_star); delta^2*1/log(x3_star); #Discounted marginal utilities are nearly identical.

### Like this:

Like Loading...

*Related*

## One thought on “Simulations of Optimization over Time”