Welfare analysis under simple optimal policy."Unrecognized field name "ghs2""

Hi all, Everything looks find until I conduct a welfare analysis under simple optimal policy rule (Taylor rho_infl & rho_y).
Dynare returns the following error .

Unrecognized field name “ghs2”.

Error in Model5_external_ext1.driver (line 772)
WW(kk,ww)=Welfss+0.5*oo_.dr.ghs2(oo_.dr.inv_order_var(Wpos));
Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);

1- What did I do wrong? I am using dynare 5.
2- How can I improve the speed of the computation? currently dynare is using the default period and it takes slow. using a 100k period for the welfare analysis will be quite time demanding. Thanks.

Model5_external_ext1.m (4.5 KB)
Model5_external_ext1.mod (10.6 KB)

You did not provide the parameter file.

Hi @jpfeifer running the m file first will provide the parameters. Thanks,

@jpfeifer a different question. I wanted to know whether the error I get trying to use your welfare analysis (
get_consumption_equivalent_conditional_welfare
Not enough input arguments.) has to do with the dynare version ?

  1. Yes, the error seems to be due to different versions.
  2. Your code does not do a proper error handling within the loop. You should not loop over all of Dynare. The proper way would be

Thanks so much @jpfeifer I was able to solve the issue using the above ref. Very helpful!!