Dynare Estimation: help
Posted: Thu Apr 16, 2015 8:22 am
I want to do estimation on Paper "Monetary policy and exchange rate volatility in a small open economy".
I got the following wrong informaiton
Warning: Matrix is singular, close to singular or badly scaled.
Results may be inaccurate. RCOND = NaN.
> In missing_DiffuseKalmanSmootherH1_Z at 175
In DsgeSmoother at 197
In dynare_estimation_1 at 836
In dynare_estimation at 89
In gali_monacelliEst at 259
In dynare at 180
However, i could not find the reason. Can anybody help me?
The program is as follows:
// Gali & Monacelli, NBER w.p. 8905, April 2002
// Typed and annotated by Jamie Hall, May 2009
// Dynare 4.0.3
var y_os mc_os ppi_os r_os a_os a ygap ppi_h rnat r y yflex ppi s q e p_h cpi_level;
varexo eps_a_os eps_a;
parameters epsilon rho_a rho_a_os a_shock_correl;
epsilon = 6; // Dixit-Stiglitz parameter for within-sector consumption (4)
rho_a = 0.9;// Parameters of the productivity shocks (p.19)
rho_a_os = 0.9;//parameters epsilon rho_a rho_a_os a_shock_correl;
a_shock_correl = 0.77;
model(linear);
#beta = 0.994; // Pure temporal discount factor
#sigma = 1; // Intertemporal consumption elastiticy
#alpha = 0.4; // Degree of 'openness' in the Home economy
#eta = 1; // Elast. of sub. between Home and Foreign goods
#phi = 3; // Labour disutility parameter (7)
#kappa_a = lambda*(phi + (sigma/omega_a)); // Real rigidity; see note to (40)
#theta = 0.75; // Calvo probability
#lambda = (1-(beta*theta))*(1-theta)/theta; // Coefficient on marginal cost in the Phillips Curve
#omega_a = 1 + alpha*(2-alpha)*(sigma*eta - 1); // See note to (25)
#BigTheta_a = sigma*(1-omega_a)/(sigma + phi*omega_a); // note to (39)
#BigPhi_a = (1-alpha)/omega_a; // (27)
// Monetary policy in the World economy
#phi_a_os = -(sigma*(1+phi)*(1-rho_a_os)) / (phi+sigma); // See (51) and the discussion there
#phi_ppi_os = 1.01;
#BigGamma_a = omega_a*(1+phi)/(sigma+phi*omega_a); // Bottom of p.13
// Note: in Monacelli's Gauss code, "q" stands for the Terms o' Trade, whereas
// in the NBER paper it stands for the Real Exchange Rate. I've followed the NBER paper.
y_os = y_os(+1) - (r_os - ppi_os(+1))/sigma; // Foreign's Euler eqn, log-deviation form of (22)
mc_os = (sigma + phi)*y_os - (1+phi)*a_os; // Foreign's marginal cost, log-deviation form of (32)
ppi_os = beta*ppi_os(+1) + lambda*mc_os; // Foreign's Phillips curve (31)
r_os = phi_ppi_os*ppi_os(+1) + phi_a_os*a_os; // Foreign's Taylor rule --- (51) and see also n. 19;
// equivalently, you can specify "ppi_os=0;".
a_os = rho_a_os*a_os(-1) + eps_a_os; // Foreign's technology process
a = rho_a*a(-1) + eps_a + a_shock_correl*eps_a_os; // Home's technology process
ygap = ygap(+1) - (omega_a/sigma)*(r - ppi_h(+1) - rnat); // Home's IS curve (41)
ppi_h = beta*ppi_h(+1) + kappa_a*ygap; // Home's Phillips curve (40)
rnat = -((sigma*(1+phi)*(1-rho_a))/(sigma + phi*omega_a))*a - phi*BigTheta_a*(y_os(+1) - y_os);
// Home's Wicksellian interest rate (41)
//Home's monetary policy; comment out all but one of these:
r = 0.5*r(-1) + 1.5*ppi + 0.2*ygap;
yflex = BigGamma_a*a + BigTheta_a*y_os; // Home's flexprice output deviation (39)
y = yflex + ygap; // Definition of Home output (p. 13)
y = y_os + (omega_a/sigma)*s; // Market clearing (25)
ppi = ppi_h + alpha*(s - s(-1)); // Home CPI inflation (11)
q = (1-alpha)*s; // Real exchange rate (13)
s - s(-1) = e - e(-1) + ppi_os - ppi_h; // Differenced version of (12)
p_h = p_h(-1) + ppi_h; // An identity to pin down the relative price of home goods
cpi_level = cpi_level(-1) + ppi; // " " " " " " consumer price level
end;
steady;
check;
shocks;
var eps_a; stderr 1;
var eps_a_os; stderr 2;
end;
estimated_params;
stderr eps_a_os, inv_gamma_pdf,1.08, 10;
stderr eps_a, inv_gamma_pdf, 2.08, 10;
epsilon, normal_pdf, 6.02, 0.5;
rho_a, beta_pdf, 0.9, 0.1;
rho_a_os, beta_pdf, 0.5, 0.1;
a_shock_correl, beta_pdf, 0.77, 0.1;
end;
varobs y e;
estimation(datafile = simuldataGali1, xls_sheet = Dynare, xls_range =B2:C82, nobs=80, mode_compute=6, mode_check, mh_replic=2000);
The data is attached here.
I got the following wrong informaiton
Warning: Matrix is singular, close to singular or badly scaled.
Results may be inaccurate. RCOND = NaN.
> In missing_DiffuseKalmanSmootherH1_Z at 175
In DsgeSmoother at 197
In dynare_estimation_1 at 836
In dynare_estimation at 89
In gali_monacelliEst at 259
In dynare at 180
However, i could not find the reason. Can anybody help me?
The program is as follows:
// Gali & Monacelli, NBER w.p. 8905, April 2002
// Typed and annotated by Jamie Hall, May 2009
// Dynare 4.0.3
var y_os mc_os ppi_os r_os a_os a ygap ppi_h rnat r y yflex ppi s q e p_h cpi_level;
varexo eps_a_os eps_a;
parameters epsilon rho_a rho_a_os a_shock_correl;
epsilon = 6; // Dixit-Stiglitz parameter for within-sector consumption (4)
rho_a = 0.9;// Parameters of the productivity shocks (p.19)
rho_a_os = 0.9;//parameters epsilon rho_a rho_a_os a_shock_correl;
a_shock_correl = 0.77;
model(linear);
#beta = 0.994; // Pure temporal discount factor
#sigma = 1; // Intertemporal consumption elastiticy
#alpha = 0.4; // Degree of 'openness' in the Home economy
#eta = 1; // Elast. of sub. between Home and Foreign goods
#phi = 3; // Labour disutility parameter (7)
#kappa_a = lambda*(phi + (sigma/omega_a)); // Real rigidity; see note to (40)
#theta = 0.75; // Calvo probability
#lambda = (1-(beta*theta))*(1-theta)/theta; // Coefficient on marginal cost in the Phillips Curve
#omega_a = 1 + alpha*(2-alpha)*(sigma*eta - 1); // See note to (25)
#BigTheta_a = sigma*(1-omega_a)/(sigma + phi*omega_a); // note to (39)
#BigPhi_a = (1-alpha)/omega_a; // (27)
// Monetary policy in the World economy
#phi_a_os = -(sigma*(1+phi)*(1-rho_a_os)) / (phi+sigma); // See (51) and the discussion there
#phi_ppi_os = 1.01;
#BigGamma_a = omega_a*(1+phi)/(sigma+phi*omega_a); // Bottom of p.13
// Note: in Monacelli's Gauss code, "q" stands for the Terms o' Trade, whereas
// in the NBER paper it stands for the Real Exchange Rate. I've followed the NBER paper.
y_os = y_os(+1) - (r_os - ppi_os(+1))/sigma; // Foreign's Euler eqn, log-deviation form of (22)
mc_os = (sigma + phi)*y_os - (1+phi)*a_os; // Foreign's marginal cost, log-deviation form of (32)
ppi_os = beta*ppi_os(+1) + lambda*mc_os; // Foreign's Phillips curve (31)
r_os = phi_ppi_os*ppi_os(+1) + phi_a_os*a_os; // Foreign's Taylor rule --- (51) and see also n. 19;
// equivalently, you can specify "ppi_os=0;".
a_os = rho_a_os*a_os(-1) + eps_a_os; // Foreign's technology process
a = rho_a*a(-1) + eps_a + a_shock_correl*eps_a_os; // Home's technology process
ygap = ygap(+1) - (omega_a/sigma)*(r - ppi_h(+1) - rnat); // Home's IS curve (41)
ppi_h = beta*ppi_h(+1) + kappa_a*ygap; // Home's Phillips curve (40)
rnat = -((sigma*(1+phi)*(1-rho_a))/(sigma + phi*omega_a))*a - phi*BigTheta_a*(y_os(+1) - y_os);
// Home's Wicksellian interest rate (41)
//Home's monetary policy; comment out all but one of these:
r = 0.5*r(-1) + 1.5*ppi + 0.2*ygap;
yflex = BigGamma_a*a + BigTheta_a*y_os; // Home's flexprice output deviation (39)
y = yflex + ygap; // Definition of Home output (p. 13)
y = y_os + (omega_a/sigma)*s; // Market clearing (25)
ppi = ppi_h + alpha*(s - s(-1)); // Home CPI inflation (11)
q = (1-alpha)*s; // Real exchange rate (13)
s - s(-1) = e - e(-1) + ppi_os - ppi_h; // Differenced version of (12)
p_h = p_h(-1) + ppi_h; // An identity to pin down the relative price of home goods
cpi_level = cpi_level(-1) + ppi; // " " " " " " consumer price level
end;
steady;
check;
shocks;
var eps_a; stderr 1;
var eps_a_os; stderr 2;
end;
estimated_params;
stderr eps_a_os, inv_gamma_pdf,1.08, 10;
stderr eps_a, inv_gamma_pdf, 2.08, 10;
epsilon, normal_pdf, 6.02, 0.5;
rho_a, beta_pdf, 0.9, 0.1;
rho_a_os, beta_pdf, 0.5, 0.1;
a_shock_correl, beta_pdf, 0.77, 0.1;
end;
varobs y e;
estimation(datafile = simuldataGali1, xls_sheet = Dynare, xls_range =B2:C82, nobs=80, mode_compute=6, mode_check, mh_replic=2000);
The data is attached here.