Then I don’t understand it. The way you write it down, you can simply sum the goods up, i.e. the are denominated in the same numeraire and there is no reason to convert them using the exchange rate.

This is fine. The model works under the law of one price. How ever whenever i change it to reflect deviations from this condition and add a Gap, dynare tells me that the nominal exchange rate equation is correlated with the variable capturing the deviation from the law of one price. The nominal exchange rate and Law of one price Gap equations are defined as

\begin{align}
E_t/E_{t-1} = \frac{\frac{S_t}{S_{t-1}} \Pi_t}{\Pi_t^*}\\
\frac{Gap_t}{Gap_{t-1}} = \frac{\frac{E_t}{E_{t-1}} \Pi_{H,t}^*}{\Pi_{H,t}}
\end{align}

Where E is nominal exchange rate and S is real exchange rate. Furthermore, we know that if we assume Gap=1 then we return back to the law of one price, the model works just fine. Similarly, if i normalise the nominal exchange rate to 1 i.e. E=1, the model works fine. I am so confused.

What do you mean with

? What is the error message?

I figured out the problem. My real exchange rate had an estrange value multiplying it. Thank you for your input.

Dear Prof. Pfeifer,

I have some follow up questions. I have computed welfrae in my simulation based on the simple welfare equation `welfare = U(c) + beta* welfare(+1)`

.

However, i would like to compute this welfare over a grid of inflation feedback parameter in taylor rule to see how welfare evolves based on the calibrated value of the feedback parameter. Similar to Gali and Monacelli (2016) as they looped over calvo parameters.

After going through the forum, this is what i have and i was wondering if you could give any comment

```
%----------------------------------------------
% Welfare computation
%----------------------------------------------
% Get variable positions in variable list:
Welfare_pos = strmatch('Welfare',var_list_, 'exact');
% Loop over the interval rho_pi element[0,1]:
space = 0.01:0.01:0.99;
% variances
variance.Welfare = zeros(length(space),1);
for ii = 1:length(space)
set_param_value('rho_pi',space(ii));
stoch_simul(periods=10000,order = 1, irf = 0, noprint)Welfare; % increase the periods for precision
variance.Welfare(ii) = oo_.var(Welfare_pos, Welfare_pos);
L(ii) =variance.Welfare(ii);
end
Graph = L./L(80);
xx=linspace(0,0.99,99);
plot(xx,Graph)
```

It should be something along the lines of

```
%----------------------------------------------
% Welfare computation
%----------------------------------------------
% Initial run
stoch_simul(periods=10000,order = 1, irf = 0, noprint)Welfare; % increase the periods for precision
% Get variable positions in variable list:
Welfare_pos = strmatch('Welfare',var_list_, 'exact');
% Loop over the interval rho_pi element[0,1]:
space = 0.01:0.01:0.99;
% variances
variance.Welfare = NaN(length(space),1);
L=NaN(length(space),1);
for ii = 1:length(space)
set_param_value('rho_pi',space(ii));
info = stoch_simul(var_list_);
if info
% parameter created problem, keep value at NaN
else
variance.Welfare(ii) = oo_.var(Welfare_pos,Welfare_pos);
L(ii) =variance.Welfare(ii);
end
end
Graph = L./L(80);
plot(space,Graph)
```

Thank you so much for the kind response i have applied it and it works. My final question relates to the welfare losses. Given i only simulate the model for a taylor rule, then my compensating variation is a \lambda_c that equates the unconditional expected utility to it’s value in the non-stochastic steady state i.e. a \lambda_c that solves

\begin{align}
E \sum_{t=o}^{\infty} U(C_t (1+ \lambda_c)) - V(N_{j,t}) = U(C(1-h)) - N({j}
\end{align}

Following your Born Pfeifer code, i can calculate the steady state welfare using the steady state values. So does \lambda_c the welfare loss euqal the welfare gap?. i.e.

\begin{align}
\lambda_c = (1-\beta)(Welfare_ss - Welfare_t)
\end{align}

Secondly, if this is true, how do i implement it in the loop so that i find the vwelfare losses given the looped over parameters.

Sorry, but I don’t understand what you are trying to do here. Please correct and elaborate on the above formulas.

Sorry for my rambling, but in essence, i am trying to calculate welfare loss. However, the analytical closed form loss function for my model is not readily available (following GM 2016).

So i’m asking what the difference between welfare loss and the welfare gap (you calculate in your Born-Pfeifer code).

\lambda above determines the fraction of consumption that equates the unconditional expected utility to utility in the non-stochastic steady state.

The welfare loss is just a difference in lifetime utilities. It is not expressed in terms of easily interpretable numbers. The welfare gap in constrast is measured in percent of consumption. It is often harder to obtain. In our Born/Pfeifer code we therefore approach this problem numerically.

It is this welfare loss i am interested in, and how to see the level of welfare loss across the looped policy parameters. I found the page about the same problem, what Phillip was trying to calculate

. Welfare cost of business cycles. So i want to find \lambda_c as well.

Within the loop, you can use the approach in our paper, i.e. call a function that computes the consumption equivalent \lambda_c, i.e. the `get_consumption_equivalent*.m`

at https://github.com/JohannesPfeifer/DSGE_mod/tree/master/Born_Pfeifer_2018/Welfare

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
```

- 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.