Dear all,

here are so many similar questions on this forum, but I couldn’t find out an identical question here, I really need a help

I have found two topic related to my question:

and

My questions are as below.

**First of all**, what is the difference between these two topics? which one could loop over parameters to find out the corresponding maximized welfare?

//

Next, follow the suggestion from the first forum topic, I build a .m file to find out my target welfare.

```
dynare welfare_TRY2.mod
rhogrid = 0.6:0.2:1.0;
results_cell = zeros(length(rhogrid),1);
for i = 1:length(rhogrid)
set_param_value('rho',rhogrid(i))
info = stoch_simul(var_list_)
if info ==0
results_cell(i) = oo_.steady_state(44);
else
fprintf('Here is an error!');
end
end
```

where oo_.steady_state(44) is referred to the **conditional welfare** which is derived according to the **get_consumption_equivalent_conditional_welfare.m** from

**My second question is that, does oo_.steady_state(44) really capture the corresponding welfare given after-looped parameters?**

And, this .m file works with something wrong.

The content of results_cell are all the same and identical to the steady state value of welfare from running my dynare.mod file separately! I have tried to loop another parameter, while the result doesn’t change. **Does it mean that my loop doesn’t work in fact? How could I fix it?**

As a matter of fact, my .m file doesn’t work well for every iteration. In the last iteration, i=3 and rho=1.0, the info =[4.0 1.0]. From the error message, I know that my model violate Blanchard & Kahn conditions. **My question is that, since the .m file still run without just stopping, does my model structure need an overall modification? or could I think my model works well but the parameter looping range should be modified?**

//

The followings are my .m and .mod files.

Run_welfare_TRY_outside2.m (623 Bytes)

welfare_TRY2.mod (8.1 KB)

welfare_TRY2_steadystate.m (5.7 KB)

COMPUTE_WELFARE.m (996 Bytes)

I am so sorry and embarrassed to ask so many questions, I would be thankful for any help.

Regards