I’ll try being more specific and provide the code.

This is what I use to loop over the stoch_simul with every recursive estimation of each parameter:

```
for i = 1:96 %for 96 recursive estimations
if first_time
dynare model_loss noclearall;
first_time = 0;
result_var(i).ygap = oo_.var(1,1);
result_var(i).pi = oo_.var(2,2);
result_var(i).r = oo_.var(3,3)/4;
result_var(i).ugap = oo_.var(4,4);
result_var(i).t = t{i};
else
set_param_value('cpibar',p_cpibar(i));
set_param_value('crhointr',p_crhointr(i));
set_param_value('cry',p_cry(i));
set_param_value('crdy',p_crdy(i));
set_param_value('crpi',p_crpi(i));
set_param_value('cphi', p_cphi(i));
set_param_value('ch', p_ch(i));
set_param_value('comega', p_comega(i));
set_param_value('cv', p_cv(i));
set_param_value('cthetap', p_cthetap(i));
set_param_value('cthetaw', p_cthetaw(i));
set_param_value('cgammap', p_cgammap(i));
set_param_value('cgammaw', p_cgammaw(i));
set_param_value('cpsip', p_cpsip(i));
set_param_value('cpsiw', p_cpsiw(i));
set_param_value('calpha', p_calpha(i));
set_param_value('cthetae', p_cthetae(i));
set_param_value('cbetabar', p_cbetabar(i));
set_param_value('cebar', p_cebar(i));
set_param_value('ctaubar', p_ctaubar(i));
set_param_value('crhoa', p_crhoa(i));
set_param_value('crhob', p_crhob(i));
set_param_value('crhog', p_crhog(i));
set_param_value('crhoga', p_crhoga(i));
set_param_value('crhoq', p_crhoq(i));
set_param_value('crhor', p_crhor(i));
set_param_value('crhop', p_crhop(i));
set_param_value('cmup', p_cmup(i));
set_param_value('crhow', p_crhow(i));
set_param_value('crhos', p_crhos(i));
set_param_value('cmuw', p_cmuw(i));
set_param_value('cpsi', p_cpsi(i));
[info, oo_] = stoch_simul(M_, options_, oo_, var_list_);
if info
disp(['Computation fails for t = ' t{i}]);
else
result_var(i).ygap = oo_.var(1,1);
result_var(i).pi = oo_.var(2,2);
result_var(i).r = oo_.var(3,3)/4;
result_var(i).ugap = oo_.var(4,4);
end
end
end
for i = 1:96
result_var(i).t = t{i};
end
```

With this being the mod file:

model_loss.mod (10.7 KB)

The stochastic simulation fails in some of the recession periods (2009 and 2019), I doubt that is a coincidence. I set parameter values of all estimated parameters, perhaps I am supposed to add something for each recursion?

I tried adding a steady_state_model block at the end, but that sadly did not help.

(edit: formatting)