Cao (2020): Continuum versus Finite Agents in Krusell and Smith (1998)

Our toolbox is designed to solve models with only a finite number of agents, or more precisely, a finite number of agent types. However, as noted in Cao (2020), these models are important special cases of fully heterogenous agent models with a continuum of agents subject to both idiosyncratic and aggregate shocks such as the one Krusell and Smith (1998). In particular, when idiosyncratic shocks are perfectly persistent in Krusell-Smith type of models, these models become effectively the finite-agent models that could be solved using our toolbox. In this example, we solve and compare the aggregate outcomes in this special case of the model in Krusell and Smith (1998) to the outcomes in their original model where idiosyncratic shocks are not perfectly persistent.

The Model

There are two representative agents \(h\in\left\{ 1,2\right\}\) in the economy of mass \(\frac{1}{2}\) each. The agents share the same inter-temporal expected utility

\[\mathbb{E}_{0}\left[\sum_{t=0}^{\infty}\beta^{t}\log c_{t}^{h}\right].\]

In each period, the exogenous aggregate state of the economy is a pair of states \(\left(s,i\right)\) where \(s\in\left\{ b,g\right\}\) and \(i\in\left\{ 0,1\right\}\). State \(s\) determines the aggregate productivity \(A(s)\) and aggregate labor supply \(L(s)\). The aggregate production function is Cobb-Douglas:

\[F(s,K,L) = A(s)K^\alpha L^{1-\alpha},\]

where \(K\) and \(L\) are aggregate capital and labor.

State \(i\) determines which agent is employed. If \(i=0\) then agent \(1\) is unemployed and agent \(2\) is employed, and vice versa for \(i=1\). This approximation of a fully idiosyncratic income process using a two agent income process is similar to the approximation in Heaton and Lucas (1996). The employed agent has \(2(1-\upsilon)L(s)\) units of labor and the unemployed agent has \(2\upsilon L(s)\) units of labor. \(\upsilon\) stands for unemployment transfers by the government and is set at \(7\%\).

Markets are incomplete as agents can only invest in capital, subject to short-sale constraint. So the sequential budget constraint of the agents is:

\[\begin{split}&c^h_t + k^h_{t+1} \leq (1-\delta+r_t)k^h_t + w_t l^h_t,\\ &0\leq k^h_{t+1},\end{split}\]

where \(r_t\) and \(w_t\) are market rental rate of capital and wage.

Because the agents’ problems are concave maximization problems, the first-order conditions are necessary and sufficient for optimality. In particular, let \(\lambda^h_t\) denote the Lagrange multiplier on agent \(h\)’s short-sale constraint, then the Euler’s equation and complementary-slackness condition should hold in equilibrium:

\[\begin{split}&\frac{1}{c^h_t} = \beta\mathbb{E}\left[(1-\delta+r_{t+1})\frac{1}{c^h_{t+1}}\right]+\lambda^h_t,\\ &\lambda^h_t k^h_{t+1} = 0.\end{split}\]

In equilibrium, markets for capital and labor clear (and the good market clears by Walras’ law):

\[\begin{split}&K_t = k^1_t + k^2_t,\\ &L_t = l^1_t + l^2_t.\end{split}\]

To solve for recursive equilibrium in this economy, we use aggregate capital \(K_t\) and the wealth share of agent’s 1, \(\omega_t = \frac{k^1_t}{K_t}\), as endogenous state variables.

The gmod file

The model is solved with Cao2020KS.gmod

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
% Parameters
parameters beta delta alpha sigma;
beta=0.99; % discount factor
delta=0.025;
alpha=0.36;
sigma=1.0;
PrintFreq = 10;
SaveFreq = 50;
SIMU_RESOLVE=0; SIMU_INTERP=1;

% States
var_state K X;
XPts = 21;
XMin=0.0;
XMax=1.0;
X=linspace(XMin,XMax,XPts);

KPts = 21;
KMin=5.0;
KMax=50.0;
K=exp(linspace(log(KMin), log(KMax), KPts));

% Shocks
shock_num = 4;

var_shock z e1 e2 L;
% Set the length to be shock_num
z=[0.99 1.01 0.99 1.01];
L=[0.2944 0.3140 0.2944 0.3140];
e1=[0.07*2*L(1) 0.07*2*L(2) 0.93*2*L(1) 0.93*2*L(2)];
e2=[0.93*2*L(1) 0.93*2*L(2) 0.07*2*L(1) 0.07*2*L(2)];

% Any intermediate steps can be done
EZTrans =  [
    0.5250, 0.3500, 0.0312, 0.0938;
    0.0389, 0.8361, 0.0021, 0.1229;
    0.0938, 0.0312, 0.2917, 0.5833;
    0.0091, 0.1159, 0.0243, 0.8507
    ];
% Convert to Pr((z,e)->(z',e'))
EZTrans = reshape(EZTrans,[2 2 2 2]);
ZETrans = permute(EZTrans,[2 1 4 3]);
ZETrans = reshape(ZETrans,[4 4]);
shock_trans = ZETrans;

% Tensor variables
var_tensor r w budget1 budget2;
% Notice use dot operator
r = alpha*z.*(K./L).^(alpha-1);
w = (1-alpha)*z.*(K./L).^alpha;
budget1 = (1-delta+r).*(2*K).*(1-X) + w.*e1;
budget2 = (1-delta+r).*(2*K).*X + w.*e2;

% Endogenous variables, bounds, and initial values
var_policy c1 c2 Kp Xp lambda1 lambda2;
% Set bound of endogenous variable
% note var_tensor can be used (budget1 budget2)
% note scalar defined before can be used (KMax)
inbound c1 0 budget1;
inbound c2 0 budget2;
inbound Kp 1e-12 10*KMax;
inbound Xp 0 1;
inbound lambda1 0 1;
inbound lambda2 0 1;

initial c1 budget1;
initial c2 budget2;
initial Kp (KMin+KMax)/2;
initial Xp 0.5;

var_aux kp1 kp2;

var_interp c1Future c2Future;
initial c1Future budget1
initial c2Future budget2
c1Future = c1;
c2Future = c2;

var_output Xp Kp kp1 kp2;

model;
  % Budget constraints
  kp1 = budget1 - c1;
  kp2 = budget2 - c2;
  
  % Flow marginal utility
  upC1 = c1^-sigma;
  upC2 = c2^-sigma;
  
  % rhs of the Euler equation
  rhs1 = lambda1;
  rhs2 = lambda2;
  
  % Variable with prime is future variable
  r' = alpha*z'*(Kp/L')^(alpha-1);
  % Vector interpolation
  [c1Next',c2Next'] = GDSGE_INTERP_VEC'(Kp,Xp);
  % Note how to use the NDSGE_EXPECT operator
  rhs1 = rhs1 + GDSGE_EXPECT{ beta*(1-delta+r')*c1Next'^(-sigma)/upC1} ;
  rhs2 = rhs2 + GDSGE_EXPECT{ beta*(1-delta+r')*c2Next'^(-sigma)/upC2} ;
  
  equations;
    % Evolution of Kp
    1 - (kp1+kp2)/(Kp*2);
    % Evolution of Xp
    Xp - kp2/(Kp*2);
    1 - rhs1;
    1 - rhs2;
    kp1 / (2*Kp) * lambda1;
    kp2 / (2*Kp) * lambda2;
  end;
end;

simulate;
  num_periods = 10000;
  initial K 10
  initial X 0.5
  initial shock 1
  var_simu kp1 kp2;
  K' = Kp;
  X' = Xp;
end;

Results

The parameters are taken from Krusell and Smith (1998, Section 2). In particular, the discount rate and the production parameters are:

\[\beta=0.99\ \ \ \delta=0.025\ \ \ \alpha=0.36.\]

The aggregate productivity and aggregate labor supply are:

\[\begin{bmatrix}A(b) & A(g)\end{bmatrix}=\begin{bmatrix}0.99 & 1.01\end{bmatrix}\ \ \ \text{and}\ \ \ \begin{bmatrix}L(b) & L(g)\end{bmatrix}=\begin{bmatrix}0.2944 & 0.3140\end{bmatrix},\]

with the transition matrix \(\pi=\left[\pi_{ss'ii'}\right]\), directly taken from Section 2 in Krusell and Smith (1998):

\[\begin{split}\pi=\begin{bmatrix}0.5250 & 0.3500 & 0.0312 & 0.0938\\0.0389 & 0.8361 & 0.0021 & 0.1229\\0.0938 & 0.0312 & 0.2917 & 0.5833\\0.0091 & 0.1159 & 0.0243 & 0.8507\end{bmatrix}\end{split}\]

In this transition matrix, the rows and columns \(\left\{ 1,2,3,4\right\}\) correspond to states \(\left\{ \left(b,0\right),\left(b,1\right),\left(g,0\right),\left(g,1\right)\right\}\).

The following figure shows next period aggregate capital, \(K_{t+1}\) as a function of current period aggregate capital, \(K_t\), in current state \(\left(b,0\right)\), for two different values of \(\omega\): \(\omega=0\) and \(\omega=1\). The figure shows that future aggregate capital depends not only on current aggregate capital but also on current wealth share \(\omega\) of agent \(1\).

../../_images/KpPolicy.png

Given the global solution for the recursive equilibrium of the model, we can also simulate forward and carry out a regression exercise as in Krusell and Smith (1998). From \(10,000\)-period simulation (with the first \(1000\) periods dropped), we obtain the following regression results:

\[\begin{align*} \log K'=0.0438+0.9832\log K; & & R^{2}=0.999223 \end{align*}\]

in good times and

\[\begin{align*} \log K'=0.0167+0.9923\log K; & & R^{2}=0.997372 \end{align*}\]

in bad times. These regression results tell us that, in the simulated paths of the economy, current aggregate capital seems to be a sufficient state variable to forecast future aggregate capital, which Krusell and Smith call an ``approximate aggregation’’ property. However, the figure tells us that this property does not hold globally.

As a comparison, we also solve the Krusell and Smith’s model, with the exact parameters above, but in which idiosyncratic shocks are truly idiosyncratic. We obtain the following regression results:

\[\begin{align*} \log K'=0.0906+0.9631\log K; & & R^{2}=0.999999 \end{align*}\]

in good times

\[\begin{align*} \log K'=0.0807+0.9651\log K; & & R^{2}=0.999999 \end{align*}\]

and in bad times.

The approximate evolution of aggregate capital is not too different in the two-agent economy compared to the Krusell and Smith’s economy. But we observe that the auto-correlation coefficients for log aggregate capital are lower than those in the two-agent economy. The \(R^{2}\) are also slightly higher than in the two-agent economy.

We can also solve the finite-agent version of the model with stochastic discount factors in Krusell and Smith (1998, Section 3). In their model, agents face idiosyncratic shocks that determine their discount factor. The discount factor can be low (\(\underline{\beta}\)) or high (\(\bar{\beta}\)), where:

\[\underline{\beta}=0.9858\ \ \ \text{and}\ \ \ \bar{\beta}=0.9930.\]

The transition from one to the other is determined such that the average duration for individual \(\beta\) is \(50\) years, which corresponds to agents’ lifetime.

In the two-agent version of the model, we assume that each agent’s discount factor follows this stochastic process. But the two agents’ discount factors are perfectly negatively correlated. To simplify the exercise, we assume that the two agents have the same labor productivity, which varies with the aggregate state \(s\). The evolution of the aggregate state is the same as in the previous example. The other aggregate state \(i\) determines the agents’ discount rate (\(i=0\) agent 1 has low discount factor and agent 2 has high discount factor and vice versa for \(i=1\)). The evolution of aggregate state \(i\) is independent of the evolution of aggregate state \(s\).

The following figure shows next period aggregate capital, \(K_{t+1}\) as a function of current period aggregate capital, \(K_t\), in state \(\left(b,0\right)\), for two different values of \(\omega\): \(\omega=0\) and \(\omega=1\). The figure shows that future aggregate capital depends mostly on current aggregate capital and does not vary visibly with the current wealth share \(\omega\) of agent 1.

../../_images/KpPolicyBetas.png

As in the previous example, from \(10,000\)-period simulation (with the first \(1000\) periods dropped), we obtain the following regression results:

\[\begin{align*} \log K'=0.0916+0.9633\log K; & & R^{2}=0.999999 \end{align*}\]

in good times

\[\begin{align*} \log K'=0.0789+0.9662\log K; & & R^{2}=0.999999 \end{align*}\]

and in bad times. Because future aggregate capital depends mostly on current aggregate capital, the fitness of the linear regressions is very high.

As in the previous example, these regression results are comparable to the ones in Krusell and Smith’s model in which the discount rates are truly idiosyncratic:

\[\begin{align*} \log K'=0.0871+0.9662\log K; & & R^{2}=0.999981 \end{align*}\]

in good times and

\[\begin{align*} \log K'=0.0836+0.9670\log K; & & R^{2}=0.999976 \end{align*}\]

in bad times.