I built a DSGE model to compare the effects of several monetary policies.
The welfare loss function is in the form of Woodford (2003) and Galí and Monacelli（2005）.
I would like to ask how to calculate the welfare loss value？How to write dynare command and who can give me an example?
I actually had to do the same recently.
You can get the welfare loss by running the model for a certain monetary policy and
then write your definition of the welfare loss in the command window. Instead of writing “pi^2” or “x^2”, you simply write oo_.var(i,i) where “i” is number of the variable (check in which order you have declared your endogenous variables in the modfile to determine “i” for "pi and “x”).
Alternatively, you can just write the equation for the welfare loss in the m.file (without semicolon at the end).
Mburr，thank you for your reply. I just don’t know how to write dynare command. Can you give me an example?
it’s something I would like to learn as well. hence I am here replying
Let’s say that you have declared these variables in the following order in your model:
“var y x pi c k”
Now, because “x” is the second declared variable, Dynare automatically save the variance of this variable (after running the model) as “oo_.var(2,2)”. Simiarly, the variance of “pi” will then be saved as “oo._var(3,3)” - because it’s the third declared variable.
Now you can write your welfare loss function in your command window (or in the m.file):
"- (1- alpha)/2beta ( epsilon/lambda * oo_.var(3,3) + (1+ phi)*oo_.var(2,2) ) "
In this way you can find a discrete welfare loss.
Mburr，thank you for your sharing. Your method looks simple and convenient.
In this forum，I saw this link.https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_2015/Gali_2015_chapter_4.mod
It should be the welfare loss function written by professor Pfeifer. I have some difficulty in understanding what these dynare code mean.
I would like to ask if the result is consistent with your method？If so，I will try your method.
The two approaches should generate the same results. The difference is that my code is robust to the typical user mistakes that can happen if one is not careful.
The essential components are:
- Reading out the required parameters via
- Getting the required variances via
- Computing the loss function based on these objects:
jpfeifer，thank you. I will try to understand and apply the dynare code.