[1]
import numpy as np

1. Human capital accumulation

Consider a worker living in two periods, t{1,2}t \in \{1,2\}.

In each period she decides whether to work (lt=1l_t = 1) or not (lt=0l_t = 0).

She can not borrow or save and thus consumes all of her income in each period.

If she works her consumption becomes:

ct=whtltiflt=1c_t = w h_t l_t\;\;\text{if}\;\;l_t=1

where ww is the wage rate and hth_t is her human capital.

If she does not work her consumption becomes:

ct=biflt=0c_t = b\;\;\text{if}\;\;l_t=0

where bb is the unemployment benefits.

Her utility of consumption is:

ct1ρ1ρ\frac{c_t^{1-\rho}}{1-\rho}

Her disutility of working is:

γlt\gamma l_t

From period 1 to period 2, she accumulates human capital according to:

h2=h1+l1+{0with prob. 0.5Δwith prob. 0.5\begin{aligned} h_2 &= h_1 + l_1 + \begin{cases} 0 & \text{with prob. }0.5 \\ \Delta & \text{with prob. }0.5 \end{cases} \end{aligned}

where Δ\Delta is a stochastic experience gain.

In the second period the worker thus solves:

v2(h2)=maxl2c21ρ1ργl2s.t.c2={wh2if l2=1bif l2=0l2{0,1}\begin{aligned} v_{2}(h_{2}) & = \max_{l_{2}} \frac{c_2^{1-\rho}}{1-\rho} - \gamma l_2 \\ & \text{s.t.} & \\ c_{2}& = \begin{cases} w h_2 & \text{if }l_2 = 1 \\ b & \text{if }l_2 = 0 \end{cases} \\ l_{2}& \in \{0,1\} \end{aligned}

In the first period the worker thus solves:

v1(h1)=maxl1c11ρ1ργl1+βE1[v2(h2)]s.t.c1={wh1if l1=1bif l1=0h2=h1+l1+{0with prob. 0.5Δwith prob. 0.5l1{0,1}\begin{aligned} v_{1}(h_{1}) &= \max_{l_{1}} \frac{c_1^{1-\rho}}{1-\rho} - \gamma l_1 + \beta\mathbb{E}_{1}\left[v_2(h_2)\right] \\ \text{s.t.} \\ c_{1}& = \begin{cases} w h_1 & \text{if }l_1 = 1 \\ b & \text{if }l_1 = 0 \end{cases} \\ h_2 &= h_1 + l_1 + \begin{cases} 0 & \text{with prob. }0.5\\ \Delta & \text{with prob. }0.5 \end{cases}\\ l_{1} &\in \{0,1\}\\ \end{aligned}

where β\beta is the discount factor and E1[v2(h2)]\mathbb{E}_{1}\left[v_2(h_2)\right] is the expected value of living in period two.

The parameters of the model are:

[2]
rho = 2
beta = 0.96
gamma = 0.1
w = 2
b = 1
Delta = 0.1

The relevant levels of human capital are:

[3]
h_vec = np.linspace(0.1,1.5,100) 

Question 1: Solve the model in period 2 and illustrate the solution (including labor supply as a function of human capital).

Question 2: Solve the model in period 1 and illustrate the solution (including labor supply as a function of human capital).

Question 3: Will the worker never work if her potential wage income is lower than the unemployment benefits she can get? Explain and illustrate why or why not.

2. AS-AD model

Consider the following AS-AD model. The goods market equilibrium is given by

yt=αrt+vty_{t} = -\alpha r_{t} + v_{t}

where yty_{t} is the output gap, rtr_{t} is the ex ante real interest and vtv_{t} is a demand disturbance.

The central bank's Taylor rule is

it=πt+1e+hπt+byti_{t} = \pi_{t+1}^{e} + h \pi_{t} + b y_{t}

where iti_{t} is the nominal interest rate, πt\pi_{t} is the inflation gap, and πt+1e\pi_{t+1}^{e} is the expected inflation gap.

The ex ante real interest rate is given by

rt=itπt+1er_{t} = i_{t} - \pi_{t+1}^{e}

Together, the above implies that the AD-curve is

πt=1hα[vt(1+bα)yt]\pi_{t} = \frac{1}{h\alpha}\left[v_{t} - (1+b\alpha)y_{t}\right]

Further, assume that the short-run supply curve (SRAS) is given by

πt=πte+γyt+st\pi_{t} = \pi_{t}^{e} + \gamma y_{t} + s_{t}

where sts_t is a supply disturbance.

Inflation expectations are adaptive and given by

πte=ϕπt1e+(1ϕ)πt1\pi_{t}^{e} = \phi\pi_{t-1}^{e} + (1-\phi)\pi_{t-1}

Together, this implies that the SRAS-curve can also be written as

πt=πt1+γytϕγyt1+stϕst1\pi_{t} = \pi_{t-1} + \gamma y_{t} - \phi\gamma y_{t-1} + s_{t} - \phi s_{t-1}

The parameters of the model are:

[4]
par = {}

par['alpha'] = 5.76
par['h'] = 0.5
par['b'] = 0.5
par['phi'] = 0
par['gamma'] = 0.075

Question 1: Use the sympy module to solve for the equilibrium values of output, yty_t, and inflation, πt\pi_t, (where AD = SRAS) given the parameters (α\alpha, hh, bb, α\alpha, γ\gamma) and yt1y_{t-1} , πt1\pi_{t-1}, vtv_t, sts_t, and st1s_{t-1}.

Question 2: Find and illustrate the equilibrium when yt1=πt1=vt=st=st1=0y_{t-1} = \pi_{t-1} = v_t = s_t = s_{t-1} = 0. Illustrate how the equilibrium changes when instead vt=0.1v_t = 0.1.

Persistent disturbances: Now, additionaly, assume that both the demand and the supply disturbances are AR(1) processes

vt=δvt1+xtst=ωst1+ct\begin{aligned} v_{t} &= \delta v_{t-1} + x_{t} \\ s_{t} &= \omega s_{t-1} + c_{t} \end{aligned}

where xtx_{t} is a demand shock, and ctc_t is a supply shock. The autoregressive parameters are:

[5]
par['delta'] = 0.80
par['omega'] = 0.15

Question 3: Starting from y1=π1=s1=0y_{-1} = \pi_{-1} = s_{-1} = 0, how does the economy evolve for x0=0.1x_0 = 0.1, xt=0,t>0x_t = 0, \forall t > 0 and ct=0,t0c_t = 0, \forall t \geq 0?

Stochastic shocks: Now, additionally, assume that xtx_t and ctc_t are stochastic and normally distributed

xtN(0,σx2)ctN(0,σc2)\begin{aligned} x_{t}&\sim\mathcal{N}(0,\sigma_{x}^{2}) \\ c_{t}&\sim\mathcal{N}(0,\sigma_{c}^{2}) \\ \end{aligned}

The standard deviations of the shocks are:

[6]
par['sigma_x'] = 3.492
par['sigma_c'] = 0.2

Question 4: Simulate the AS-AD model for 1,000 periods. Calculate the following five statistics:

  1. Variance of yty_t, var(yt)var(y_t)
  2. Variance of πt\pi_t, var(πt)var(\pi_t)
  3. Correlation between yty_t and πt\pi_t, corr(yt,πt)corr(y_t,\pi_t)
  4. Auto-correlation between yty_t and yt1y_{t-1}, corr(yt,yt1)corr(y_t,y_{t-1})
  5. Auto-correlation between πt\pi_t and πt1\pi_{t-1}, corr(πt,πt1)corr(\pi_t,\pi_{t-1})

Question 5: Plot how the correlation between yty_t and πt\pi_t changes with ϕ\phi. Use a numerical optimizer or root finder to choose ϕ(0,1)\phi\in(0,1) such that the simulated correlation between yty_t and πt\pi_t comes close to 0.31.

Quesiton 6: Use a numerical optimizer to choose σx>0\sigma_x>0, σc>0\sigma_c>0 and ϕ(0,1)\phi\in(0,1) to make the simulated statistics as close as possible to US business cycle data where:

  1. var(yt)=1.64var(y_t) = 1.64
  2. var(πt)=0.21var(\pi_t) = 0.21
  3. corr(yt,πt)=0.31corr(y_t,\pi_t) = 0.31
  4. corr(yt,yt1)=0.84corr(y_t,y_{t-1}) = 0.84
  5. corr(πt,πt1)=0.48corr(\pi_t,\pi_{t-1}) = 0.48

3. Exchange economy

Consider an exchange economy with

  1. 3 goods, (x1,x2,x3)(x_1,x_2,x_3)
  2. NN consumers indexed by j{1,2,,N}j \in \{1,2,\dots,N\}
  3. Preferences are Cobb-Douglas with log-normally distributed coefficients

    uj(x1,x2,x3)=(x1β1jx2β2jx3β3j)γβij=αijα1j+α2j+α3jαj=(α1j,α2j,α3j)log(αj)N(μ,Σ)\begin{aligned} u^{j}(x_{1},x_{2},x_{3}) &= \left(x_{1}^{\beta_{1}^{j}}x_{2}^{\beta_{2}^{j}}x_{3}^{\beta_{3}^{j}}\right)^{\gamma}\\ \beta_{i}^{j} &= \frac{\alpha_{i}^{j}}{\alpha_{1}^{j}+\alpha_{2}^{j}+\alpha_{3}^{j}} \\ \boldsymbol{\alpha}^{j} &= (\alpha_{1}^{j},\alpha_{2}^{j},\alpha_{3}^{j}) \\ \log(\boldsymbol{\alpha}^j) &\sim \mathcal{N}(\mu,\Sigma) \\ \end{aligned}
  4. Endowments are exponentially distributed,

ej=(e1j,e2j,e3j)eijf,f(z;ζ)=1/ζexp(z/ζ)\begin{aligned} \boldsymbol{e}^{j} &= (e_{1}^{j},e_{2}^{j},e_{3}^{j}) \\ & e_i^j \sim f, f(z;\zeta) = 1/\zeta \exp(-z/\zeta) \end{aligned}

Let p3=1p_3 = 1 be the numeraire. The implied demand functions are:

xij(p1,p2,ej)=βijIjpi\begin{aligned} x_{i}^{\star j}(p_{1},p_{2},\boldsymbol{e}^{j}) &= \beta^{j}_i\frac{I^j}{p_{i}} \\ \end{aligned}

where consumer jj's income is

Ij=p1e1j+p2e2j+p3e3jI^j = p_1 e_1^j + p_2 e_2^j +p_3 e_3^j

The parameters and random preferences and endowments are given by:

[7]
# a. parameters
N = 50000
mu = np.array([3,2,1])
Sigma = np.array([[0.25, 0, 0], [0, 0.25, 0], [0, 0, 0.25]])
gamma = 0.8
zeta = 1

# b. random draws
seed = 1986
np.random.seed(seed)

# preferences
alphas = np.exp(np.random.multivariate_normal(mu, Sigma, size=N))
betas = alphas/np.reshape(np.sum(alphas,axis=1),(N,1))

# endowments
e1 = np.random.exponential(zeta,size=N)
e2 = np.random.exponential(zeta,size=N)
e3 = np.random.exponential(zeta,size=N)

Question 1: Plot the histograms of the budget shares for each good across agents.

Consider the excess demand functions:

zi(p1,p2)=j=1Nxij(p1,p2,ej)eijz_i(p_1,p_2) = \sum_{j=1}^N x_{i}^{\star j}(p_{1},p_{2},\boldsymbol{e}^{j}) - e_i^j

Question 2: Plot the excess demand functions.

Question 3: Find the Walras-equilibrium prices, (p1,p2)(p_1,p_2), where both excess demands are (approximately) zero, e.g. by using the following tâtonnement process:

  1. Guess on p1>0p_1 > 0, p2>0p_2 > 0 and choose tolerance ϵ>0\epsilon > 0 and adjustment aggressivity parameter, κ>0\kappa > 0.
  2. Calculate z1(p1,p2)z_1(p_1,p_2) and z2(p1,p2)z_2(p_1,p_2).
  3. If z1<ϵ|z_1| < \epsilon and z2<ϵ|z_2| < \epsilon then stop.
  4. Else set p1=p1+κz1Np_1 = p_1 + \kappa \frac{z_1}{N} and p2=p2+κz2Np_2 = p_2 + \kappa \frac{z_2}{N} and return to step 2.

Question 4: Plot the distribution of utility in the Walras-equilibrium and calculate its mean and variance.

Question 5: Find the Walras-equilibrium prices if instead all endowments were distributed equally. Discuss the implied changes in the distribution of utility. Does the value of γ\gamma play a role for your conclusions?