How to get unrealized news shocks after Occbin when simult_ fails

Dear,

I want to impulse unrealized news shock after running Occbin for news shock.

I have read the code for the RBC model and understand the key is to use simult_ to combine the 8 period ahead news shock(1) and the unexpected shock(1+8) that offsets it and makes it fail to realize DSGE_mod/RBC_news_shock_model/RBC_news_shock_model.mod at master · JohannesPfeifer/DSGE_mod · GitHub
matlab/simult_.m · master · Dynare / dynare · GitLab

The issue is, simult_ cannot work after Occbin. After Occbin’s solution algorithm, there is no “ghx”,“ghu”,“state_var”, which are necessary for simult_ .

[zdatalinear zdatapiecewise zdatass oobase_ Mbase_ ] = ...
  solve_one_constraint(modnam,modnamstar,...
  constraint, constraint_relax,...
  shockssequence,irfshock,nperiods,maxiter);

for i=1:M_.endo_nbr
  eval([deblank(M_.endo_names(i,:)),'_u=zdatalinear(:,i);']);
  eval([deblank(M_.endo_names(i,:)),'_p=zdatapiecewise(:,i);']);
  eval([deblank(M_.endo_names(i,:)),'_ss=zdatass(i);']);
end

Are there any feasible ways to generate unrealized news shocks after Occbin?

Many thanks in advance!

Dear @jpfeifer Johannes, are there any feasible ways to generate unrealized news shocks after Occbin?

Any thoughts will be highly appreciated! Thanks a ton! :pleading_face:

Occbin should allow you to specify shocks and then conduct a simulation.

do you mean that simult_ should work after occbin? But the warning information is

Reference to non-existent field 'ghu'.

Error in simult_ (line 91)
        if isempty(dr.ghu)% For (linearized) deterministic models.

Error in runsim_unrealized_news (line 105)
y2 = simult_(initial_condition_states,oo_.dr,shock_matrix,1); %ERROR, this code only works 4.6

I attach the codes that I use to test unrealized news shocks after Occbin below. Please run the runsim_unrealized_news.m file.
replication_figure3_4_news.rar (1.9 MB)

I have another question about the code. Should I specify the shocks(unrealized) before occbin solution algorithm? That is, should I specify the shock matrix before solve_two_constraints?

Thanks so much and wish you a good day!

No, what I am saying is that solve_*_constraint has an input shockssequence that allows you to put in the two shocks necessary to run a pure news shock.

Dear Johannes, do you mean I actually only need to simply modify like this before solve_*_constraint

irfshock =char('eps_j4','eps_j');
shock_matrix = zeros(40,2);
shock_matrix(2,1) = 0.1;
shock_matrix(2+4,2) = - 0.1;
shockssequence= shock_matrix;
   nperiods = numel(shockssequence);  

I attach the new runsim_unrealized_news1.m for your quick reference.
Is this result really the result of the economy hit by an unrealized news shock?
runsim_unrealized_news1.m (3.9 KB)

Many Thanks in advance!

So I do NOT need to use simult_ below anymore. These results, "endogenousvariables"_p, "endogenousvariables"_ss, are already the results of the unrealized news shock. Right?