Gali et al (2007): Consumption SS-Share

Hi All,

I’m a new Dynare user and would appreciate your advice regarding the replication of Gali et al (2007): Understanding the Effects of Government Spending on Consumption, i.e. a two-agent NK model (link:

As per the attached mod-file, the model is up and running, but the response of consumption (!) as well as wages is clearly incorrect. The reason, I presume, is that the steady state shares of consumption and investment in output are messed up, despite following the specification provided in the paper. I wonder whether I’m missing something in terms of how this ought to be specified in the Dynare environment (e.g. relating to the steady-command or similar)? I’d appreciate any help you are able to provide.

The file should hopefully be relatively easy to read, as variables and parameters are described, and the model is summarised in the latex files generated upon running.

Thank you very much in advance!

P.s.: Perhaps the code (once fixed) is useful to other people as well – if so, all the better.

edit: Equation (36) in the paper, the linearised market clearing condition, also appears to be missing a ‘gamma_g’ in front of ‘g’?!
edit2: I believe there is a typo in the paper and it should read
where the ‘+1’ is missing in the paper. However, while the resulting SS shares are sensible, the BK condition isn’t satisfied.

gali_2007_lin.mod (6.2 KB)

1 Like

Hi lukasf,

I am planning to replicate Gali et al. (2007) myself and was glad to have found your mod file today. I looked at it and agree, the problem is related to gamma_g, which actually evaluates to a negative value in the current parametrization (which you correctly took from Gali et al.). But a negative value for gamma_c (which denotes the share of consumption in the overall GDP) does not make sense.

Now, as you already identified, the equation in Appendix B for gamma_c is flawed. In particular, the identity R^k = alpha Y / (mu_p K) seems to be wrong. Did you find this also as in your edit2 you have a new equation for gamma_c? How did you reach that new equation?

By the way, for lambda=0.85 and mu_p +1 I obtain satisfied BK conditions and a positive response of C to G-shock.

I have replicated both the linear and nonlinear version of the model and am currently in the process of making them publishable. I will hopefully soon be able to upload them.

1 Like

Hi both,

Professor Pfeifer, thank you very much, your help is greatly appreciated!

@ivfr: I think there are two separate issues here

  • there’s a typo in the formula for gamma_c (in the 2007 paper), but this may easily be rectified as per my edit2
  • the market clearing condition: It’s not entirely clear from the paper, but I suspect the equation is actually correct as it stands; it’s a question of how G is defined (specifically, in the market clearing equation it is probably not in logs.

For reference, I attach the latest version of my code and the associated model description.


gali_lin_lf_v8.mod (9.7 KB)
gali_lin_lf_TeX_binder.pdf (94.6 KB)

@lukasf, thanks very useful!

  1. I also think this is a typo (or at least unclarity with respect to the definition of mu_p), the +1 needs to enter the formula for gamma_c
  2. Market clearing condition: While c_t and i_t are defined as x_t = log (X_t / X) which is approximately (X_T - X) / X, g_t is defined as (G_t - G)/Y -> so it is expressed relative to Y instead of G, which makes the gamma_C drop out in the formula. The definition for g_t is given right below equation 19 in the paper. ( provides an expample of log-linearizing the market clearing condition. )

@jpfeifer That would be very useful! I am looking forward to your upload


Again to point 1: I realized after doing the derivations, the +1 can also (in the formula of gamma_c) be left out if one interprets the markup of 20% as a value of mu_p = 1.2. However, the same applies to the derivations of Gamma, sigma, Theta_n, and Theta_t. Also here you either have to replace mu_p with mu_p + 1 or define mu_p = 1.2 in the first place. When doing this, the results look much closer to Gali 2007. See attached mod file.

The results are not identical, though. For example, consumption begins to rise at impact only for lambda > 0.70 instead of lambda > 0.6 in Gali et al. 2007

Gali2007_replication_lin.mod (8.4 KB)

1 Like

Fantastic, that makes sense! Thanks :slight_smile: