Problem(s) with DSGE estimation

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?
data_us.m (6.75 KB)
est.mod (2.48 KB)
shocks.pdf (9.07 KB)

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.

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!
shocks.pdf (9.07 KB)
usdata.xls (98.5 KB)
est.mod (2.48 KB)

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

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!
usdata.xls (52.6 KB)
nk.mod (2.76 KB)

No, you are still neglecting parameter dependence.

Thank you. But I am not estimating either RHO or BETA, so where is this parameter dependance coming from?

You estimate e.g. ALFA, but you define a parameter

which clearly depends on ALFA. The same holds true for KAPPA and others.

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?

No. Your model should look like this (using model local variables as documented in my Guide):

[code]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;

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;
ETA = 4;
FI_PI = 1.07;
FI_Y = 0.10;


RHO = 1/BETA-1;

yn = PSI_YA
a + AUX;
ygap = ygap(+1) - 1/SIGMA
y = ygap + yn;
r = i - pi(+1);
pi = BETA
pi(+1) + KAPPA
rn = RHO + SIGMAPSI_YA(a(+1)-a);
y = a + (1-ALFA)n;
m = pi + y - ETA
a = RHO_Aa(-1)+e_a;
u = RHO_U
ry = 4r;
iy = 4
piy = 4pi;
mr = m - pi;
mry = 4
i = RHO+FI_PIpi+FI_Yygap+v;
v = RHO_Vv(-1)+e_v;
pinfobs = 1
(pi) + constepinf;
robs = 1*(i) + conster;

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 = 4r;
iy = 4
piy = 4*pi;
You will recognize that you cannot estimate ctrend and constepinf. They are dependent parameters! You could estimate cr and cpie.

I see it now…thanks a ton