# A heterogeneous agent new Keynesian model¶

We now apply the Reiter method to solve a heterogeneous agent new Keynesian model. This is a rather large departure from the preceding models, but this only requires small extensions of the methods.

## Model assumptions¶

*Commodities.* Households consume a final good that is produced out of a
range of intermediate goods. The intermediate goods are produced out of
labor.

*Preferences.* We assume the same preferences as before

*Endowments.* We will endogenize the labor market transitions in the
form of unemployment spells with an exogenous job-separation rate and an
endogenous job-finding rate. The we’ll assume all workers have the same
productivity so aggregate labor supply is \(1-u\) where \(u\) is
the unemployment rate.

*Technology.* Intermediate variety \(j\) is produced according to

where \(A_t\) is an aggregate productivity and \(N_{j,t}\) is the labor employed by firm \(j\). The final good is produced as a Dixit-Stiglitz aggregate of the intermediate inputs

where \(\varepsilon\) is the elasticity of substitution between intermediate varieties.

*Market structure.* The final good is produced by a perfectly
competitive representative firm. The intermediate goods are produced by
monopolistic competitors. The intermediate goods producers are subject
to Calvo-style price adjustment frictions and revise their prices with
probability \(1-\theta\). The labor market is affected by search
frictions, which we model in the style of Blanchard and Gali (2010). We
use the job finding rate, \(M_t\), as a measure of labor market
tightness and firms hire workers at a cost that is increasing in labor
market tightness. The cost of hiring a worker is \(\psi M_t\).
Matches dissolve at the exogenous rate \(\delta\). We will assume
the wage is an increasing function of labor market tightness
\(w_t = \bar w (M_t/\bar M)^\zeta\), where a bar denotes a steady
state value and \(zeta\) is the elasticity of wages with respect to
labor market conditions.

Intermediate goods firms will make profits. We assume that these profits are shared equally among the employed workers. Households can accumulate bonds that pay nominal interest rate \(i_t\) between periods \(t\) and \(t+1\). It will be useful to introduce the ex post real return on bonds \(R_t \equiv (1+i_{t-1})/pi_t\) \(\pi_t\) is the gross inflation rate between \(t-1\) and \(t\).

*Government.* There are three aspects of policy in this economy. First,
there is social insurance: employed workers pay a proportional labor
income tax with rate \(\tau\) and unemployed workers receive an
unemployment benefit in amount \(b\). Second, the government has a
constant (in real terms) stock of debt \(B\) outstanding, which it
rolls over in perpetuity. The interest on the debt is financed by the
labor income tax. Finally, there is a monetary policy in the form of a
rule for the nominal interest rate \(1+i_t = \bar R \pi_t^\omega \xi_t\),
where \(\xi_t\) is a monetary policy shock that follows an AR(1) process in logs.

## Household’s problem¶

The household maximizes

subject to the budget constraint (in real terms)

where earnings are given by

where \(d_t\) is the dividend per employed worker. In addition, the household faces the borrowing constraint \(a' \geq 0\). The transition matrix across employment states is given by

where the first state is unemployed and the second is employed.

## Firm problems¶

The final good firm solves the usual Dixit-Stiglitz cost-minimization problem resulting in a demand for variety \(j\) of

and price index \(P_t\) given by

The intermediate goods firm that updates its price at \(t\) chooses \(p_t^*\) to maximize

where \(n_{j,t}\) denotes employment at firm \(j\) at date \(t\), \(h_{j,t}\) denotes hiring, and \(R_{t,s}^{-1}\) denotes the real interest rate discount from period \(s\) back to period \(t\). The constraints on the firm’s problem are

We can form the Lagrangian

The first-order conditions with respect to \(p_t^*\), \(y_{j,s}\), \(n_{j,s}\), and \(h_{j,s}\) are

\(\lambda_{2,s}\) is marginal cost at date \(s\). Rearranging the FOCs yields

Define

These evolve recursively according to

## Equilibrium conditions¶

A fraction \(1-\theta\) of prices are update each period and let the optimal reset price be denoted \(P_t^*\). We then have

where \(\pi_t \equiv P_t / P_{t-1}\).

Integrating across the demands for each variety and using the production function for intermediates we have

The integral on the right-hand side is the efficiency loss due to price dispersion and is equal to one to a first-order approximation so we will ignore it here. This leaves us with the aggregate production function

where \(N_t\equiv\int_0^1 n_{j,t} dj\) is aggregate labor input. Labor market clearing requires \(N_t = 1-u_t\).

Government budget balance (nominal then real):

The aggregate resource constraint is that the final good is used for consumption and hiring costs

where \(H_t\) is aggregate hiring.

The evolution of (un)employment, hiring and the job finding rate are determined as follows

The aggregate output of intermediate producers net of hiring costs is paid in wages and dividends

Integrating the household budget constraint

we can use the other equations of the model to rewrite this equation as bond market clearing

By Walras’s Law we may impose either one of these equations. In some instances I have encountered existence issues imposing the aggregate resource constraint but not when imposing bond market clearing.

## Model summary¶

An equilibrium of the model requires household policy rules for savings \(g_t(a,e)\) and a distribution of wealth \(\Gamma_t(a,e)\) that evolve according to the household’s problem with a job finding rate given by \(M_t\), wage \(w_t\), tax rate \(\tau_t\), and dividends \(d_t\).

In addition, at each date we have a vector of “aggregate” variables \(( M_t, w_t, \tau_t, d_t, Y_t, u_t, i_t, R_t, \pi_t, p_t^A, p_t^B )\). These variables must satisfy

and the exogenous processes

## Solving the model with the Reiter method¶

We again create a large system of equations involving the household decision rules, the distribution of wealth, and aggregate variables. The equations include the Euler equation residuals, the evolution of the distribution of wealth and the equations above will be our aggregate equations in our system. Implementing this solution requires only a few modifications to our previous Reiter method code.

The transitions across employment states now depend on the endogenous job finding rate \(M_t\) and this must be incorporated into the Euler equation and the dynamics of the distribution of wealth. It may seem natural to keep track of the distribution of wealth as the current savings and employment status. If you do that, notice that the timing of the distribution of wealth is different from the Aiyagari/Krusell-Smith model considered before. In that model, the distribution of state variables at the beginning of period \(t\) is determined in \(t-1\). Here, however, the distribution of assets is determined at \(t-1\), but the distribution of households over employment status is determined at \(t\). I find it easier to keep the timing straight if I keep track of the distribution of states at the end of the period \(t-1\) before the employment transitions at the start of period \(t\) have occurred.