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?

Looking forward to your reply and thank you for your time.

  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?

(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) );

Thanks again for your time.

  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');
    y_gapU_pos=strmatch('y_gapU',var_list_ ,'exact');
    in which piU is the level form of inflation and y_gapU=yU-y_natureU. Welfare loss is caculated by
    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');
    y_gapU_pos=strmatch('y_gapU',var_list_ ,'exact');
    in which log_piU=log(piU) and y_gapU=(yU-y_natureU)/y. Welfare loss is caculated by
    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?

Looking forward to your reply and thanks again for your precious time.

  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?

Thank you for your kindness.

Sorry for bothering. Partial support to your thought of

Please see:



  1. Flex price equilibria can usually be written down with referring to any nominal variables. For example. all that matters will be the real interest rate. But if that is too complicated, having a Taylor rule will give the same results. See e.g. DSGE_mod/Gali_2015_chapter_2.mod at master · JohannesPfeifer/DSGE_mod · GitHub
  2. It depends on what you are trying to do. The relevant welfare losses for optimal policy concern deviations from natural output (the efficient allocation), not steady state. What @HelloDynare refers to is a positive description of reality. Natural output is unobserved so that central banks often employ a gap measure with respect to something observable like the steady state. But it would not be valid to use this measure for a microfounded welfare analysis.
  3. Again, this is a matter of your objective. If you want to describe behavior of the central bank, check which rule better describes the actual behavior.