# Bayesian estimation of simple output gap filter model

Hello,
I am trying to estimate (Bayesian) a very simple filter model. My model is non-stationary, so I am using the diffuse filter.
When I try and run the model, dynare gets stuck at what appears to be a minimisation routine (“Initial value of the log posterior (or likelihood): -Inf”).

I believe this is dynare trying to find a plausible steady state for the model. I wasn’t clear why it needed to do this given the model is already linearized. I am also able to run the exact same model in IRIS and perform a maximum likelihood estimation with no problem.

I am probably missing something obvious but would appreciate any pointers. Thanks! (can post data and code):

var LGDP LGDP_BAR Y G PIE GROWTH InfE UNR UNR_BAR UNR_GAP G_UNR_BAR LGDP_ PIE_ UNR_ InfE_ GROWTH_;

varexo RES_LGDP_BAR RES_G RES_Y RES_PIE RES_InfE RES_UNR_GAP RES_UNR_BAR RES_G_UNR_BAR;

parameters beta lambda lambda2 phi growth_ss tau1 tau2 tau3;

lambda= 0.6896;
lambda2 = 0.2;
beta = 0.1032;
phi = 0.9882;
tau1 = 0.1946;
tau2 = 0.5522;
tau3 = 0.9;

model(linear);
LGDP = LGDP_BAR + Y;

``````// Stochastic process for potential output level
LGDP_BAR = LGDP_BAR(-1) + G + RES_LGDP_BAR;

// Stochastic process for growth rate of potential
G = G(-1) + RES_G;

// Stochastic process for output gap
Y = phi*Y(-1) + RES_Y;

// Philips curve
PIE = lambda*InfE+(lambda2)*PIE(-1) + beta*Y + RES_PIE;

// Inf E
InfE = InfE(-1)+RES_InfE;

// Growth definition
GROWTH = LGDP-LGDP(-1);

// NAIRU definition
UNR_BAR = UNR + UNR_GAP;

// Dynamic Okun's law
UNR_GAP =  tau2*UNR_GAP(-1) + tau1*Y + RES_UNR_GAP;

// Stochastic process for NAIRU
UNR_BAR =  UNR_BAR(-1) + G_UNR_BAR + RES_UNR_BAR;

// Stochastic process for the change in NAIRU
G_UNR_BAR = (tau3)*G_UNR_BAR(-1) + RES_G_UNR_BAR;

// observation equations
LGDP_ = LGDP;
PIE_ = PIE;
InfE_ = InfE;
GROWTH_ = GROWTH;
UNR_ = UNR;
``````

end;

shocks;
var RES_LGDP_BAR; stderr 0.0328;
var RES_G; stderr 0.0324;
var RES_Y; stderr 0.5772;
var RES_PIE; stderr 0.4104;
var RES_InfE; stderr 0.0587;
var RES_UNR_GAP; stderr 0.0695;
var RES_UNR_BAR; stderr 0.0251;
var RES_G_UNR_BAR; stderr 0.0322;

end;

initval;
LGDP = 0;
LGDP_BAR = 0;
Y = 0;
G = 0;
PIE = 0;
GROWTH = 0;

InfE = 0;
UNR = 0;
UNR_BAR = 0;
UNR_GAP = 0;
G_UNR_BAR = 0;
LGDP_ = 0;
PIE_ = 0;
InfE_= 0;

UNR_ = 0;
end;

//check;
//check;

estimated_params;
lambda, normal_pdf, 0.5, 0.4;
lambda2, normal_pdf, 0.5, 0.4;
beta, normal_pdf, 0.1, 0.2;
phi, normal_pdf, 0.6, .2;
tau1, normal_pdf, 0.2, 0.2;
tau2, normal_pdf, 0.3, 0.2;
tau3, normal_pdf, 0.5, inf;

stderr RES_LGDP_BAR, inv_gamma_pdf, 0.1, inf;
stderr RES_G, inv_gamma_pdf, 0.1, inf;
stderr RES_Y, inv_gamma_pdf, 1, inf;
stderr RES_InfE, inv_gamma_pdf, 1, inf;
stderr RES_PIE, inv_gamma_pdf, 1, inf;
stderr RES_UNR_GAP, inv_gamma_pdf, 1, inf;
stderr RES_UNR_BAR, inv_gamma_pdf, 0.1, inf;
stderr RES_G_UNR_BAR, inv_gamma_pdf, 0.1, inf;
end;

varobs LGDP_ PIE_ UNR_ InfE_ GROWTH_;

estimation(order=1, datafile=import_dyn, nobs=74, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8, diffuse_filter);

Can you attach the mod and data files? Is your model backward?

There is at least a problem with the prior on `tau3`, infinite variance is not allowed with gaussian prior.

Best,
Stéphane.

Thanks a lot Stephane - you were right about the prior on tau3 - if I set that to 0.5 the iteration seems to work until I get the message “Matrix must be positive definite.”

I am still a bit confused about what dynare is actually doing at this stage of the estimation?

EA_lags.mod (2.5 KB)
filtermod.zip (12.1 KB)

You did not copy the error message, but I suppose you obtained it after the call to the optimization routine. It means that most probably it did not succeed in finding the mode of the posterior distribution.

We minimize minus the log posterior kernel (log prior plus log likelihood), so the hessian matrix at the optimum should be definite positive. This is important because we use the inverse of this matrix to approximate the posterior covariance matrix (used in the the proposal distribution of the metropolis). If this matrix is not positive definite, it means that the optimization failed and that you have to try different initial conditions and/or different optimization algorithms.

Best,
Stéphane.