Loop over parameters

You are not actually setting the parameter. What you should do is use the the set_param_value command. Moreover, if you have an analytic steady state, use a steady_state_model block instead of initval. You can find an example for such a loop here: [Need help to check Matlab compatibility). Basically, you need to write a Matlab m-file with the following parts:

rhos = 0.8:0.05:1.05;
first_time = 1;
for i=1:length(rhos)
    if first_time
        set_param_value('rho',rhos(i));
        dynare your_mod_file_here noclearall;
        first_time = 0;
    else
        set_param_value('rho',rhos(i));
        info = stoch_simul(var_list_);
        if info;
          disp('Computation fails for rho = ' num2str(rho)]);
        end;
    end
end

Inside your mod-file you still need to use the steady_state_model block.

Addendum:

The set_param_value command only refers to structural parameters. You cannot set standard deviations or measurement error defined in the shocks-block this way. You either have to set M_.Sigma_e directly, or calibrate the shock variances to 1 and use in the model

+sigma_eps*eps_z

instead of

+eps_z

The structural parameter sigma_eps now contains the standard deviation and can be set using the set_param_value command. Similarly, correlated shocks can be entered by specifying a joint shock.

Compatibility considerations:

In Dynare 4.6 and higher, you need

info = stoch_simul(M_, options_, oo_, var_list_);
3 Likes