Policy frontier

Dear all,
I am trying to draw a policy frontier (or Taylor curve) by assuming loss function as “lambda * var(inflation) + (1-lambda) * var(y)”.
But I don’t knwo how can I get it?
Can anyone offer me an complete example for refering!
Any helps will be really appreciated.

Best,
yanking

2 Likes

Do you have a reference for what you are trying to achieve?

Dear Professor jpfeifer,thanks for your reply!
Such as Policy frontier is a problem that appeared long ago in this forom,but hasn’t been solved till now.Another example is Iacoviello, Matteo(2007),“House Prices, Borrowing Constraints, and Monetary Policy in the Business Cycle”,But he computed his policy frontier completely with matlab program.
What I need is how to solve this problem with dynare platform conbineded with simple matlab codes.

Sorry,Iacoviello, Matteo(2005),

I see. Do you already have the mod-file for which you want to compute this?

Starting with the unstable version of 12/18/2016 (Dynare 4.5), the following code should work for your mod-file

% make loop silent
options_.nofunctions=1;
options_.nocorr=1;
options_.noprint=1;
options_.irf=0;
options_.silent_optimizer=1;

options_.osr.opt_algo=9;

% find position of variables in variable_weights
y_pos=strmatch('y_hat',M_.endo_names,'exact');
pi_pos=strmatch('pi_hat',M_.endo_names,'exact');

% find position of variables in var_list_
y_pos_var_list_=strmatch('y_hat',var_list_,'exact');
pi_pos_var_list_=strmatch('pi_hat',var_list_,'exact');

weight_grid=0:0.01:1;
n_grid_points=length(weight_grid);
var_y=NaN(n_grid_points,1);
var_pi=NaN(n_grid_points,1);
for grid_iter=1:n_grid_points
    M_.osr.variable_weights(pi_pos,pi_pos) = weight_grid(grid_iter);
    M_.osr.variable_weights(y_pos,y_pos) = (1-weight_grid(grid_iter));
    oo_.osr = osr(var_list_,M_.osr.param_names,M_.osr.variable_indices,M_.osr.variable_weights);
    if oo_.osr.error_indicator==0
        var_y(grid_iter)=oo_.var(y_pos_var_list_,y_pos_var_list_);
        var_pi(grid_iter)=oo_.var(pi_pos_var_list_,pi_pos_var_list_);
    end
end
figure
plot(var_y,var_pi)
1 Like

Hi, Prof Pfeifer, I add your above code to my mod file and it does not work, since the var_list_ is empty.
So shall I write names of all variables into var_list_?
Thanks.

In that case, you should be able to replace

var_list_

with

M_.endo_names

Thanks, dear Prof. Pfeifer , it finally works!

1 Like

Prof. Pfeifer,

Could you please clarify whether the above code you provided re-computes the Optimal Simple Rule *every *time the weight in the grid is changed, or whether it merely computes the unconditional variances of inflation and output gap implied by the Optimal Simple Rule calculated using the OSR routine for a *particular *value of “lambda” (say, 0.5) chosen *prior *to running the code you provided?

Thank you very much.

Hi,
in the above code within the loop

M_.osr.variable_weights(pi_pos,pi_pos) = weight_grid(grid_iter); M_.osr.variable_weights(y_pos,y_pos) = (1-weight_grid(grid_iter)); oo_.osr = osr(var_list_,M_.osr.param_names,M_.osr.variable_indices,M_.osr.variable_weights);
resets the weights and then recomputes the OSR for these particular weights.

Prof. Pfeifer, thank you very much for such a prompt reply.

And just to confirm, if one runs

optim_weights; 
pi_hat 0.5; 
y_hat 0.5; 
end;

osr_params phiR phipi phiY; 

osr_params_bounds;
phiR, 0, 0.99;
phipi, 1, 100;
phiY, 0, 100;
end;

osr(opt_algo=9);

prior to the code you provided, would the above-stated parameter bounds be respected in the re-computation of the OSR within the loop as the weight in the loss function is varied?

Yes, because the resulting M_.osr.param_bounds
is not altered subsequently.

Thank you.

I’ve also met the same problem as @zhanshuo . But the dynare code in the code block is missing. Could you just please provide the code again. Thanks a lot.

That was a problem with the migration to the new forum. I fixed the post.

Dear Prof JPfeifer,

I am trying to construct a three dimensional efficiency frontier along the lines of Rubio & Carrasco-Gallego (2014) paper on “Macroprudential and monetary policies: Implications for financial stability and welfare”.

I have the following Loss function: L = var(pie) + lambda_yvar(y) + lambda_lvar(l).

I want the loss function weight on output variance (lambda_y) to vary between 0 and 1 and the one on credit variance to (lambda_l) to vary between 0 and 0.5.

Below my model, I have the following code for OSR do the work:

weight_grid_y_s=0:0.01:0.1;
weight_grid_l_s=0:0.05:0.5;
m_grid_points=length(weight_grid_l_s)*length(weight_grid_y_s);

Results = zeros(m_grid_points,7);

i_pie = strmatch('pie',M_.endo_names,'exact');
i_y = strmatch('y',M_.endo_names,'exact');
i_l = strmatch('l',M_.endo_names,'exact');

ires = 1;
for il = 1:length(weight_grid_l_s);
    for iy = 1:length(weight_grid_y_s);
        
        optim_weights;
        pie 1;
        l weight_grid_l_s(il); // Only allow this to vary
        y weight_grid_y_s(iy); // Only allow this to vary
    end;
    
    osr_params chi_l chi_y;
    chi_l = 0.25;
    chi_y = 0.25;
    
    osr(opt_algo=9,nograph,noprint);
    
    Results(ires,[1:7]) = [weight_grid_l_s(il) weight_grid_y_s(iy) oo_.osr.optim_params.chi_l …
        oo_.osr.optim_params.chi_y oo_.var(i_pie,i_pie) oo_.var(i_y,i_y) oo_.var(i_l,i_l)];
    
    ires = ires + 1;
    
end;
end;

save('Results.mat','Results');

plot3(Results(:,7), Results(:,6),Results(:,5),'–b','LineWidth',1);

When I run the code, it seems like everything is ok. I just want to establish whether the above code is correct for what I want to do: constructing a three dimensional efficiency frontier?

Could you assist please !

Regards

Having blocks in a loop is strongly discouraged as it is impossible to control what will happen. Instead, set
M_.osr.variable_weights
manually as in the above example and then call osr
via
oo_.osr =osr(var_list_,M_.osr.param_names,M_.osr.variable_indices,M_.osr.variable_weights);
`

Thanks for the prompt response Prof JPfeifer,

When I modify the example provided earlier, I have the following:
% find position of variables in variable_weights
pie_pos=strmatch(‘pie’,M_.endo_names,‘exact’);
l_pos=strmatch(‘l’,M_.endo_names,‘exact’);
y_pos=strmatch(‘y’,M_.endo_names,‘exact’);

% find position of variables in M_.endo_names
pie_pos_M_.endo_names=strmatch(‘pie’,M_.endo_names,‘exact’);
l_pos_M_.endo_names=strmatch(‘l’,M_.endo_names,‘exact’);
y_pos_M_.endo_names=strmatch(‘y’,M_.endo_names,‘exact’);

weight_grid_pie = 1:1:1; %weight on pie is fixed at 1. Not sure whether I have done it correctly !! Please help !
weight_grid_l = 0:0.05:0.5;
weight_grid_y = 0:0.1:1;

n_grid_points = length(weight_grid_pie)*length(weight_grid_l)*length(weight_grid_y);

var_pie = NaN(n_grid_points,1);
var_l = NaN(n_grid_points,1);
var_y = NaN(n_grid_points,1);

for grid_iter = 1:n_grid_points
M_.osr.variable_weights(pie_pos,pie_pos) = weight_grid_pie(grid_iter);
M_.osr.variable_weights(l_pos,l_pos) = weight_grid_l(grid_iter);
M_.osr.variable_weights(y_pos,y_pos) = weight_grid_y(grid_iter);
oo_.osr = osr(M_.endo_names,M_.osr.param_names,M_.osr.variable_indices,M_.osr.variable_weights);
if oo_.osr.error_indicator==0
var_pie(grid_iter) = oo_.var(pie_pos_M_.endo_names,pie_pos_M_.endo_names);
var_l(grid_iter) = oo_.var(l_pos_M_.endo_names,l_pos_M_.endo_names);
var_y(grid_iter) = oo_.var(y_pos_M_.endo_names,y_pos_M_.endo_names);
end
end

Will this make sense ?

In the above code, I am not really sure about the size of the vectors var_pie, var_l and var_y. I think,
n_grid_points = length(weight_grid_pie)*length(weight_grid_l)*length(weight_grid_y)
which represents the combinations of weights in the Loss function. Am I correct ?

The loss function is as follows:
L = var(pie) + lambda_yvar(y) + lambda_lvar(l)
I only allow the weights, lambda_y and lambda_l to vary and fixed the weight on pie at 1. How do I incorporate the fact that lambda_pie = 1 in the above code ?

Regards,

Ernest

At this stage, I would need to see the full code.