can solve model without var_obs, but not with
Posted: Mon Sep 13, 2010 1:30 am
I'm just about to run my first estimation code, but I don't think I've incorporated observable variables properly. My model is log-linear and stationary in technology so it should be relatively easy. My code for the simple solution is:
This gives me steady state values of:
Next, I want to add the three measurement equations that relate the model variables to the data:
Where s, the vector of model variables is:
I've updated my code to include the steady state values of y, pi, r and u and added the three measurement equations above:
only now I'm told that Dynare can't calculate the steady state.
I've tried entering the observables as regular variables to get steady state values in the simple code, which gives me
but it still produces the same error as above when I try to run the estimation. Would someone mind letting me know what I've done wrong?
- Code: Select all
var y pi r u yf uf d z a ;
varexo eps_d eps_z eps_a eps_r;
parameters tau h omega beta eta phi_pi phi_y rho_r rho_d rho_z rho_a
gamma_star pi_star sigma_r sigma_d sigma_z sigma_a;
tau = 1.86;
h = 0.5;
omega = 0.66;
eta = 1.0;
phi_pi = 1.5;
phi_y = 0.5;
rho_r = 0.5;
rho_d = 0.5;
rho_z = 0.5;
rho_a = 0.5;
gamma_star = 0.5;
pi_star = 3.36;
sigma_r = 0.5;
sigma_d = 0.5;
sigma_z = 0.5;
sigma_a = 0.5;
beta = 0.9925;
model;
// equation 5
u - y = u(+1) - y(+1) + r - pi(+1);
// equation 6+7
u = ((1-tau)/(1-beta*h))*(1+beta*h^2) - h*y(-1) - beta*h*y(+1) +
(1/1-beta*h)*d - (beta*h/1-beta*h)*d(+1);
// equation 13 (NKPC) -- substituting nf for n in the d+eta term.
// Also, C=Y => c=y, from equilibrium condition between 4 and 5
pi = beta*pi(+1) + ((1-beta*omega)*(1-omega)/omega)*(d + eta*(y-a) - u + y - a)
+ ((1-omega)/omega)*(z - beta*omega*z(+1));
// equation 16
yf = a + (1/(1+eta))*uf - (1/(1+eta))*d;
// equation 17
uf = ((1-tau)/(1-beta*h))*((1+beta*h^2)*yf - h*yf(-1) - beta*h*yf(+1)) +
(1/(1-beta*h))*d - ((beta*h)/(1-beta*h))*d(+1);
// equation 18 (Taylor rule)
r = rho_r*r(-1) + (1-rho_r)*(phi_pi*pi + phi_y*(y-yf)) + eps_r;
// equations 19-21
d = rho_d*d(-1) + eps_d;
z = rho_z*z(-1) + eps_z;
a = rho_a*a(-1) + eps_a;
end;
initval;
y = 0.0;
pi = 0.0;
r = 0.0;
u = 0.0;
yf = 0.0;
uf = 0.0;
d = 0.0;
z = 0.0;
a = 0.0;
end;
steady;
check;
This gives me steady state values of:
- Code: Select all
y -0.701275
pi 0.701275
r 0.701275
u -1.43215
yf 0
uf 0
d 0
z 0
a 0
Next, I want to add the three measurement equations that relate the model variables to the data:
Where s, the vector of model variables is:
I've updated my code to include the steady state values of y, pi, r and u and added the three measurement equations above:
- Code: Select all
var y pi r u yf uf d z a YGR INFLATION INT;
varexo eps_d eps_z eps_a eps_r;
parameters tau h omega r_star eta phi_pi phi_y rho_r rho_d rho_z rho_a
gamma_star pi_star sigma_r sigma_d sigma_z sigma_a;
model;
// defining the transformation of estimated param r_star
# beta = exp(r_star/400)^-1;
// equation 5
u - y = u(+1) - y(+1) + r - pi(+1);
// equation 6+7
u = ((1-tau)/(1-beta*h))*(1+beta*h^2) - h*y(-1) - beta*h*y(+1) +
(1/1-beta*h)*d - (beta*h/1-beta*h)*d(+1);
// equation 13 (NKPC) -- substituting nf for n in the d+eta term.
// Also, C=Y => c=y, from equilibrium condition between 4 and 5
pi = beta*pi(+1) + ((1-beta*omega)*(1-omega)/omega)*(d + eta*(y-a) - u + y - a)
+ ((1-omega)/omega)*(z - beta*omega*z(+1));
// equation 16
yf = a + (1/(1+eta))*uf - (1/(1+eta))*d;
// equation 17
uf = ((1-tau)/(1-beta*h))*((1+beta*h^2)*yf - h*yf(-1) - beta*h*yf(+1)) +
(1/(1-beta*h))*d - ((beta*h)/(1-beta*h))*d(+1);
// equation 18 (Taylor rule)
r = rho_r*r(-1) + (1-rho_r)*(phi_pi*pi + phi_y*(y-yf)) + eps_r;
// equations 19-21
d = rho_d*d(-1) + eps_d;
z = rho_z*z(-1) + eps_z;
a = rho_a*a(-1) + eps_a;
// equations with observables
YGR = gamma_star + y - y(-1);
INFLATION = pi_star + 4*pi;
INT = r_star + pi_star + 4*r;
end;
varobs YGR, INFLATION, INT;
initval;
y = -0.701275;
pi = 0.701275;
r = 0.701275;
u = -1.43215;
yf = 0.0;
uf = 0.0;
d = 0.0;
z = 0.0;
a = 0.0;
end;
steady;
check;
estimated_params;
tau, gamma_pdf, 1.86, 0.00053849453622487;
h, beta_pdf, 0.50, 8.04044774925387;
omega, beta_pdf, 0.66, 451.441666380238;
r_star, gamma_pdf, 3.0, 0.0067665251;
eta, gamma_pdf, 1.0, 0.0040000270;
phi_pi, gamma_pdf, 1.50, 0.0004983714;
phi_y, gamma_pdf, 0.50, 0.0000943928;
rho_r, beta_pdf, 0.50, 7.3977015267;
rho_d, beta_pdf, 0.50, 7.3977015267;
rho_z, beta_pdf, 0.50, 7.3977015267;
rho_a, beta_pdf, 0.50, 8.0404477493;
gamma_star, gamma_pdf, 0.50, 10.4443996210;
pi_star, gamma_pdf, 3.36, 0.0620955159;
sigma_r, inv_gamma_pdf, 0.50, 0.0660840873;
sigma_d, inv_gamma_pdf, 0.50, 0.0660840873;
sigma_z, inv_gamma_pdf, 0.50, 0.0660840873;
sigma_a, inv_gamma_pdf, 0.50, 0.0660840873;
end;
estimation(datafile=hirose, mh_replic=50000, mh_nblocks=5);
only now I'm told that Dynare can't calculate the steady state.
- Code: Select all
Starting MATLAB/Octave computing.
STEADY: numerical initial values incompatible with the following equations
2 3 4 5 6 7 8 9 10 11 12
??? Error using ==> dynare_solve at 82
exiting ...
Error in ==> steady_ at 124
[oo_.steady_state,check] = dynare_solve([M_.fname '_static'],...
Error in ==> steady at 52
steady_;
Error in ==> hirose at 152
steady;
Error in ==> dynare at 132
evalin('base',fname) ;
I've tried entering the observables as regular variables to get steady state values in the simple code, which gives me
- Code: Select all
YGR 0.5
INFLATION 6.1651
INT 9.1651
but it still produces the same error as above when I try to run the estimation. Would someone mind letting me know what I've done wrong?