# Problem about welfare loss in dynare

Dear Professor Pfeifer,

I have written the code of my model in exp() form.
But if I want to calculate welfare loss like W={{\lambda }_{1}}\operatorname{var}\left( {{\pi }_{t}} \right)+{{\lambda }_{2}}\operatorname{var}\left( {{y}_{t}} \right), do I need to transfer the code to level form and then use order=2 option? Or just use exp() form and order=2 option? Are the value of \operatorname{var}\left( {{\pi }_{t}} \right) and \operatorname{var}\left( {{y}_{t}} \right) identical or not in these two cases?

And also, I see in many papers the values of {{\lambda }_{1}} and {{\lambda }_{2}} are sometimes subjective. Is it proper to set the value like this and do robustness test?

1. Yes, there is obviously a difference in standard deviations for the level as opposed to percentage deviations. If you use auxiliary variables, you can have both objects in your model.
2. It depends whether you want to work with an ad-hoc loss function or a micro-founded one based on agents in the model.

Dear Professor Pfeifer,

Sorry to bother again.

To the first question, Are there any differences in economic meaning between the values I gain in these two cases? Which case is more generally used?

And I have got two new problems as follows when typing the code.
(1)What should be the correct definition of output gap in dynare code if I use exp() form?
Is
outputgap=exp(y(t))-exp(ystar(t));
correct？

(2) How to deal with taylor rule equation in the code with both sticky and flexible price?
I write both the two equations in the code while only one has monetary policy shock in it(as follows). Is it correct?

exp(RU) = RUU^(1 - rhoRUU )
* (exp(RU(-1)))^rhoRUU
* (exp(piU)/piUU)^( rhopiUU*(1-rhoRUU) )
* (exp(yU)/exp(yU(-1)))^( rhoyUU*(1-rhoRUU) )
* (1-e_R);

exp(R_flexU) = R_flexUU^(1 - rhoRUU )
* (exp(R_flexU(-1)))^rhoRUU
* (exp(pi_flexU)/pi_flexUU)^( rhopiUU*(1-rhoRUU) )
* (exp(y_flexU)/exp(y_flexU(-1)))^( rhoyUU*(1-rhoRUU) );


1. What do you mean? Percentage deviations are unitless and have an easy interpretation. That’s often not the case for levels, which depend on the units/scaling. For that reason, logs are typically used.
2. Again, don’t do a full exp()-substitution. Append auxiliary variables. See Question about understanding irfs in dynare . It will make your life a lot easier
3. If monetary neutrality holds in the flex-price model, then whether you include the shock or not does not matter. That being said, leaving it out is a lot more common.

Dear Professor Pfeifer,

1. Sorry if I did not make it clear. For instance, when I calculate welfare loss under level form, I use
piU_pos=strmatch('piU',var_list_ ,'exact');
variance.piU=oo_.var(piU_pos,piU_pos);
and
y_gapU_pos=strmatch('y_gapU',var_list_ ,'exact');
variance.y_gapU=oo_.var(y_gapU_pos,y_gapU_pos);
in which piU is the level form of inflation and y_gapU=yU-y_natureU. Welfare loss is caculated by
welfare=variance.piU+0.05*variance.y_gapU;
and the value is 0.06. (Please point out if I make any mistake in the process as I’m really not familiar with this)
While when I calculate welfare loss under log-level form, I use
log_piU_pos=strmatch('log_piU',var_list_ ,'exact');
variance.log_piU=oo_.var(log_piU_pos,log_piU_pos);
and
y_gapU_pos=strmatch('y_gapU',var_list_ ,'exact');
variance.y_gapU=oo_.var(y_gapU_pos,y_gapU_pos);
in which log_piU=log(piU) and y_gapU=(yU-y_natureU)/y. Welfare loss is caculated by
welfare=variance.log_piU+0.05*variance.y_gapU;
and the value is 0.00005. (Also please point out if I make any mistake in the process)
Is there any difference in economic meaning between these two values(0.6 and 0.00005)?

2. So the definition equation of outputgap in level form is written as y_gapU=yU-y_natureU and y_gapU=(yU-y_natureU)/y in log-level form, did I make it correctly?

3. If I do not include the taylor rule equation under flex-price situation, It seems there is a lack of one equation. Do I misunderstand anything?

1. Yes, that makes a difference. Only one of the two formulations is correct. Your model should determine whether the welfare loss is a function of the levels or the logs. Usually, it is the logs, because it is derived from a log approximation to utility.
2. If both have the same steady state, then yes.
3. The Taylor rule will only affect inflation, but nothing else. So you could write down the flex-price model purely in real terms.

Dear Professor Pfeifer,

1. To the 3rd question, what’s the meaning of “write down the flex-price model purely in real terms”?

2. And also, I see in some papers that output gap(in welfare loss function) is just treated as the deviation from the steady state instead of nature output. Is it proper to deal with it like this?

3. In a developing country with relatively high output growth, is it more advisable using y(t)/y(t-1) instead of y(t)/y in the Taylor Rule?

Sorry for bothering. Partial support to your thought of