Collinear equations and variables

chp7_2.mod (2.8 KB)

Hi, I am trying to replicate the code for Schmitt Grohe-Uribe’s “Open economy macroeconomics”, chapter 7, “Terms of trade”. As I’m running the code all the residuals are zero (I have added some residuals in the model though) , but code doesn’t work as in the model diagnostics it gives such error:

MODEL_DIAGNOSTICS:  The Jacobian of the static model is singular

MODEL_DIAGNOSTICS: there is 2 colinear relationships between the variables and the equations

what can I do to erase that error and to make code work ?
Thank you so much.

Here is my code

var beta_fun  
c 
h 
k
d
p_c
w
u
eta
lambda
r
util
c_t
c_n
p_t
p_n
c_x
c_m
p_x
y_x
a_x
k_x
y_m
a_m
k_m
y_n
a_n
h_n
i;


varexo eps_p eps_t eps_n v_t;

parameters omega beta delta phi r_star gamma mu x alpha alpha_x alpha_m alpha_n rho psi_t psi_n d_bar;

omega=0.79;
beta=0.009;
delta=0.1;
phi=0.028;
r_star=0.04;
gamma=2.61;
mu=-0.22;
x=0.3;
alpha=0.15;
alpha_x=0.57;
alpha_m=0.70;
alpha_n=0.34;
rho=0.41;
psi_t=-0.156;
psi_n=0.74;
d_bar  = 0.7442; 

model;
#beta_ss=(1+c*(1-h)^omega)^(-beta);
#n_ss=beta_ss-1/(1+r);  

//1.
beta_fun=(1+c*(1-h)^omega)^(-beta)-n_ss;


//2.
k=(1-delta)*k(-1)+i-phi/2*(k-k(-1))^2;

//3.
d=(1+r_star)*d(-1)+p_c*c+i-w*h-u*k;

//4.
((1-h)^omega)*((c*(1-h)^omega)^(-gamma)+eta*beta*(1+c*(1-h)^omega)^(-beta-1))=lambda*p_c;


//5.
(c*omega*(1-h)^(omega-1))*((c*(1-h)^omega)^(-gamma)+beta*eta*(1+c*(1-h)^omega)^(-beta-1))=lambda*w;

//6.
lambda*(1+phi*(k-k(-1)))=(1+c*(1-h)^omega)^beta+lambda(+1)*(u(+1)+1-delta+phi*(k(+1)-k))-1.0216+2.9294e-05;

//7.
util=((c*(1-h)^omega)^(1-gamma))/(1-gamma);

//8.
eta=-util(+1)+eta(+1)*beta_fun(+1) ;

//9.
c=(x*(c_t)^(-mu)+(1-x)*(c_n)^(-mu))^(-1/mu)+5.115+5.4668e-06;

//10.
c_n/c_t=(((1-x)/x)^(1/(1+mu)))*((p_t/p_n)^(1/(1+mu)));

//11.
c/c_t=((1/x)^(1/(1+mu)))*((p_t/p_c)^(1/(1+mu)));

//12.
c_t=(c_x^alpha)*(c_m)^(1-alpha)+0.70959+3.4391e-06;

//13.
(p_x*c_x)/(p_t*c_t)=alpha;

//14.
c_m/(p_t*c_t)=1-alpha;

//15.
y_x=a_x*(k_x)^alpha_x;

//16.
y_m=a_m*(k_m)^alpha_m;

//17.
y_n=a_n*(h_n)^alpha_n;

//18.
(u*k_x)/(p_x*y_x)=alpha_x;

//19.
(u*k_m)/y_m=alpha_m;

//20.
(w*h_n)/(p_n*y_n)=alpha_n+0.00040343;

//21.
h=h_n;

//22.
c_n=y_n+5.8987+-7.501e-06;

//23.
log(p_x)=rho*log(p_x(-1))+eps_p;

//24.
log(a_x)=rho*log(a_x(-1))+eps_t;

//25.
log(a_m)=rho*log(a_m(-1))+eps_t;

//26.
log(a_n)=rho*log(a_n(-1))+eps_n;

//27.
eps_t=psi_t*eps_p+v_t;

//28.
eps_n=psi_n*eps_t;

//29.
k=k_x+k_m;

end;

steady_state_model;
r=r_star;
beta_fun=1/(1+r);
d=d_bar;
p_c=1;
p_n=1;
p_t=1;
p_x=1;
a_x=1;
a_m=1;
a_n=1;
u=1/beta_fun-(1-delta);
k_x=(u/alpha_x)^(1/(alpha_x-1));
k_m=(u/alpha_m)^(1/(alpha_m-1));
k=k_x+k_m;
i = delta*k;
y_x=(k_x)^alpha_x;
y_m=(k_m)^alpha_m;
h=0.0089;
w= omega*(u*k-r_star*d-i)/(1-h-omega*h);
c=1/p_c*(w*h+u*k-r_star*d-i);
util=(c*(1-h)^omega)^(1-gamma)/(1-gamma);
 eta=util/(beta_fun-1); 
lambda=(1-h)^omega*((c*(1-h)^omega)^(-gamma)+eta*beta*(1+c*(1-h)^omega)^(-beta-1));
h_n=h;
y_n=h_n^alpha_n;
c_t=c/(1/x)^(1/(1+mu));
c_n=c_t*((1-x)/x)^(1/(1+mu));
c_x=alpha*c_t;
c_m=(1-alpha)*c_t;

end;

resid(1);
steady;
check;


shocks;
var eps_p; stderr 1;
var eps_t; stderr 1.2;
   var eps_n; stderr  2.1;
var v_t; stderr   2.3;
end;

stoch_simul(order=1,irf=20)  c c_t;

It may be related to Timing of capital in two sector economy