Larry's shock decomposition

Dear all,

Has anyone tried successfully to apply larry Christiano’s code to calculate the shock decomposition posted on this forum?

His post was:
Shock decomposition *

I have tried to apply what he suggests, but I do not get the right result.

It works fine for all the shocks together.

But when I do one shock at a time it does not work since the sum of all the contributions do not add up to the observed data (or to the result with all the shocks together).

My problem is that his code seems incomplete, since some of the variables used are defined elsewhere, and it is not completely clear to me what they refer to. Therefore, I am not sure if it is that I am filling the gaps wrongly or that there is something else wrong with my code.

Thanks,

Pablo

NB: * new url

Hi Pablo,

I tried Larry’s shock decomposition and came across the same issue that the sum of the individual responses to shocks does not add up to the data.

This is what’s happening, I guess. When you are doing that you are actually double counting the initial condition (or triple counting or more). In fact, you are adding the initial condition as many times as the number of shocks there are in your model.

For example, say you have Y(t) = A Y(t-1) + B e(t), where Y(t) is 2x1, and e(t) is also 2x1. Let e1(t) be the 2x1 vector that keeps the first shock and sets the other one to zero. e2(t) keeps the second shocks and sets the first to zero. Now, if you start from the initial condition Y(0), then in one case you would get for period one:
Y1(1) = A Y(0) + B e1(1), where Y1(t) is the vector that captures the simulated response to the first shock; and for the other shock you would get: Y2(1) = A Y(0) + B e2(t). Notice that if you just add the two simulated responses you would get
Y1(1) + Y2(2) = 2 A Y(0) + B e(1) and not Y(1) = A Y(0) + B e(1).

Best,

I haven’t finished my exercise yet, but do you guys notice line 53. Larry actually took the inverse order not the actual order to stack the variables. I don’t know what the purpose is, but it may cause some trouble.

I always ask questions on this forum. Here is some tiny contributions from me. I wrote a code to do the historical decomposition introduced by Larry, the main body of the code is composed by him, but I make some modification to add flexibilities. Another is from myself to do the finite horizon forecast error decompostion.

Please see the attachment and let me know if you find errors in them.
swsp_util_habit5_vardecomp_forecast.m (1.27 KB)
swsp_util_habit5_vardecomp.m (3.07 KB)

[quote]My problem is that his code seems incomplete, since some of the variables used are defined elsewhere, and it is not completely clear to me what they refer to. Therefore, I am not sure if it is that I am filling the gaps wrongly or that there is something else wrong with my code.

Although his code is not a standalone executable file. The core is how to extract shock series and impute them to simulate data. For the underlying model, I guess it is the model used in his co-authored paper with Motto, Illut and Rastagno. The one with financial frictions.

I ran into the same issue with estimated model is because my “estimated” shock series are correlated, so the sum is not one. The sum of variances of data simulated by individual shocks always exceeds the variance of the true data or the data simulated by all shocks together.

[/quote]

Dear bigbigben,

thanks for writing and posting your code. However, it’s clear it is “incomplete”. You seem to show how to implement historical and variance decomposition given an estimated model, but the code depends on your model. To appreciate completely your contribution, could you post as well the .mod file and the data? Otherwise, I have to run another mod file, adapt your code and check if everything works fine. That 's a lot of work.

Thank you for posting the suitable .mod file and the data.

Best,

Aqua.

Hi all,

Following Muklish’s helpful explanation, is there any good or conventional way of handling the initial condition problem?
Is it desirable to divide the initial condition according to the number of shocks such that the sum of solution paths due to all shocks could add up to the actual data?

Many thanks!

Musmic

Hello everyone!
I have a question to the Christiano’s code for a finite-horizon variance decomposition.
One of you said that this code is available under:
cepremap.cnrs.fr/juillard/ma … highlight=
But this link does not work, unfortunately.
Does anybody know where I can get this code? Or does Dynare provide finite-horizon variance decomposition in the meantime?
Thank you very much in advance!
Best,

[quote=“almira”]Hello everyone!
I have a question to the Christiano’s code for a finite-horizon variance decomposition.
One of you said that this code is available under:
cepremap.cnrs.fr/juillard/ma … highlight=
But this link does not work, unfortunately.
Does anybody know where I can get this code? Or does Dynare provide finite-horizon variance decomposition in the meantime?
Thank you very much in advance!
Best,[/quote]

Hey, here is the link to Larry’s post.

How does one actually implement counterfactuals a la Christiano, Motto, Rostagno (Europe counterfactuals on growth, inflation, etc., if replaced by U.S, monetary policy, persistence, shocks, structure)?

Would simply changing the parameters in the mode file produce the correct results, or would that be wrong?