26 September 2015

A Detailed Derivation of My Favorite Monetary Model

WARNING: This post contains an excessive amount of math. If you find math unbearable and/or difficult to understand, do not attempt to read this.

A little bit ago, I decided to combine a New Keynesian model with Rotemberg style pricing and a Cash-Credit goods model. Here is a derivation of that model:


Households maximize

$$ U = E_0 \sum^\infty_{t=0} \beta^t \left(\theta \log c^1_t + (1 - \theta) \log c^2_t - \gamma \log n_t \right) $$

subject to

$$ M_{t-1} + R_{t-1} B_{t-1} + W_t n_t = P_t C_t + B_t + M_t + P_t \tau_t $$
$$ M_t \geq P_t c^1_t $$
$$ C_t = c^1_t + c^2_t $$

Where $c^1_t$ is the part of the consumption good that the household buys in the cash market, $c^2_t$ is the part of the consumption good that the household buys in the credit market, $C_t$ is total spending on the consumption good, $W_t$ is the nominal wage rate, $n_t$ is hours worked by the household, $M_t$ is the nominal money supply, $B_t$ is the supply of government bonds, $P_t$ is the price of the consumption good, and $\tau_t$ is lumps sum taxes/transfers from the government.

The households maximization problem can be written as

$$ \mathcal{L} = U + \lambda^0_t \left(M_{t-1} + R_{t-1} B_{t-1} + W_t n_t - P_t C_t - B_t - M_t - P_t \tau_t \right) + \lambda^1_t \left(M_t - P_t c^1_t \right) + \lambda^2_t\left(C_t - c^1_t - c^2_t \right) $$

Solving the Lagrangian gives the following First Order Conditions:

$$ (1) \: \frac{1}{c^2_t} = \beta E_t \frac{1}{c^2_{t+1}} R_t E_t \frac{P_t}{P_{t+1}} $$
$$ (2) \: \frac{W_t}{P_t} = \frac{\gamma}{1 - \theta} \frac{c^2_t}{n_t} $$
$$ (3) \: \frac{\theta}{c^1_t} = \frac{1-\theta}{c^2_t} \left(2 - \frac{1}{R_t}\right) $$
$$ (4) \: M_t = P_t c^1_t $$

Retail Firms

Retail firms maximize profits, $P_t Y_t - \int^1_0 P_t(i) y_t(i) di $ subject to the production technology $ Y_t = \left[\int^1_0 y_t(i)^\frac{\epsilon-1}{\epsilon}di\right]^\frac{\epsilon}{\epsilon-1} $.

Substituting the production technology into the profit function yields

$$ P_t \left[\int^1_0 y_t(i)^\frac{\epsilon-1}{\epsilon}di\right]^\frac{\epsilon}{\epsilon-1} - \int^1_0 P_t(i) y_t(i) di $$

Taking the derivative of this with respect to $y_t(i)$ gives the retail firm's first order condition:

$$ y_t(i) = Y_t \left(\frac{P_t(i)}{P_t}\right)^{-\epsilon}$$

Since the retail firm is perfectly competitive, its profits are equal to zero. We can therefore set profit equal to zero and plug in the first order condition to get the definition of the price level

$$ P_t^{1-\epsilon} = \int^1_0 P_t(i)^{1-\epsilon} $$

Wholesale Firms

There is a continuum of monopolistically competitive wholesale firm who are subject to the quadratic price adjustment cost

$$ \frac{\varphi}{2}\left(\frac{P_t(i)}{P_{t-1}(i)} - 1 \right)^2 Y_t $$

First, each wholesale firm minimizes total costs, $ \frac{W_t}{P_t} n_t(i) $ subject to the production function $y_t(i) = a_t n_t(i)$. This problem can be set up as

$$ \mathcal{L} = -\frac{W_t}{P_t} n_t + mc_t \left( a_t n_t(i) - y_t(i)\right) $$

which yields

$$ (5) \: \frac{W_t}{P_t} = mc_t n_t(i) $$

The Lagrangian multiplier in this problem is the marginal cost of production (hence the name $mc_t$).

Each retail firm now maximizes the expected sum of all future profits which is discounted by the 'stochastic discount factor' with the real interest rate replacing the time preference rate and is subject to the retail firm's demand function, $ y_t(i) = Y_t \left(\frac{P_t(i)}{P_t(i)}\right)^{-\epsilon}$. Since the maximization problem for this is so obscenely long, I won't write it down, I'll just skip to the first order condition.

$$ 0 = (1-\epsilon)\frac{Y_t}{P_t} + \epsilon mc_t \frac{Y_t}{P_t(i)} - \varphi \left(\frac{P_t(i)}{P_{t-1}(i)} - 1 \right)\frac{Y_t}{P_{t-1}(i)} + \beta E_t \left( \frac {c^2_{t+1}}{c^2_t} \right)^{-1}\varphi \left(\frac{P_{t+1}(i)}{P_t(i)} - 1 \right)\frac{P_{t+1}(i) Y_t}{P_t(i)^2} $$

Consider the fact that, since each firm has the same level of technology, the same demand curve, and the price adjustment costs, every firm chooses the same  price. Given this as well as the fact that the rate of inflation, $\pi_t$ is equal to $\frac{P_t}{P_{t-1}}$, the 'New Keynesian Phillips Curve' above can be written as

$$ (6) \: 0 = (1-\epsilon) + \epsilon mc_t - \varphi \pi_t (1 + \pi_t) + \beta E_t \left( \frac {c^2_{t+1}}{c^2_t} \right)^{-1}\varphi\pi_{t+1}(1+\pi_{t+1})\frac{Y_{t+1}}{Y_t} $$


Equations 1-6 can be combined with a description of government policy to complete this model. The money supply and the wage have been rewritten in real terms.

$$ (1) \: \frac{1}{c^2_t} = \beta E_t \frac{1}{c^2_{t+1}} \frac{R_t}{1 + \pi_{t+1}} $$
$$ (2) \: w_t = \frac{\gamma}{1 - \theta} \frac{c^2_t}{n_t} $$
$$ (3) \: \frac{\theta}{c^1_t} = \frac{1-\theta}{c^2_t} \left(2 - \frac{1}{R_t}\right) $$
$$ (4) \: m_t = c^1_t $$
$$ (5) \: w_t = mc_t n_t $$
$$ (6) \: 0 = (1-\epsilon) + \epsilon mc_t - \varphi \pi_t (1 + \pi_t) + \beta E_t \left( \frac {c^2_{t+1}}{c^2_t} \right)^{-1}\varphi\pi_{t+1}(1+\pi_{t+1})\frac{Y_{t+1}}{Y_t} $$
$$ (7) \: \log R_t = \frac{\beta - 1}{\beta} + \phi_\pi \pi_t + \upsilon_t $$
$$ (8) \: \log a_t = \rho \log a_{t-1} + \varepsilon^a_t $$
$$ (9) \: Y_t  = C_t + \varphi \pi_t^2 Y_t $$
$$ (10) \: C_t = c^1_t + c^2_t $$
$$ (11) \: \upsilon_t = \rho \upsilon_{t-1} + \varepsilon^i_t; $$

Impulse Response Functions

Here is the impulse response function (in log deviations from steady state) for the technology shock, $\varepsilon^a_t$ where $V$ is the velocity of money:
And here is the impulse response function for the monetart policy shock, $\varepsilon^i_t$:


  1. John, I'm far from being a math wiz, but I'm not unduly intimidated after looking this over, so I'd like to understand more fully what's going on here. I'm also not any kind of expert on economics, and rarely spend much time giving sets of macro model formulas a second glance (well, except on Jason's blog, and maybe Nick Edmonds a time or two, and Nick Rowe's simple ones sometimes). I'm happy to see that you've defined some of the symbols, but it seems not all of them. Can you recommend a good glossary to find definitions for all the symbols you're using? For example: beta, theta, Eo (an expectation operator?), gamma, etc. The lambdas are the Lagrange multipliers I suppose.

    Anyway, I'd love to dig into one of these models and really try to understand it someday, and since this is "your favorite monetary model" perhaps I'll give this one a shot.

    I'm pretty slow and clunky at deciphering math, but I can usually slog through eventually.

    Also, not a biggy, but I think you've got a typo here:

    "Taking the solving the Lagrangian gives the following First Order Conditions:"

    Also a request to think about: perhaps you could add a search box (like in the bottom right hand column of Jason's blog)?

    OK, I've been looking through more of your posts, and this looks like good stuff!

    1. Tom,

      When it comes to parameters in models, there are a few standard conventions, but the choice of Greek letter is often up to the author and somewhat arbitrary.

      Typically, beta is known as the discount factor -- the amount that the agent discounts future utility compared to current utility. If the discount factor is, for example, 0.99, then future utility will count 0.99 times as much to the agent as current utility.

      In this case, theta is simply a generic parameter, but it is common to see either theta or sigma being attached to consumption in utility functions.

      Capital E's in economics are almost always rational expectations operators and the lambda's are indeed Lagrange multipliers.

      I fixed the typo, thanks. I'll look into adding a search box. I'm glad you like my posts so far!