Handling Portfolio Choices: Two-asset HANK (Auclert et al, 2021)
In this example, we solve the two-asset HANK model as presented in Auclert, Bardóczy, Rognlie, and Straub (2021, Appendix B.3 and Appendix E.1). In this model, each heterogeneous household selects an optimal portfolio consisting of liquid and illiquid assets, taking into account a convex portfolio adjustment cost. Additionally, New Keynesian sticky-price firms determine intermediate goods prices, considering Rotemberg-type price adjustment costs, and make dynamic investment decisions with quadratic capital adjustment costs. Labor unions control wages to maximize the average welfare of their members.
This example is employed to showcase the toolbox’s capability in solving complex decision problems with multi-dimensional endogenous state and control variables, as well as a large equilibrium system of equations.
We adhere to the notation, parametrization, and calibration procedure outlined in their original paper. For the detailed derivation of the equilibrium system of equations, we direct readers to the original paper.
The Model
Households
Households are heterogeneous in their Markov labor efficiency (\(e\)), and the initial holding liquid assets (\(b\)) and illiquid assets (\(a\)). They solve the Bellman equation:
where \(\tau_t\) denotes the flat tax rate, \(w_t\) the real wage rate, \(N_t\) the labor hours, \(r_t^b\) and \(r_t^{a}\) the real interest rates for liquid assets and illiquid assets, and \(\Phi_t\) the adjust cost function specified as $\( \Phi_{t}\left(a_{it}, a_{it-1}\right)=\frac{\chi_1}{\chi_2}\left|\frac{a_{it}-\left(1+r_t^a\right) a_{it-1}}{\left(1+r_t^a\right) a_{it-1}+\chi_0}\right|^{\chi_2}\left[\left(1+r_t^a\right) a_{it-1}+\chi_0\right], \)\( with \)\chi_0 > 0\(, \)\chi_1 > 0\(, and \)\chi_2 > 1$.
Households choose consumption (\(c_{it}\)) and a portfolio \(\left(b_{it}, a_{it}\right)\), subject to a borrowing constraint \(a_{it} \geq 0\) and \(b_{it} \geq \underline{b}\) , and supply a uniform labor (\(N_{t}\)) determined by the Labor Unions to accommodate labor demand from the firm. Without loss of generality, the mean of the labor efficiency is normalized to equal to \(1\). Hence \(N\) represents both average labor hours and the total efficiency unit of the labor supply.
Denote the measure that represents the distribution over households states by \(\Gamma_t\), and policy functions by \(g_{c,t},g_{b,t},g_{a,t}\).
The Financial Intermediary
Households deposit both liquid and illiquid asset holdings into a representative financial intermediary. The financial intermediary invests the liquid deposit (\(\int{b_{it}di}\)) to illiquid government bonds at a per unit liquidity transformation cost \(\omega\), so that \(r_t^b = r_t - \omega\) with \(r_t\) denoting realized real interest rate of government bonds at \(t\). The financial intermediary also invests illiquid deposit (\(\int{a_{it}di}\)) into a mutual fund consisting of government bonds and firm equity which implies
where the mutual fund equity share \(\Theta_{pt-1} = \frac{p_{t-1}}{p_{t-1} + B^{g}_{t-1} - B^{h}_{t-1}}\) is determined by equity share price (\(p_{t-1}\)), aggregate government bond \(\left(B^{g}_{t-1}\right)\), and aggregate liquid asset holdings \(\left(B^{h}_{t-1} = \int{b_{it-1}di}\right)\) at \(t-1\). In a perfect foresight equilibrium, the no arbitrage condition implies the equalization of future returns for \(t \geq 1\)
However, the returns of assets at \(t = 0\) may differ due to surprise shocks at \(t = 0\).
Firms
Intermediate goods firms operate a Cobb-Douglas production technology with capital and labor to produce differentiated goods, which are aggregated by competitive final goods firms using a CES aggregator with an elasticity of substitution \(\mu_{p}/\left(\mu_p - 1\right)\). Intermediate goods firms engage in monopolistic competition on the intermediate goods market, make dynamic investment decision subject to a quadratic adjustment cost, and face price adjustment cost of a quadratic form in logs.
The demand, technology and adjustment costs for an intermediate goods firm \(j\) are defined by the following equations:
Product Demand Function:
Production Function:
Capital Adjustment Cost Function:
Price Adjustment Cost Function:
Capital Accumulation Equation:
Dividend Equation:
The firm \(j\) maximizes the discounted value of the dividend flow. In a symmetric equilibrium, firms’ optimal solution can be characterized by the following equations:
The Price Phillips Curve:
Investment Equation:
Valuation Equation
where \(mc_t\) is a short-hand notation for
Marginal Cost Function:
Labor Unions
A competitive labor recruiter aggregates differentiated labor provided by a continuum of monopolistically competitive labor unions. Each labor union \(k\) faces a labor demand function with an elasticity of substitution \(\mu_{w}/\left(\mu_{w} - 1\right)\), and sets nominal wage rates (\(W_{kt}\)) to maximize the average utility of its members, subjective to a quadratic adjustment cost in utils
In a symmetric equilibrium, union’s optimal solution leads to the Wage Phillips Curve:
where \(1 + \pi_t^w = W_t /W_{t-1} = (1 + \pi_t) w_t/w_{t-1}\) is the wage inflation rate at \(t\).
Monetary and Fiscal Policies
The monetary authority implements a Taylor rule with a zero steady state target inflation rate:
where \(m_t\) is a monetary policy shock, and \(r_{\ast}\) and \(Y_{\ast}\) are steady state real interest rate and GDP, respectively.
The nominal, real interest rates and inflation rate are linked through the Fisher equation:
Government runs a balanced budget to maintain a constant debt in real value (\(B^g\)), and sets taxes \(\tau_t\) to finance exogenous purchases (\(G_t\)) and interest payments on bonds:
Market clearing conditions
Asset market clearing:
goods market clearing:
Notice that we have implicitly imposed labor market clearing conditions by using \(N_t\) to denote both labor demand in the firms’ problem and labor supply in the Wage Phillips Curve.
The Equilibrium System of Equations: Transition Path
Given an initial distribution over households states, \(\Gamma_0\), a perfect foresight competitive equilibrium is a sequence of (1) distributions over households states \(\{\Gamma_t\}_{t=0}^{\infty}\), (2) households’ value and policy functions \(\{V_t,g_{c,t},g_{b,t},g_{a,t}\}_{t=0}^{\infty}\), and (3) aggregate quantities and prices \(\{Y_t,K_t,N_t,I_t,\psi^{p}_{t},D_t,B_t^h,w_t,mc_t,p_t,Q_t,\pi_t,\pi_{t}^{w},i_t,r_t,r_t^a,r_t^b,\tau_t\}_{t=0}^{\infty}\) such that
and goods market clearing implied by Walras’s law. The system can be further simplified. See the hmod file below that defines the simplified system of equations.
The Equilibrium System of Equations: Stationary Equilibrium
In a stationary equilibrium with a constant \(\left(Z_t, \pi_t, G_t\right) = \left(z_{\ast}, 0, G_{\ast}\right) \), the equilibrium system of equations, in the order as presented above, reduce to
We will use these equatios for both calibration and the computation of stationary equilibria.
The hmod File
The model can be represented using an hmod file listed below. To maintain consistency, the hmod file predominantly employs the same variable notations and equation representations as those in the model presentation. The file should be self-explanatory, aided by comments within the code.
% The fixed (non-calibrated) parameter values are from Auclert, Bardóczy, Rognlie, and Straub (2021, Appendix B.3)
parameters beta sigma varphi nu chi0 chi1 omega ra r w tau N;
beta = 0.976; % Calibrated Parameter: HANS final calibrated value is 0.977599682193789
sigma = 2.0; % Fixed Parameter
% Note: a typo of varphi in Table B.III: varphi = 2.073 in the table,
% but the actual varphi value in the SSJ code is around 1.713
varphi = 1.713; % Calibrated Parameter: HANS final calibrated value is 1.681157908161363
nu = 1.0; % Fixed Parameter
chi0 = 0.25; % Fixed Parameter
chi1 = 6.416; % Calibrated Parameter: HANS final calibrated value is 6.518415164643450
omega = 0.005; % Fixed Parameter
var_shock e;
shock_trans = [
0.966289 0.033422 0.000289
0.016711 0.966578 0.016711
0.000289 0.033422 0.966289
]; % need this to be the full transition matrix
e = [0.18315644, 0.67277917, 2.47128522];
% State Variable grid
var_state b a;
% For replication, the following grids were used in SSJ
% b = 10.^(linspace(log10(0.25), log10(50+0.25), 50)) - 0.25;
% a = 10.^(linspace(log10(0.25), log10(4000+0.25), 70)) - 0.25;
b = 10.^(linspace(log10(0.25), log10(40+0.25), 50)) - 0.25;
a = 10.^(linspace(log10(0.25), log10(120+0.25), 70)) - 0.25;
% Precompute cash on hand, as it does not change over vfi
var_pre_vfi coh;
coh = (1+ra)*a + (1+r-omega)*b + (1-tau)*w*e*N;
% Declare three choice variables in vfi and provide initial guess
var_policy bp ap c;
initial bp 0.0;
initial ap (1+ra)*a;
initial c (1+r-omega)*b + (1-tau)*w*e*N;
% Compute additional variables from vfi for later use:
% (a) chi is used later in Goods Market Clearing Condition
% (b) uce is used later in the Wage Phillips Curve
var_aux chi uce;
vfi;
% Define constraint equations
chi = (chi1/2)*(ap-(1+ra)*a)^2/((1+ra)*a+chi0);
%c + ap + bp == (1+ra)*a + (1+r-omega)*b + (1-tau)*w*e*N - chi;
c + ap + bp == coh - chi;
% Define the Bellman Equation: note two endogenous state variables (bp,ap)
u = c^(1.0 - sigma)/(1.0 - sigma) - varphi*N^(1.0+nu)/(1.0+nu);
Tv = u + beta*EXPECT(v(bp,ap));
% Define Bound Constraints
bp >= 0.0;
ap >= 0.0;
c >= 1e-8;
% post evaluation after value function iteration
uce = e*(c^(-sigma)); % efficiency unit weighted marginal utility used in Wage Phillips Curve
end;
% Endogenous Aggregate Variables
var_agg r pii Y K N w p d Bh;
% Fixed Parameters
delta = 0.02; % depreciation
epsI = 4.0; % capital adjustment cost parameter
kappap = 0.1; % price adjustment cost parameter
muw = 1.1; % wage market power parameter
kappaw = 0.1; % wage adjustment cost parameter
% Calibration Targets: Six Variables
r = 0.0125; % calibration target
Y = 1.0; % calibration target
K = 10.0; % calibration target
N = 1.00; % calibration target
p = 11.2; % calibration target
Bh = 1.04; % calibration target
% Parameters implied by Calibration Targets
d = 0.14; % d = p*r = 11.2*0.0125 = 0.14
ra = r; % steady state no-arbitrage condition
Bg = 2.8; % Debt/GDP ratio
G = 0.2; % G/GDP ratio
% Calibrated Parameters: 3 preference parameters above and 3 production parameters below
Z = 0.468; % HANKS Final Calibrated Parameters: Z = 0.467789814531232
alpha = 0.33; % HANKS Final Calibrated Parameters: alpha = 0.329949238578680
mup = 1.015; % HANKS Final Calibrated Parameters: mup = 1.015228426395939;
% Parameters implied by Calibration Targets and Calibrated Parameters
mc = 0.9850; % mu = 1/mup
w = 0.66; % w = (1-alpha)*Y/N * mc
% Taylor Rule Parameters
pii = 0.0000; % inflation
phi = 1.5; % Taylor rule
phi_y = 0.0; % Taylor rule
pi_star = 0.0; % Taylor rule
rstar = 0.0125; % Taylor rule
Y_star = 1.0; % Taylor rule
var_agg_shock m_shock;
m_shock = 0.0; % placeholder for monetary shocks
% Calibration Block: Six Calibration Targets (r,Y,K,N,p,Bh) with Six Parameters (beta,varphi,chi1,Z,alpha,mup),
% among which four parameters (varphi,Z,alpha,mup) can be solved analytically.
% Hence, calibration involves an equation solver with two variables and two equilibrium conditions
model_cali(beta, chi1);
% The calibration of mc follows from the following analytical conditions:
% d = rp and d = Y- w N - delta K implies
% rp = Y- w N - delta K so that r (p - K) = Y- w N - ( r + delta) K
% Now use ( r + delta) = mc*alpha*Y/K and w = mc * (1 - alpha) * Y / N to get
% r (p - K) = Y - mc Y so that mc = 1 - r (p - K) / Y;
mc = 1 - r * (p - K) / Y;
mup = 1 / mc; % steady state Price Phillips Curve
alpha = (r + delta) * K / Y / mc; % stead state Valuation Equation: r + delta = mc*alpha*Y/K
Z = Y/(K^alpha*N^(1-alpha)); % production function: Y = Z K^alpha N^(1-alpha)
w = mc * (1 - alpha) * Y / N; % marginal cost function: mc = w/((1-alpha)*Y/N)
ra = r; % no-arbitrage condition
tau = (r*Bg + G)/(w*N); % government budget
% equilibrium conditions
ap + bp == p + Bg; % asset demand = asset supply
Bh == bp; % liquid asset supply = liquid asset demand
% Bound Constraints for Calibrated Parameters
beta <= 1 - 1e-10;
beta >= 1e-10;
chi1 >= 1e-10;
% post evaluation
varphi =((1-tau)*w*uce/muw)/(N.^nu); % Wage Phillips Curve in Steady State
Y_star = Y; % update Y_star in Taylor Rule
end;
% Stationary Equilibrium: An equation solver with two variables and two equilibrium conditions
model_ss(r, Y);
ra = r; % no-arbitrage condition
mc = 1/mup; % steady state Price Phillips Curve
% Infer K from the stead state Valuation Equation: r + delta = mc*alpha*Y/K;
K = mc*alpha*Y/(r + delta);
% Infer N from the production function: Y = z K^alpha N^(1-alpha)
N = (Y/Z/(K^alpha))^(1/(1-alpha));
% Infer w from the marginal cost function: mc = w/((1-alpha)*Y/N)
w = mc*(1-alpha)*Y/N;
% Infer d from I = delta*K and zero steady state price adjustment cost
d = Y - w*N - delta*K;
% Infer p from asset pricing equation
p = d/r;
% Infer tau from government budget
tau = (r*Bg + G)/(w*N);
% equilibrium conditions
ap + bp == p + Bg; % asset demand = asset supply
N == ((1-tau)*w*uce/(varphi*muw)).^(1/nu); % Wage Phillips Curve
% Bound Constraints for Equilibrium Variables
r <= (1/beta - 1 - 1e-10);
Y >= 0.5;
% post evaluation
rstar = r; % update rstar in Taylor Rule
Y_star = Y; % update Y_star in Taylor Rule
pii = pi_star; % exogenously fixed steady state inflation
Bh = bp; % liquid asset
end;
% Transition Path Equilibrium Block: Nine Equations with Nine Unknowns
% The Equation System can be further simplified by utilizing the analytical structure.
% We keep it in the current form for ease of presentation.
model;
ii = rstar + phi*pii(-1) + phi_y*(Y(-1) - Y_star) + m_shock(-1); % Taylor Rule: recall ii was determined from last period
pshare = p(-1)/(p(-1)+Bg-Bh(-1)); % equity share of mutual fund portfolio
ra = pshare*(d+p)/p(-1) + (1- pshare)*(1+r) - 1; % the return of illiquid asset
I = K - (1-delta)*K(-1) + ((K/K(-1) - 1).^2)*K(-1)/(2*delta*epsI); % capital accumulation equation
psip = ((log(1+pii))^2)*Y*mup/((mup - 1)*2*kappap); % price adjustment cost
Q = 1 + (K/K(-1) - 1)/(delta*epsI); % Tobin's Q from the investment equation
tau = (r*Bg + G)/(w*N); % government budget constraint
% equilibrium conditions: 9 equations with 9 unknowns
r == (1.0 + ii)/(1.0 + pii) - 1.0; % Fisher Equation
ap + bp == p + Bg; % asset demand = asset supply
log(1 + pii) + log(w/w(-1)) == kappaw*(varphi*N^(1+nu) - (1-tau)*w*N*uce/muw) + beta*(log(1+pii(+1)) + log(w(+1)/w)); % Wage Phillips Curve
log(1 + pii) == kappap*(w*N/((1-alpha)*Y) - 1/mup) + log(1+pii(+1))*Y(+1)/Y/(1+r(+1)); % Price Phillips Curve
% valuation equation
(1 + r(+1))*(1 + (K/K(-1) - 1)/(delta*epsI)) == alpha*w(+1)*N(+1)/((1-alpha)*K) - (K(+1)/K - (1-delta) + (K(+1)/K - 1).^2/(2*delta*epsI)) + (1 + (K(+1)/K - 1)/(delta*epsI))*K(+1)/K;
Y == Z*(K(-1)^alpha)*(N^(1-alpha)); % production function
d == Y - w*N - I - psip; % dividend equation
0 == (d(+1) + p(+1)) - p*(1.0 + r(+1)); % no-arbitrage equation
bp == Bh; % liquid asset supply = demand
% Bound Constraints for Unknowns
r <= (1/beta - 1 - 1e-10);
pii >= beta - 1.0 + 1e-10; % 1+r <= 1/beta implies 1+pii >=beta*(1+ii)>= beta
N >= 0.5; % tau <=1 implies N > = (r*Bg + G)/w = 0.3556 when r = 0.0125
% post evaluation
goods_mkt = c + I + G + psip + chi + omega*bp - Y; % residual = aggregate demand - aggregate supply;
end;