UIP Condition in Open Economy

After looking through your code, this is what i wrote and it works, i just want to make sure it’s correct

%----------------------------------------------
% Welfare computation
%----------------------------------------------

% Get variable positions in variable list:

Welfare_pos = strmatch('Welfare',var_list_, 'exact');
Welfare_eq_pos = strmatch('Welfare',var_list_, 'exact');

% Loop over the interval rho_pi, rho_y element[0,2]:

opt = 0.01:0.03:2;
inf = 0.01:0.03:2;

% variances

variance.Welfare = NaN(length(opt), length(inf),1);
lambda_conditional_technology=NaN(length(opt), length(inf),2);
lambda_unconditional_technology=NaN(length(opt), length(inf),2);

for ii = 1:length(opt)
for jj = 1:length(inf)

set_param_value('rho_y',opt(ii));
set_param_value('rho_pi',inf(jj));

info = stoch_simul(var_list_);

if info

% parameter created problem, keep value at NaN

else

%compute consumption equivalent
options_old=options_;
options_.nocorr=1;
options_.noprint=1;
lambda_unconditional_technology(ii,jj)=csolve('get_consumption_equivalent_unconditional_welfare',0,[],1e-8,1000)
lambda_conditional_technology(ii,jj)=csolve('get_consumption_equivalent_conditional_welfare',lambda_unconditional_technology,[],1e-8,1000)
options_=options_old;
end
end

end
  1. The line
lambda_conditional_technology(ii,jj)=csolve('get_consumption_equivalent_conditional_welfare',lambda_unconditional_technology,[],1e-8,1000)

passes lambda_unconditional_technology as the starting value. But that is a matrix, not a scalar. It should be lambda_unconditional_technology(ii,jj)
2. You should not call variables inf. That is the Matlab command for infinity.

Dear Prof. Pfeifer,

Thank you so much for your input and guidance. Perhaps my last question has to do with the nominal exchange rate. I am aware nominal variable have unit roots, and in my model my nominal exchange rate does. Is there a way to get rid of this unit root other than normalising the nominal exchange rate to 1?

I want to obtain the variance decompositions and with the unit root, some of the variances are NaNs.

There is usually no way to get rid of this unit root. It comes from price level targeting. Normalization would not help. What you should do is consider the FEVD of NER changes, not the level.

I am simulating the model, from what I have seen and understand FEVD is for estimation. Or is there a way to apply it to simulation?

This is what the conditional_variance_decomposition option of stoch_simul does.

Dear Prof. Johannes,

Thank you for the responses and input so far. I have a question about inflation feedback in the Taylor rule when specifying monetary policy rule. Can I have zero feedback from inflation in my taylor rule?
I have recently found out that my taylor rule allows zero inflation feedback but does not allow zero output gap feedback. Is this indicative of a problem in the model?

Regards

That very much depends on the model at hand. But it is rather strange that a model satisfies the Taylor principle without inflation feedback.