The Outcome of Shock Decomposition isn't Identical to the Observed Variables

EstData.mat (1.8 KB)
m6_rbc_4est.mod (11.4 KB)
param_nc.mat (1.8 KB)

Hi there,

Any kind of help wil be greatly appreciated.

There is a problem in the results of historical shock decomposition. I know that the sum of all shocks should be identical to the observed variables. But the results of historical shock decomposition don’t coincide with the observed ones. And the initial value is very large.

Observed variables include: the interest rate of S firm (r_s), output (y), investment (i), the ratio of debt to ouput (by). There are 46 periods in my sample.

And here is my trasformation of quarterly data:

  1. The interest rate of S firm (r_s), output (y) and investment (i) are deflated by inflation according to the model.

  2. Logarthimize all the observed variables.

  3. Detrend all the variables using HP-filter.

  4. Seasonally adjust all variables using Census X12 method.:

I have attached the data file, the mod file and the value of parameters.

Thank you so much in advance.


Does that happen for all variables? And are you using Dynare 4.5? If not, the reason may be stochastic singularity in your model.
A couple of things regarding your data treatment:

  1. You should deflate with the GDP deflator or the price index, not with the inflation rate (growth rate of the deflators).
  2. You should not use the two-sided HP filter for detrending when working with state space systems.
  3. Seasonal adjustment should be done before any other transformations.


I’m really grateful for your rapid and thorough reply. Before you replied me, According to your reply and the paper “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”, I modified the data and mod files.Then it really works well.

Thanks for your help again.


Dear Helen,
I also have the same problem. Do you know how to solve it? is there something wrong in data or equations in mod files?
Thank you very much.

Did you check for stochastic singularity?

Dear Pfeifer,
I modified the data according to “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”. Then it really works well.