det_cond_forecast() depends on oo_.dr.state_var but this variable is computed by dyn_first_order_solver. So it isn't available for a purely backward or purely forward model
Designs
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
There is something weird with state_var. It is both in oo_.dr and in M_
As I imagine the M_ version is computed by the preprocessor it would make more sense to always use that version and replace all occurences of oo_.dr.state_var
That is a complicated issue. As far as I know, M_.state_var is indeed created by the preprocessor based on the entered model-information - regardless of whether variables may drop out due to e.g. particular parameterizations. But in the past, we sometimes updated state_var based on the computed model solution. Here it could happen that variables dropped out. We had this a long time ago in discretionary_policy where it caused a bug so that we had to get rid of it.
We should check whether oo_.dr.state_var can ever have different values than M_.state_var.
I grep state_var in all *.m files of ./matlab. As far as I can see
M_.state_var is set by the preprocessor
dr.state_var is set in dr_block.m and in dyn_first_order_solver.m
I couldn't find code which would make dr.state_var different from M_.state_var
It seems possible to replace everywhere dr.state_var``` by M_.state_var, but we need to check every concerned function to make sure that M_`` is passed as argument.
This issue is about the fact that dr.state_var isn't set for all first order models, only for models with both forward and looking variables, the only kind handled by dyn_first_order_solver.m
The solution is to add dr.state_var = M_.state_var to resol.m that should handle all stochastic models. We keep the statement in dr_blocks.m and dyn_first_order_solver.m in the remote case that these functions are called without calling first resol.m
Finally, I set dr.state_var for purely backward model in stochastic_solvers.m.
det_cond_forecast.m requires much more efforts to make it work for purely backward models. I leave it for a comprehensive rework of conditional forecasting in Dynare.