Problem(s) with DSGE estimation

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Problem(s) with DSGE estimation

Postby aiq » Mon Nov 17, 2014 3:25 pm

I am trying to estimate the simple Gali-type model (chapter 3).

I have the standard code (available online), and I simulate it to first check if everything is okay (no coding errors). Then I follow standard procedures and introduce the commands. The priors are selected from Smets and Wouters (2007). For the data I do the following transformations:

1) yobs: Take log(GDP/capita), then find the trend using HP filter with lambda = 1600, and then subtract the trend from log(GDP/capita) to find output deviations. The deviations are used in my analysis.
2) pinfobs: I take the log of the deflator for (t/t-1) and multiply it by 400 to get annualized rates. Then I subtract each observation with the long run mean.
3) Interest rate: Take log of federal funds rate.

Although my estimation results seem to be near perfect (and expected), the shocks look very strange and seem to (possibly) indicate some problems with stationarity (such as monetary policy shocks not being zero mean). I have followed the measurement equation pdf file step by step, so I do not know the issue.

My mod file, excel file and the plot of the figure of the shocks are attached. Does anybody know what is going on, and what I am doing wrong?
Attachments
data_us.m
(6.75 KiB) Downloaded 54 times
est.mod
(2.48 KiB) Downloaded 68 times
shocks.pdf
(9.07 KiB) Downloaded 68 times
aiq
 
Posts: 20
Joined: Sun Oct 19, 2014 1:32 pm

Re: Problem(s) with DSGE estimation

Postby jpfeifer » Mon Nov 17, 2014 5:07 pm

I have no clue what you are doing here. As documented in my Observation Equation Guide:
1. You need to account for parameter dependence using model-local variables
2. You should not use the HP-filter for detrending
3. You cannot map a net interest rate to a mean 0 interest rate.

Also, next time please provide a fully running set of files. Your data-file is not the one used in your mod-file. If you have problems with other file formats, please use zip or rar-archives.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem(s) with DSGE estimation

Postby aiq » Mon Nov 17, 2014 5:16 pm

My apologies, please the cleanest version with this message. A reply to your messages:

1. You need to account for parameter dependence using model-local variables. What does this mean?
2. How can I input output in a log linear model as it says the following in the file you are referring to:
Consider the case of output. Our model variable y_t represents log output deviations from the
long-term trend and has mean 0. Thus, it exactly corresponds to log empirical output per
capita detrended using any of the above filters that also takes out the mean. We denote this
detrended log output variables with yobs. Think of yobs for example as one-sided HP-filteredlog GDP per capita.
3. How do I map interest rates? I was following the advice given on page 40.

Thanks a lot, you are very helpful!
Attachments
shocks.pdf
(9.07 KiB) Downloaded 63 times
usdata.xls
(98.51 KiB) Downloaded 47 times
est.mod
(2.48 KiB) Downloaded 49 times
aiq
 
Posts: 20
Joined: Sun Oct 19, 2014 1:32 pm

Re: Problem(s) with DSGE estimation

Postby jpfeifer » Mon Nov 17, 2014 8:09 pm

1. See Remark 4 (Parameter dependence and the use of model-local variables) in Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf
2. I was talking about a ONE-SIDED HP-filter! You use a two-sided one. Better use first differences as Smets-Wouters did.
3. You should follow equation (42) of the guide which demeans the logged interest rate. You forgot the demeaning.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem(s) with DSGE estimation

Postby aiq » Tue Nov 18, 2014 4:32 pm

thanks a lot!

I have the same model attached, and I introduced measurement equations to follow Smets and Wouters (2007), and use their data. This seems to work, and gets me the clean results. Is this okay now?

Thanks for all your assistance!
Attachments
usdata.xls
(52.6 KiB) Downloaded 62 times
nk.mod
(2.76 KiB) Downloaded 60 times
aiq
 
Posts: 20
Joined: Sun Oct 19, 2014 1:32 pm

Re: Problem(s) with DSGE estimation

Postby jpfeifer » Mon Nov 24, 2014 5:45 pm

No, you are still neglecting parameter dependence.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem(s) with DSGE estimation

Postby aiq » Tue Nov 25, 2014 3:20 pm

Thank you. But I am not estimating either RHO or BETA, so where is this parameter dependance coming from?
aiq
 
Posts: 20
Joined: Sun Oct 19, 2014 1:32 pm

Re: Problem(s) with DSGE estimation

Postby jpfeifer » Tue Nov 25, 2014 3:25 pm

You estimate e.g. ALFA, but you define a parameter
Code: Select all
LAMBDA  =  ((1-THETA)*((1-BETA*THETA)/THETA)*(1-ALFA)/(1-ALFA+ALFA*EPSILON));

which clearly depends on ALFA. The same holds true for KAPPA and others.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem(s) with DSGE estimation

Postby aiq » Tue Nov 25, 2014 3:41 pm

Ok excellent I see it now. And the solution to this would be to estimate Lambda along with the ALFA, SIGMA, etc, or not estimate them at all?
aiq
 
Posts: 20
Joined: Sun Oct 19, 2014 1:32 pm

Re: Problem(s) with DSGE estimation

Postby jpfeifer » Tue Nov 25, 2014 3:55 pm

No. Your model should look like this (using model local variables as documented in my Guide):
Code: Select all
var  u, y, ygap, yn, pi, i, rn, n, a, r, ry, iy, piy, m, mr, mry,dy,robs,pinfobs,v;
varexo e_a e_u e_v;
parameters cgamma,cpie,RHO_V,ALFA, BETA, THETA, SIGMA, PHI, EPSILON, ETA, FI_PI, FI_Y, RHO_V, RHO_A, RHO_U;

RHO_V = 0.50;
RHO_U = 0.5;
RHO_A = 0.79;
ALFA    =  1/3;           
BETA    =  1.03^(-0.25);   
THETA   =  2/3;           
SIGMA   =  1.58;
PHI     =  1;
EPSILON =  6;         
ETA     =  4;           
FI_PI   =  1.07;
FI_Y    =  0.10;
cgamma=1.004;
cpie=1.005;


model(linear);                             
# RHO     =  1/BETA-1;
#LAMBDA  =  ((1-THETA)*((1-BETA*THETA)/THETA)*(1-ALFA)/(1-ALFA+ALFA*EPSILON));
#KAPPA   =  LAMBDA*(SIGMA + (PHI+ALFA)/(1-ALFA));
#PSI_YA  =  (1+PHI)/(PHI+ALFA+SIGMA*(1-ALFA));
#AUX     =  (1-ALFA)*(log(EPSILON/(EPSILON-1)-log(1-ALFA)))/(SIGMA*(1-ALFA)+PHI+ALFA);
#cr=cpie/(BETA*cgamma^(-SIGMA));
#ctrend=(cgamma-1)*100;
#conster=(cr-1)*100;
#constepinf=(cpie-1)*100;
yn     = PSI_YA*a + AUX;
ygap   = ygap(+1) - 1/SIGMA*(i-pi(+1)-rn);     
y      = ygap + yn;
r      = i - pi(+1);
pi     = BETA*pi(+1) + KAPPA*ygap+u;             
rn     = RHO + SIGMA*PSI_YA*(a(+1)-a);       
y      = a  + (1-ALFA)*n;                       
m      = pi + y - ETA*i;                         
a      = RHO_A*a(-1)+e_a;                                             
u      = RHO_U*u(-1)+e_u;
ry     = 4*r;                       
iy     = 4*i;                       
piy    = 4*pi;                     
mr     = m - pi;                   
mry    = 4*mr;                     
i = RHO+FI_PI*pi+FI_Y*ygap+v;
v = RHO_V*v(-1)+e_v;
dy=y-y(-1)+ctrend;
pinfobs = 1*(pi) + constepinf;
robs =    1*(i) + conster;
end;

initval;
ygap  = 0;
y     = 0;
yn    = 0;
m     = 0;
n     = 0;
pi    = 0;
i     = 1/BETA-1;
rn    = 1/BETA-1;
a     = 0;
v     = 0;
u     = 0;
r     = 1/BETA-1;
ry    = 4*r;
iy    = 4*i;
piy   = 4*pi;
end;

You will recognize that you cannot estimate ctrend and constepinf. They are dependent parameters! You could estimate cr and cpie.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem(s) with DSGE estimation

Postby aiq » Tue Nov 25, 2014 4:05 pm

I see it now..thanks a ton
aiq
 
Posts: 20
Joined: Sun Oct 19, 2014 1:32 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests