SOE model cannot get the steady state

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

SOE model cannot get the steady state

Postby Baymax » Thu Nov 19, 2015 10:21 am

Hi everyone, I am a fresh guy who is learning Dynare and DSGE now, I have written a SOE model but couldn't get the steady state, the Dynare told me I did wrong with some equations, but I didn't know how to deal with this equations and wrong steady state. If someone would love to help me, please contact with me, I really wanna get close to DSGE and lead to a high level. Thanks ! Looking forward to replying.
Code: Select all
// two countries, two sectors in each country, tradable goods and nontradable goods;
//consumers in each country consum export goods, import goods and domestic goods;
// endogenous variables

var p p_s pt pt_s pn pn_s pm px_s s c c_s ct ct_s cn cn_s cx cx_s cm cm_s
    yn yn_s yx yx_s kx kx_s kn kn_s h h_s hn hn_s hx hx_s i i_s ix ix_s in in_s
    w w_s wx wx_s wn wn_s rx rx_s rn rn_s B B_s r r_s T T_s g g_s e a a_s;

//exogenous variables

varexo eps_a eps_as eps_g eps_gs;

//parameters

parameters miu miu_s omega lam lam_s gam gam_s thet thet_s alpha alpha_s bet delta delta_s tao tao_s
           phi phi_s sigma sigma_s  rho_g rho_gs kappa kappa_s x rho_a rho_as a_shock_correl
//steady state values of endogenous variables

 C_bar C_sbar CX_bar CX_sbar CM_bar CM_sbar CN_bar CN_sbar CT_bar CT_sbar Y_bar Y_sbar YX_bar YX_sbar
YN_bar YN_sbar W_bar W_sbar WN_bar WN_sbar WX_bar WX_sbar R_bar R_sbar RX_bar RX_sbar E_bar
RN_bar RN_sbar HN_bar HN_sbar HX_bar HX_sbar H_bar H_sbar KX_bar KX_sbar KN_bar KN_sbar
 B_bar B_sbar T_bar T_sbar P_bar P_sbar PM_bar PX_sbar PT_bar
PT_sbar PN_bar PN_sbar IN_bar IX_bar I_bar I_sbar IN_sbar IX_sbar E E_s;
//parameter values

bet = 0.94; miu_s =6.5;               //discount factor
miu = 6.5; 
omega = 0.165;  miu = 1;             // the price's parameters
lam = 1.5; lam_s = 1.5;
gam =0.5 ; gam_s =0.5 ;
thet = 0.75; thet_s = 0.75;
alpha = 0.36; alpha_s = 0.36;
delta = 0.1;delta_s =0.1 ;
phi = -1; phi_s =-1 ;
sigma =1 ;sigma_s = 1;
rho_a =0.9 ; rho_as = 0.9;
kappa=0.36 ; kappa_s = 0.36;
tao =0 ; tao_s =0 ;
x = 0.01;
rho_g = 0.93;6
rho_gs = 0.9;
a_shock_correl = 0.77;
%steady state value
E_bar =1;  %assum exchange rate = 1
P_bar = 1;
P_sbar = P_bar/E_bar;
PX_sbar = 1;
PM_bar = 1;
H_bar = 1;
H_sbar = 1;

PT_bar =(miu*omega+(1-omega))^(1/(1-lam));
PT_sbar =(omega+miu*(1-omega))^(1/(1-lam));
PN_bar =(((1-gam*PT_bar^(1-thet))/(1-gam)))^(1/(1-thet));
PN_sbar =(((E_bar^(thet-1)-gam*PT_sbar^(1-thet))/(1-gam)))^(1/(1-thet));

R_bar = 1/bet-1;
R_sbar = 1/bet-1;
RX_bar = 1/bet-(1-delta);
RN_bar = 1/bet-(1-delta);
RX_sbar = 1/bet-(1-delta);
RN_sbar = 1/bet-(1-delta);

WX_bar = (1-alpha)*(1-tao_s)*(alpha*(1-tao_s)/RX_bar)^(alpha/(1-alpha));
WN_bar = (1-kappa)*PN_bar*(PN_bar*kappa/RN_bar)^(kappa/(1-kappa));
WX_sbar = (1-alpha)*(1-tao)*(alpha*(1-tao)/RX_sbar)^(alpha/(1-alpha));
WN_sbar = (1-kappa)*PN_sbar*(PN_sbar*kappa/RN_sbar)^(kappa/(1-kappa));
W_bar = WX_bar;
W_sbar = WN_sbar;

C_bar = W_bar^(1/sigma);
C_sbar = E_bar^(1/sigma)*C_bar;
CT_bar = gam*PT_bar^(-thet)*C_bar;
CN_bar = (1-gam)*PN_bar^(-thet)*C_bar;
CM_bar = gam*(1-omega)*PT_bar^(lam-thet)*C_bar;
CX_bar = miu*omega*PT_bar^lam*CT_bar;
CT_sbar = gam*(E_bar*PT_sbar)^(-thet)*C_sbar;
CN_sbar = (1-gam)*(E_bar*PN_sbar)^(-thet)*C_sbar;
CM_sbar = gam*(1-omega)*PT_sbar^(lam-thet)*C_sbar;
CX_sbar = miu*omega*PT_sbar^lam*CT_sbar;

YN_bar= (1-gam)*PN_bar^(-thet)*W_bar^(1/sigma);
E = gam*(miu*omega*PT_bar^(lam-thet)+PT_sbar^(lam-thet)*E_bar^(1/sigma))*(1-omega)*(1-delta*kappa*PN_bar/RN_bar)/((1-delta*(1-tao_s)*alpha/RX_bar)*(1-gam)*PN_bar^(-thet));
YX_bar= E*YN_bar;
YN_sbar =(1-gam)*PN_sbar^(-thet)* E_bar^(1/sigma)*W_bar^(1/sigma);
E_s = gam*(miu*omega*PT_sbar^(lam-thet)+(1-omega)*PT_bar^(lam-thet)*E_bar^(-1/sigma))*(1-delta*kappa*PN_sbar/RN_sbar)/((1-delta*(1-tao)*alpha/RX_sbar)*(1-gam)*PN_sbar^(-thet));
YX_sbar= E_s*YN_sbar;
Y_bar = YX_bar+YN_bar;
Y_sbar = YX_sbar+YN_sbar;

HX_bar =(1-tao_s)*(1-alpha)*E*YN_bar/WX_bar;
HN_bar =(1-kappa)*PN_bar*YN_bar/WN_bar;
HN_sbar =(1-kappa)*PN_sbar*YN_sbar/WN_sbar;
HX_sbar = (1-tao)*(1-alpha)*E_s*YN_sbar/WX_sbar;
KX_bar = alpha*(1-tao_s)*YX_bar/RX_bar;
KN_bar = kappa*PN_bar*YN_bar/RN_bar;
KX_sbar = alpha*YX_sbar/RX_sbar;
KN_sbar = kappa*PN_sbar*YN_sbar/RN_sbar;
IN_sbar =delta*KN_sbar;
IX_sbar = IN_sbar;
I_sbar = IX_sbar+IN_sbar;
IN_bar =delta*KN_bar;
IX_bar = delta*KX_bar;
I_bar = IX_bar+IN_bar;

B_sbar = (C_sbar+I_sbar-YX_sbar-PN_sbar*YN_sbar)/R_sbar;
B_bar = (C_bar+I_bar/E_bar-YX_bar-PN_bar*YN_bar)/R_bar;
T_bar = 0;
T_sbar =0;

model;
%1 #1
cx = miu*omega*(pt^lam)*ct; 
%2 #2
cx_s = miu*omega*pt_s^lam*ct_s;
%3 #3
cm = (1-omega)*(pt/pm)^lam*ct;
%4 #4
cm_s = (1-omega)*pt_s^lam_s*ct_s;
%5 #5
ct = gam*(p/pt)^thet*c;
%6 #6
ct_s = gam_s*(p_s/pt_s)^thet_s*c_s;
%7 #7
cn = (1-gam)*(p/pn)^thet*c;
%8 #8
cn_s = (1-gam_s)*(p_s/pn_s)^thet_s*c_s;
%9 #9 #10
s = pm;
e = p/p_s;
%10 #11
pt = (miu*omega+(1-omega)*s^(1-lam))^(1/(1-lam));
%11 #12
pt_s = (omega+miu*(1-omega)*(1/s)^(1-lam_s))^(1/(1-lam_s));
%12 #13
p = (gam*pt^(1-thet)+(1-gam)*pn^(1-thet))^(1/(1-thet));
%13 #14
p_s = (gam_s*pt_s^(1-thet_s)+(1-gam_s)*pn_s^(1-thet_s))^(1/(1-thet_s));
%14 #15
yx = a*((kx(-1))^alpha)*(hx^(1-alpha));
%15 #16
yn = a*((kn(-1))^kappa)*(hn^(1-kappa));
%16 #17
yx_s = a*(kx_s(-1)^alpha_s)*(hx_s^(1-alpha_s));
%17 #18
yn_s = a*(kn_s(-1)^kappa_s)*(hn_s^(1-kappa_s));
%18 #19
p*g = p_s*tao*yx_s+T;
%19 #20
p_s*g_s =tao_s*yx+T_s;
%20 #21
%yn = (1-gam)*(c+g+i)*(p/pn)^thet;
yn = cn+in+(1-gam)*(p/pn)^thet*g;
%21 #22
yx = miu*omega*(pt^lam)*gam*((p/pt)^thet)*(c+g+i)+(1-omega)*(pt_s^lam_s)*gam_s*((p_s/pt_s)^(-thet_s))*(c_s+g_s+i_s);
%22 #23
r = r_s-x*B;
%23 #24
yn_s = cn_s+in_s+(1-gam)*(p/pn_s)^thet*g_s;
%24 #25
yx_s = cx_s+cm+ix_s+omega*((pt/pm)^lam)*gam*((p/pt)^thet)*g+miu*(1-omega)*((pt_s/px_s)^lam_s)*gam_s*((p_s/pt_s)^thet_s)*g_s;
%29 #26
(h^phi)*(c^sigma) = w/p;
%30 #27
c^(-sigma)=bet*rx(+1)*c(+1)^(-sigma)/p(+1)+bet*(1-delta)*c(+1)^(-sigma);
%31 #28
c^(-sigma)=bet*rn(+1)*c(+1)^(-sigma)/p(+1)+bet*(1-delta)*c(+1)^(-sigma);
%32 #29
(c(+1)/c)^sigma = bet*(1+r(+1))*p/p(+1);
%38 #30
wx = (1-tao_s)*(1-alpha)*yx/hx;
%40 #31
wn = (1-kappa)*pn*yn/hn;
%41 #32
rx = (1-tao_s)*alpha*yx/kx(-1);
%42 #33
rn = kappa*pn*yn/(kn(-1));
%43 #34
(c(+1)/c)^sigma = (e/e(+1))*(c_s(+1)/c_s)^sigma-bet*x*B(+1)*p/p(+1);
%29_f #35
h_s^phi*c_s^sigma = w_s/p_s;
%30_f #36
%(c_s(+1)/c_s)^sigma = bet*(rx_s(+1)/p_s(+1)+qx_s(+1)*(delta*(ix_s(+1)/kx_s(-1))^(0.5)+(1-delta)))/qx_s;
c_s^(-sigma)=bet*rx_s(+1)*c_s(+1)^(-sigma)/p_s(+1)+bet*(1-delta)*c_s(+1)^(-sigma);
%31_f #37
%(c_s(+1)/c_s)^sigma = bet*(rn_s(+1)/p_s(+1)+qx_s(+1)*(delta*(in_s(+1)/kn_s(-1))^(0.5)+(1-delta)))/qx_s;
c_s^(-sigma)=bet*rn_s(+1)*c_s(+1)^(-sigma)/p_s(+1)+bet*(1-delta)*c_s(+1)^(-sigma);
%32_f #38
(c_s(+1)/c_s)^sigma = bet*(1+r_s(+1))*p_s/p_s(+1);
%39_f #39
wx_s = (1-tao)*(1-alpha_s)*yx_s/hx_s;
%40 #40
wn_s = (1-kappa_s)*pn_s*yn_s/hn_s;
%41 #41
rx_s = (1-tao)*alpha_s*yx_s/kx_s(-1);
%42 #42
rn_s = kappa_s*pn_s*yn_s/(kn_s(-1));
%technology shock #43 44 45 46 
a_s = rho_as*a_s(-1)+eps_as;
a = rho_a*a(-1)+eps_a+a_shock_correl*eps_as;
g = rho_g*g(-1)+eps_g;
g_s = rho_gs*g_s(-1)+eps_gs;
% #47 48 49 50 51 52
h = hn+hx;
h_s = hn_s+hx_s;
w = wx;
w = wn;
w_s = wx_s;
w_s = wn_s;
% # 53 54 55 56 57 58 59 60
kx = ix+(1-delta)*kx(-1);
kn = in+(1-delta)*kn(-1);
kn_s = in_s + (1-delta)*kn_s(-1);
kx_s = ix_s + (1-delta)*kx_s(-1);
i_s = ix_s +in_s;
i = ix+in;
p*c+B(+1)+p*ix+p*in = w*h +rx*kx(-1)+rn*kn(-1)+(1+r)*B-T;
p_s*c_s+B_s(+1)+p_s*ix_s+p_s*in_s = w_s*h_s +rx_s*kx_s(-1)+rn_s*kn_s(-1)+(1+r_s)*B_s-T_s;
//60equations
end;

steady_state_model;

e= E_bar; p=P_bar; p_s = P_sbar; pt=PT_bar; pt_s= PT_sbar; pn= PN_bar; pn_s=PN_sbar; pm=PM_bar; px_s= PX_sbar;
s= PM_bar;r= R_bar; r_s= R_sbar;rx= RX_bar; rx_s= RX_sbar; rn= RN_bar; rn_s= RN_sbar;w=W_bar; w_s=W_sbar;
wx =WX_bar;wx_s= WX_sbar; wn= WN_bar; wn_s=WN_sbar;yn=YN_bar; yn_s=YN_sbar; yx=YX_bar; yx_s=YX_sbar;
kx=KX_bar; kx_s=KX_sbar; kn=KN_bar; kn_s=KN_sbar; hn=HN_bar; hn_s=HN_sbar; hx=HX_bar;ix= IX_bar;ix_s=IX_sbar; in=IN_bar; in_s=IN_sbar;i= I_bar; i_s=I_sbar;
hx_s= HX_sbar;  h=HN_bar+HX_bar; h_s=HN_sbar+HX_sbar; c= C_bar; c_s=C_sbar; ct= CT_bar; ct_s=CT_sbar; cn=CN_bar; cn_s=CN_sbar; cx=CX_bar; cx_s=CX_sbar;
cm= CM_bar; cm_s=CM_sbar;T=0; T_s=0; g=0; g_s=0; e_bar= P_bar/P_sbar;B_s=B_sbar;a =0; a_s=0;B = B_bar;
end;

steady;
check;

shocks;
var eps_a; stderr 1;
var eps_as; stderr 2;
var eps_g; stderr 1;
var eps_gs; stderr 1;
end;

stoch_simul;


The Dynare error message:
[list]Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.4.2).
Starting preprocessing of the model file ...
Found 60 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

ans =
6




Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0.48472
Equation number 16 : 0.49828
Equation number 17 : 0.49828
Equation number 18 : 0.49828
Equation number 19 : 0
Equation number 20 : 0
Equation number 21 : -0.10949
Equation number 22 : -0.12281
Equation number 23 : 0.035966
Equation number 24 : -0.10949
Equation number 25 : -0.10949
Equation number 26 : 0.58205
Equation number 27 : 0
Equation number 28 : 0
Equation number 29 : 0
Equation number 30 : 0
Equation number 31 : 0
Equation number 32 : 0
Equation number 33 : 0
Equation number 34 : 0.033808
Equation number 35 : 0.56057
Equation number 36 : 0
Equation number 37 : 0
Equation number 38 : 0
Equation number 39 : 0
Equation number 40 : 0
Equation number 41 : 0
Equation number 42 : 0
Equation number 43 : 0
Equation number 44 : 0
Equation number 45 : 0
Equation number 46 : 0
Equation number 47 : 0
Equation number 48 : 0
Equation number 49 : 0
Equation number 50 : 0
Equation number 51 : 0
Equation number 52 : 0
Equation number 53 : 0
Equation number 54 : 0
Equation number 55 : 0
Equation number 56 : 0
Equation number 57 : 0
Equation number 58 : 0
Equation number 59 : 0
Equation number 60 : 0


Error using print_info (line 72)
The steadystate file did not compute the steady state
Error in resid (line 112)
print_info(info,options_.noprint, options_)
Error in steady (line 90)
resid;
Error in Sino1118 (line 748)
steady;
Error in dynare (line 180)
evalin('base',fname) ;
Baymax
 
Posts: 1
Joined: Fri Jun 26, 2015 8:02 am

Re: SOE model cannot get the steady state

Postby jpfeifer » Sat Nov 21, 2015 2:58 pm

First of all, this is not a good way to specify a steady state file, because the computations that depend on deep parameters are conducted outside of the file. Thus, it will be useless for estimation.

Second, focus on the equations wit non-zero residual. Either you entered the equation incorrectly in the model, or your computation of the steady state for at least one of the variables in these equations is wrong. Given the size of your model, you might need to start with a simplified version that runs and then slowly expand it.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 12 guests