Intuition for Shock Decomposition

Hello everybody!

For the purpose of the final paper I have to give back in order to complete my master in economics I decided to replicate the work of Lubik Schorfheide (2007) and model a small open DSGE economy (Canada) to analyse the decomposition of the shocks in the model.

The estimation of my parameters were tricky at first but with the help of this forum it seems to be holding nicely right now. I used bayesian estimation and recycled the posterior distribution obtained by Lubik and Schorfheide as my prior distribution. The results are plausible enough.

The next step was to decompose the shocks with the ‘‘shock_decomposition’’ command, which was, again, trickier than expected but I managed to get some plausible results. This post is about the intuition behind the results that I have obtained.

So here are my questions:

  1. I’m having a hard time understanding how to analyse the shock decomposition that Dynare gives me back. I can’t wrap my head around how the shock related to technology growth (z) only pulls my y_gap downwards (represented as: actual output - potential output). A positive technology shock should have a positive influence on ‘‘y’’ (the output) which i turn would give me a positive result on y-yp, that is unless ‘‘yp’’ was subjected to the exact same influence (which is not the case).

  2. I have tried many sets of different observed variables to feed to Dynare with many different results. Is there a rule of thumb to decide what variables to keep as observed variables? For the moment I tried to keep only the most crucial ones, and since I am limited to 5 (I have 5 shocks in the model) I am wondering which should be kept for good.

  3. I used the real value of the exchange rate (CAD/USD) for the variable ‘‘e’’. At first I had log-linearized that value, then tought I could represent it as a trend value with the HP filter, then decided to go with the real value. Overall, I’d say I have no idea which would yield the most conclusive results. Everything else in my model is in it’s log-linearized version, so that would make sense to do the same for the exchange rate.

I think that’s all for now. You will find every necessary file to run the code in that post, feel free to use it for your own experiments/research.

Have a great day!


I only have access to dynare 4.4.3 for now

lubikdecomp.txt (2.7 KB)

lubikdecomp.xlsx (30.7 KB)

Your estimation results are wrong, because you misspecified the observation equations. You are trying to match zero mean model variables to non-zero mean data. That will not work. Please read Pfeifer (2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”

Thank you for your fast answer prof. Pfeiffer!

You were absolutely right about my observable variables and that also settles most of the question I had in my first post. I corrected a couple of things here and there and I now obtain much better looking results. Now all my observable variables are stationnary with mean 0 and the code still runs well. I took a bit of tweaking (changed my priors for the ones used by Lubik and Schorfheide for example) but I manage to get this much more realistic grah:

I guess there is still one thing that I need to do and it’s to choose the definitive values to put in my shock block. Right now I ran the code with a standard value of 0.15 for the standard error of my shocks but as soon as I touch one everything changes in a very drastic way. Do you know where I should get the real value for those standard error? I’m not sure where to look to be able to identify (and justify) those values…

I will leave my new code and my new database right here so people who face the same problem can see what corrections I brought.

StationnaryData.xlsx (45.1 KB)

lubikdecomp.txt (2.7 KB)

Once again I hope you have a great day!


There are still various issues.

  1. You cannot estimate standard deviations the way you do it. You need to use
stderr eps_piw, inv_gamma_pdf,2,4;

instead of

sigma_piw, inv_gamma_pdf,2,4;

The reason is that sigma_piw does not appear anywhere in the model. Similary, you cannot estimate r_ss if it does not appear anywhere.
2. Your inflation series looks strange. It has plateaus for exactly four quarters. Are you sure this is right?