1 Clarida-Gali-Gertler Model: T T t+1 T
1 Clarida-Gali-Gertler Model: T T t+1 T
1 Clarida-Gali-Gertler Model
Following are the equations of the Clarida-Gali-Gertler model.
1
rt∗ = ρ∆at + (1 − λ) τt (natural rate)
1+ϕ
1
yt∗ = at − τt (natural output)
1+ϕ
Pt Ct + Bt+1 ≤ Wt Nt + Rt−1 Bt + Tt ,
where Tt denotes (lump sum) taxes and profits, Pt is the price level, Wt de-
notes the nominal wage rate and Bt+1 denotes bonds purchased at time t
1
which deliver a non-state-contingent rate of return, Rt , in period t + 1. Com-
petitive firms produce a homogeneous output good, Yt , using the following
technology:
∙Z 1 ε
ε−1
¸ ε−1
Yt = Yi,tε di, ε > 1,
0
where Yi,t denotes the ith intermediate good, i ∈ (0, 1) . The competitive firms
takes the price of the final output good, Pt , and the prices of the intermediate
goods, Pi,t , as given and chooses Yt and Yit to maximize profits. This results
in the following first order condition:
à !ε
Pt
Yi,t = Yt .
Pi,t
The producer of Yit is a monopolist which takes the above equation as its
demand curve. The ith intermediate good firm uses labor, Ni,t , to produce
output using the following production function:
where ∆ is the first difference operator and εat is an iid shock. We refer to
the time series representation of at as a ‘unit root’ representation. The ith
firm sets prices subject to Calvo frictions. In particular,
(
P̃t with probability 1 − θ
Pi,t = ,
Pi,t with probability θ
where P̃t denotes the price chosen by the 1 − θ firms that can reoptimize
their price at time t. The ith producer is competitive in labor markets, where
it pays Wt (1 − ν) for one unit of labor. Here, ν represents a subsidy which
has the effect of eliminating the monopoly distortion on labor in the steady
state. That is, 1 − ν = (ε − 1) /ε.
The Ramsey equilibrium for the model is the equilibrium associated with
the optimal monetary policy. It can be shown that the Ramsey equilibrium is
characterized by zero inflation, πt = 0, at each date and for each realization of
at and τt and that consumption and employment in the Ramsey equilibrium
corresponds to their first best levels.1 That is, Ct and Nt satisfy the resource
1
For a discussion, see
http://faculty.wcas.northwestern.edu/˜lchrist/course/optimalpolicyhandout.pdf
2
constraint
Ct = exp (at ) Nt ,
and the condition that the marginal rate of substitution between consumption
and labor equals the marginal product of labor
marginal utility of leisure
= Ct exp (τt ) Ntϕ = exp (at ) .
marginal utility of consumption
Solving for Nt :
τt τt
log (Nt∗ ) = − , log (Ct∗ ) = at − ,
1+ϕ 1+ϕ
where ∗ indicates that the variable corresponds to the Ramsey equilibrium.
In the description of the model above, yt denotes log output and yt∗ denotes
log output in the Ramsey equilibrium, i.e., log (Ct∗ ) . The gross interest rate
in the Ramsey equilibrium, Rt∗ , satisfies the intertemporal household first
order condition,
u∗ Rt∗
1 = βEt c,t+1 ,
u∗c,t 1 + πt+1
∗
where u∗c,t indicates the marginal utility of consumption in the Ramsey equi-
librium. Also, πt∗ = 0. With our utility function:
" #
C∗ Rt∗ τt+1 − τt
1 = βEt ∗t Rt∗ = βEt h
τt+1 −τt
i = βEt exp log (Rt∗ ) − ∆at+1 + ,
Ct+1 exp ∆at+1 − 1+ϕ
1+ϕ
Approximately, one can ‘push’ the expectation operator into the power of
the exponential. Doing so and taking the log of both sides, one obtains:
τt+1 − τt
0 = log β + log (Rt∗ ) − Et ∆at+1 + Et ,
1+ϕ
or,
τt+1 − τt
rt∗ = Et ∆at+1 − Et ,
1+ϕ
where rt∗ ≡ log (Rt∗ β) , the log deviation of Rt∗ from its value in the non-
stochastic steady state. The variable, rt∗ , corresponds to the ‘natural rate of
interest’ and yt∗ corresponds to the ‘natural rate of output’.
3
2 Computer Exercises
You will need the Dynare files, cggsim.mod and cggest.mod, as well as the
MATLAB m files, plots.m, analyzegap.m, suptitle.m and HPFAST.m, to do
this assignment (you can see answers in cggsimans.mod and cggestans.mod).
The HP filter is defined as follows:
T ³
X ´2 −1 h³
TX ´ ³ ´i2
min yt − ytT +λ T
yt+1 − ytT − ytT − yt−1
T
{yt }t=1 t=1
T
t=2
1. For our first exercise, we explore the MCMC algorithm and the Laplace
approximation in a simple example. Technical details about both these
objects are discussed in lecture notes.2 One practical consideration not
mentioned in the notes is relevant for the case in which the pdf of inter-
est is of a non-negative random variable. Since the jump distribution is
Normal, a negative x could be drawn (see the notes for a detailed dis-
cussion of x and the ‘jump distribution’). A ‘quick and dirty’ approach
in this case is to work with the absolute value of x.
Hopefully, it is apparent that the MCMC algorithm is quite simple,
and can be programmed by anyone with a relatively small exposure to
MATLAB. A useful exercise to understand how the algorithm works,
is to use it to see how well it approximates a simple known function.
Thus, consider the Weibull probability distribution function (pdf),
2
g (θ) = ba−b θb−1 e−( a ) , x ≥ 0,
θ
2
See http://faculty.wcas.northwestern.edu/˜lchrist/course/estimationhandout.pdf
4
where a, b are parameters. (For an explanation of this pdf, see the
MATLAB documentation of [g] = wblpdf (θ, a, b).) Consider a = 10,
b = 20. Graph this pdf over the grid, [7, 11.5] , with intervals 0.001
(i.e., graph g on the vertical axis, where g = wblpdf(x, 10, 20), and x
on the horizontal axis, where x = 7 : .001 : 11.5). Compute the mode
of this pdf by finding the element in your grid with the highest value
of g. Compute the second derivative of the Weibull at the mode point
numerically, using the formula,
5
Weibull distribution, mode = 9.974, a = 10, b = 20, number of MCMC simulations = 99000
Weibull
0.7 Laplace approximation
MCMC, k = 0.8, % rejection = 26.4452
0.6
0.5
0.4
0.3
0.2
0.1
Note how well the MCMC approximation works. The Laplace approxi-
mation assigns too much density near the mode, and lacks the skewness
of the Weibull. Still, for practical purposes the Laplace may be work-
able, at least as a first approximation in the initial stages of a research
project. This could be verified in the early stages of the project by do-
ing a run using the MCMC algorithm and comparing the results with
those of the Laplace approximation.
6
(a) In the case of the technology and preference shocks, use Dynare to
compute the impulse response functions of the variables to each
shock. The m file, plots.m, can be used for this purpose.
i. Consider the response of the economy to a technology shock
and a preference shock. In each case, indicate whether the
economy over- or under- responds to the shock, relative to
their ‘natural’ responses. What is the economic intuition in
each case?
ii. Replace the time series representation of at with
at = ρat−1 + εat .
How does the response of the economy to εat with this rep-
resentation compare to the response to εat with the unit root
representation?3
(b) Do the calculations with φπ = 0.99. What sort of message does
Dynare generate, and can you provide the economic intuition for
it? (In this case, there is ‘indeterminacy’, which means a type
of multiplicity of equilibria...this happens whenever φπ < 1 when
φx = α = 0.) Provide intuition for this result.
(c) Return to the parameterization, φπ = 1.5. Now, insert rt into
the Cavlo pricing equation (this corresponds to adding a (rather
strong) ‘working capital channel’ to the model). Redo the calcula-
tions and note how Dynare reports indeterminacy again. Provide
economic intuition for your result.
(d) Explain why it is that when the monetary policy rule is replaced by
the rt = rt∗ , the natural equilibrium (i.e., Ramsey) is a solution to
the equilibrium conditions. Explain why the natural equilibrium
is not the only solution to the equilibrium conditions (i.e., the
indicated policy rule does not support the natural equilibrium
uniquely). Verify this result computationally in Dynare.
(e) Now replace the monetary policy rule with
³ ´
rt = rt∗ + α rt−1 − rt−1
∗
+ (1 − α) [φπ πt + φx xt ] .
3
Hint: changes to the code are minimized if you reinterpret da in the code as a and
make adjustments based on this change.
7
Explain why the natural equilibrium is a solution to the equilib-
rium conditions with this policy rule. Verify computationally that
this policy rule uniquely supports the natural equilibrium (in the
sense of satisfying determinacy), as long as φπ is large enough.
Provide intuition. Conclude that the Taylor rule uniquely (in the
sense of determinacy) supports the natural equilibrium if the nat-
ural rate of interest is included in the rule.
(f) Consider the following alternative representation for the technol-
ogy shock:
at = ρat−1 + ξt0 + ξt−1
1
,
where both shocks are iid, so that the sum is iid too. Here, we
assume agents see ξt0 at time t and they see ξt−1
1
at t − 1. Thus,
agents have advance information (or, ‘news’) about the future
realization of a shock. Introduce this change into the code and
set ρ = 0.2. Verify that when there is a shock to ξt1 , inflation falls
contemporaneously and the output gap jumps. Provide intuition
for this apparently contradictory result. What happens when the
natural rate of interest is introduced in the policy rule?4
8
Dynare are placed in the n × T matrix, oo .endo simul.5 The n rows of
oo .endo simul correspond to the n = 8 variables in var, listed in the
order in which you have listed them in the var statement from the first
to the last row. To verify the order that Dynare puts the variables in,
see how they are ordered in M .endo names in the Dynare-created file,
cggsim.m.
Retrieve output growth from oo .endo simul and get the log level of
output, y, using y =cumsum(dysim), where dysim is the name I arbi-
trarily assigned to the row of oo .endo simul corresponding to output
growth. Also, retrieve x from the appropriate row of oo .endo simul
and create natural output from the relation, y ∗ = y − x.
The model of this question lies close to the heart of the main paradigm
underlying the current view about the monetary transmission mecha-
nism. Note that in the case of this model, the hp-filter is not terrible
as a guide to the output gap. This is because the technology shock is
the important shock in the dynamics of the data, and the actual data
5
Here, endo simul is the matrix, which is a ‘field’ in the structure, oo .
9
overreact to the technology shock. That is, the natural rate of output
is a smooth version of the data. Of course, this is only an example, and
is something worth pursuing more carefully using a DSGE model that
has more solid empirical foundations.
(a) Set the mean of the priors over the parameters to the correspond-
ing true values. Set the standard deviation of the inverted gamma
to 10 and of the beta to 0.04. (It’s hard to interpret these standard
deviations directly, but you will see graphs of the priors, which are
easier to interpret.) Use 30 observations in the estimation. Ad-
just the value of k, so that you get a reasonable acceptance rate. I
found that k = 1.2 works well. Have a look at the posteriors, and
notice how, with one exception, they are much tighter than the
10
priors. The exception is lambda, where the posterior and prior
are very similar. This is evidence that there is little information
in the data about lambda.
(b) Redo (a), but set the mean and standard deviation of the prior
on lambda equal to 0.95 and 0.04, respectively. Note how the
prior and posterior are again very similar. There is not much
information in the data about the value of lambda!
(c) Note how the priors on σa and ρ have faint ‘shoulders’ on the
right side. Redo (a), with M = 4, 000 (M is mh replic, which
controls the number of MCMC replications). Note that the pos-
teriors are now smoother. Actually, M = 4, 000 is a small number
of replications to use in practice.
(d) Now set the mean of the priors on the standard deviations to 0.1,
far from the truth. Set the prior standard deviation on the in-
verted gamma distributions to 1. Keep the observations at 30, and
see how the posteriors compare with the priors. (Reset M = 1, 000
so that the computations go quickly.) Note that the posteriors
move sharply back into the neighborhood of 0.02. Evidently, there
is a lot of information in the data about these parameters.
(e) Repeat (a) with 4,000 observations. Compare the priors and pos-
teriors. Note how, with one exception, the posteriors are ‘spikes’.
The exception, of course, is lambda. Still, the difference between
the prior and posterior in this case indicates there is information
in the data about lambda.
11
Standard deviation of technology innovation Standard deviation of preference innovation
150
MCMC 140
Laplace 120
100 100
80
60
50
40
20
0
0 0.01 0.02 0.03 0.04 0.01 0.02 0.03 0.04
Rho Lambda
5
2
4
3 1.5
2 1
1 0.5
12
Standard deviation of technology innovation Standard deviation of preference innovation
150
MCMC 140
Laplace 120
100
100
80
50
60
0 40
20
−50 0
0 0.01 0.02 0.03 0.04 0.05 0.01 0.02 0.03 0.04
Rho Lambda
5
2
4
3 1.5
2 1
1 0.5
0 0
0 0.2 0.4 0.6 0 0.5 1
Note how much more similar the MCMC and Laplace posteriors are.
The tail areas of the MCMC posteriors have thinned out and now
resemble more closely the Laplace. Next, I set M = 1, 000, 000 and
obtained virtually the same result as with M = 100, 000 :
13
Standard deviation of technology innovation Standard deviation of preference innovation
140 140
120 120
MCMC
100 100
Laplace
80 80
60 60
40 40
20 20
0 0
0 0.01 0.02 0.03 0.04 0 0.01 0.02 0.03 0.04 0.05
Rho Lambda
5
2
4
3 1.5
2 1
1 0.5
0 0
−0.2 0 0.2 0.4 0.6 0.8 0 0.5 1
Thus, in this example it seems that the MCMC algorithm has roughly
converged for M = 100, 000. In addition the Laplace and MCMC ap-
proximations deliver very similar results, consistent with the conclusion
that the Laplace approach can used at the start and middle of a re-
search project, while the MCMC can be done later on. Note that in any
particular project, you can ‘test’ this proposition doing comparison of
the posterior distribution obtained by the Laplace approximation with
the posterior distribution obtained by MCMC.
7. The output gap is not in the dataset used in the econometric estima-
tion. However, as noted in the handout, it is possible to use the Kalman
filter to estimate the output gap (actually, everything in the state) from
the available data. There are two ways to do this: ‘smoothing’ uses
the entire data set and ‘filtering’ only uses the part of the dataset prior
to the date for which the estimate of the gap is formed (thus, filtered
data are one-step-ahead forecasts). To activate the Kalman smoother
14
in Dynare, include the argument, smoother, in the estimation argu-
ment list. The smoothed estimates will then be placed in a MATLAB
structure oo .SmoothedVariables. This structure can be accessed either
directly from the command line, or by selecting >desktop>workspace
from the pull down menu available in the command window. You will
see that inside oo .SmoothedVariables there are a number of subcat-
egories, with output related to the Bayesian estimation (for example,
oo .SmoothedVariables.Median.x displays the median smoothed esti-
mate of the output gap, x). To see how well the Dynare-estimated
version of the model does at producing a good guess of the output
gap, include the code, analyzegap.m, at the end of your mod file. This
shows you how to recover the smoothed output gap from Dynare, and
allows you to compare it with the actual output gap, as well as with
the hp-filtered estimate of the output gap.
9. The analysis in the previous question suggests that the output gap can
be estimated reliably using the estimated dsge model. However, in
practice one needs the output gap in real time. For this, the smoothed
estimates of the output gap are not a reliable indicator. Instead, it is
useful to look at the filtered estimates. These are found by running
analyzegap.m to line 56 (the code shows how these are recovered from
oo .FilteredVariables). Note that there is a systematic phase shift be-
tween the estimated and actual gaps. This is as expected. Turning
points are hard to ‘see’ in real time. They become evident only after
the fact. (Dynare also reports ‘updated’ variables. These are forecasts
of the data based on current and past observations. Not surprisingly,
the updated ‘estimates’ of variables that happen to be in the econome-
15
trician’s data set happen to coincide with their true values. This is not
so for filtered variables.)
10. It is interesting to see how the HP filter works in real time. By running
analyze.m down to line 75 one obtains an estimate of this. Note that
the HP filter does not exhibit the same phase shift as the filtered data.
This is because for date t I have computed the HP filter using data up
to and including date t.
11. Dynare will also do forecasting. For this, one includes the argument,
forecast=xx, where xx indicates how many periods in the future you
want to forecast. (Put in xx=12.) To obtain the forecasts, as well as
forecast uncertainty, execute the rest of analyzegap.m. You can see
from the analyzegap.m code where in oo .PointForecast the forecasts
as well as the forecast uncertainty is stored.
16