Shock decomposition and initial values

Hello fellow Dynare users,

I am having problem with shock decomposition, specifically, forcing dynare to respect supplied initial values. I noticed that I am having this problem when trying to use values of an unobserved variable estimated on a subsample as observable on a large sample.

In a large model, I am having one variable called covid that follows ar(1). First, I estimate this process using 2020-2022, obtaining parameters of the ar(1) process as well as the resulting value of shocks driving this variable (let’s call them eps_covid). Second, I create a new variable for the full sample where the estimated value are supplemented with zeroes everywhere else and use it as an observable variable in a new shock decomposition over the whole sample.

I thought that running shock decomposition with what is now supplied as an observable variable should simple recover the estimated shocks from the “first stage”. However, I am also getting large effect of initial conditions (see attached figure):

Historical shock decomposition: covid.pdf (219.2 KB)

I do not undestand why is this happening:

  1. My intuition is that the underlying kalman filter should not pick arbitrary starting value just to compensate with a shock of opposite sign.
  2. I tried to compensate with
    filter_initial_state; covid(0) = 0.2; end;
    and while this will change the shock decomposition, I cannot get eliminate the effect of the initial conditions.

Thanks for any suggestions!

I would need to see the codes to debug this.