global var_list_
dynare RRendiss noclearall

RRRss_vec = 0.01:0.01:0.04;
PHI_RR_vec = 0.1:0.1:0.3;
loss=cell(length(RRRss_vec),length(PHI_RR_vec));
first_time = 1;
Y_pos=strmatch('Y',var_list_,'exact');
P_pos=strmatch('P',var_list_,'exact');
b_pos=strmatch('b',var_list_,'exact');
for i = 1: length(RRRss_vec)
    for j = 1: length(PHI_RR_vec)
        set_param_value('RRRss',RRRss_vec(i));
        set_param_value('PHI_RR',PHI_RR_vec(j));
        info = stoch_simul(M_, options_, oo_, var_list_);
        if info==0
            loss{i,j} = 0.5*oo_.var(Y_pos,Y_pos)+oo_.var(P_pos,P_pos)+oo_.var(b_pos,b_pos);
        else
            fprintf('model cannot be solved for RRRss=%3.2f and PHI_RR=%3.2f\n!',RRRss_vec(i),PHI_RR_vec(j))
        end;
    end;
end;
% How to plot?