Steady State Problems! Help!

Residuals of the static equations:

Equation number 1 : -1.7259e-05 : Y_T
Equation number 2 : -4.6338e-05 : Y_N
Equation number 3 : 3.8e-05 : K_T
Equation number 4 : -3e-05 : K_N
Equation number 5 : 5.4213e-05 : IM
Equation number 6 : 0 : x
Equation number 7 : 0 : 7
Equation number 8 : 0.055757 : 8
Equation number 9 : 5.2081e-05 : 9
Equation number 10 : -5.7641e-06 : 10
Equation number 11 : 5.6118e-06 : 11
Equation number 12 : 0.00010487 : 12
Equation number 13 : 0 : C
Equation number 14 : 0 : P
Equation number 15 : 0 : L
Equation number 16 : 0 : pi
Equation number 17 : 0.001092 : W
Equation number 18 : 7.965e-05 : 18
Equation number 19 : 0 : 19
Equation number 20 : -9.77e-06 : P_T
Equation number 21 : -9.77e-06 : 21
Equation number 22 : 9.1902e-05 : C_F
Equation number 23 : -2.8233e-05 : 23
Equation number 24 : -2.8233e-05 : 24
Equation number 25 : 0 : 25
Equation number 26 : 0 : 26
Equation number 27 : 0 : 27

错误使用 print_info (第 32 行)
Impossible to find the steady state (the sum of square residuals of the static equations is 0.0031). Either the model doesn’t have a steady state,
there are an infinity of steady states, or the guess values are too far from the solution

出错 steady (第 102 行)
print_info(info,options_.noprint, options_);

出错 dsge.driver (第 407 行)
steady;

出错 dynare (第 281 行)
evalin(‘base’,[fname ‘.driver’]);

I think sum of square residuals of the static equations is small enough, but I still can’t get the steady state.

I checked the model_diagnostics, hers is the result:
model_diagnostics(M_, options_, oo_);
DYNARE_SOLVE (solve_algo=2|4|12): number of blocks = 2
DYNARE_SOLVE (solve_algo=2|4|12): solving block 2 of size 4.
DYNARE_SOLVE (solve_algo=2|4|12): solving block 2 with trust_region routine.
DYNARE_SOLVE (solve_algo=2|4|12): solving block 1 of size 23.
DYNARE_SOLVE (solve_algo=2|4|12): solving block 1 with trust_region routine.
DYNARE_SOLVE (solve_algo=2|4|12): number of blocks = 2
DYNARE_SOLVE (solve_algo=2|4|12): solving block 2 of size 4.
DYNARE_SOLVE (solve_algo=2|4|12): solving block 2 with trust_region routine.
DYNARE_SOLVE (solve_algo=2|4|12): solving block 1 of size 23.
DYNARE_SOLVE (solve_algo=2|4|12): solving block 1 with trust_region routine.
MODEL_DIAGNOSTICS: The steady state cannot be computed

HELP!!!PLEASE!!!
THE DEADLINE IS COMING!!!

Here is my codes:

%前导部分
%内生变量声明
var Y Y_T Y_N C C_T C_N C_F P P_T P_N P_F P_FT K_T K_N L L_T L_N W I I_T I_N IM TB pi r ex x; 
%外生变量声明
varexo epsilon;
%参数声明
parameters s beta n lambda theta delta rho_x Z_IM Z_T phi_IM phi_T alpha_T alpha_IM alpha_N rho_r rho_pi e r0 pi0;
%参数校准
beta=0.9925;
n=0.5;
lambda=0.5;
delta=0.03;
rho_x=1;
rho_pi=1;
phi_T=1.5;
phi_IM=1.2;
alpha_T=0.35;
alpha_IM=0.3;
alpha_N=0.3;
rho_r=1;
Z_IM=0.6450;
Z_T=0.4053;
r0=0.03;
pi0=1;
e=1.6111;
theta=0.92;
s=0.1;


%模型部分
model;
%(1) 贸易厂商生产函数
Y_T=K_T^(alpha_T)*IM^(alpha_IM)*L_T^(1-alpha_T-alpha_IM);
%(2) 非贸易厂商生产函数
Y_N=K_N^(alpha_N)*L_N^(1-alpha_N);
%(3)贸易品厂商资本积累函数
K_T(+1)=I_T+(1-delta)*K_T;
%(4)非贸易品厂商资本积累函数
K_N(+1)=I_N+(1-delta)*K_N;
%(5)进口原材料需求函数
IM=Z_IM*P_F^(-phi_IM);
%(6)存款比例波动
x=rho_x*x(-1)+epsilon;
%(7)结算费率函数
log(x(-1))=log(ex)-log(ex(-1))+log(x);
%(8)对K_T求导
-P_T+beta*(P_T(+1)*IM(+1)^alpha_IM*L_T(+1)^(1-alpha_T-alpha_IM*alpha_T)*K_T(+1)^(alpha_T-1)+P_T(+1)*(1-delta))=0;
%(9) 对L_T求导
P_T*K_T^alpha_T*IM^alpha_IM*(1-alpha_T-alpha_IM)*L_T^(-alpha_T-alpha_IM)-W=0;
%(10)对IM求导
P_T*K_T^alpha_T*L_T^(1-alpha_T-alpha_IM)*alpha_IM*IM^(alpha_IM-1)-(1+ex)*P_F=0;
%(11)对K_N求导
-P_N+beta*(P_N(+1)*L_N(+1)^(1-alpha_N)*alpha_N*K_N(+1)^(alpha_N-1)+P_N*(1-delta))=0;
%(12)对L_N求导
P_N*K_N^alpha_N*(1-alpha_N)*L_N^(-alpha_N)-W=0;
%(13)贸易品、非贸易品和总消费品关系
C=(n^(1/lambda)*C_T^((lambda-1)/lambda)+(1-n)^(1/lambda)*C_N^((lambda-1)/lambda))^(lambda/(lambda-1));
%(14)国内总体价格水平
P=(n*P_T^(1-lambda)+(1-n)*P_N^(1-lambda))^(1/(1-lambda));
%(15)劳动力构成
L=L_T+L_N;
%(16)通胀水平
pi=P/P(-1);
%(17)
W=P*C*theta/L;
%(18)
C=C(+1)*pi(+1)/(beta*(1+r));
%(19)中央银行
log(r/r0)=rho_r*log(r(-1)/r0)+rho_pi*log(pi(-1)/pi0);
%(20)购买力平价
P_T=e*P_FT;
%(21)价格与汇率挂钩
P=e*P_F;
%(22)需求与价格水平负相关
C_F=Z_T*P_FT^(-phi_T);
%(23)我国净出口
P*TB=P_T*C_F-(1+ex)*P_F*IM;
%(24)我国GDP
P*Y=P_T*Y_T+P_N*Y_N-(1+ex)*P_F*IM;
%(25)我国总投资
P*I=P_T*I_T+P_N*I_N;
%(26)贸易厂商出清
Y_T=C_T+I_T+C_F;
%(27)非贸易厂商出清
Y_N=C_N+I_N;
end;

%稳态、初值和外生冲击
initval;
P=1;
P_T=1;
P_N=1;
L=1;
L_T=0.5;
L_N=0.5;
Y_T=2.4362;
Y_N=1.2181;
I_T=0.6811;
I_N=0.2919;
K_N=9.7290;
K_T=22.7046;
IM=1.1432;
C_T=0.9262;
C_N=0.9262;
C=1.8524;
r=0.0076;
W=1.7053;
TB=0.0980;
Y=2.4768;
I=0.973;
P_FT=0.6207;
P_F=0.6207;
C_F=0.8289;
x=1;
ex=0.03;
pi=1;
end;


%外生冲击
shocks;
var epsilon=s^2;
end;

steady;
resid;

Please upload the file and not just the text.

dsge.mod (2.7 KB)

Is it ok?
THANK YOU!!!

I can find a steady state but there are singularity issues

STEADY-STATE RESULTS:

Y 0.814175
Y_T 0.647485
Y_N 0.351949
C 0.513208
C_T 0.246459
C_N 0.267616
C_F 0.0414797
P 6.82761
P_T 7.36303
P_N 6.31239
P_F 4.23785
P_FT 4.57019
K_T 11.9851
K_N 2.8113
L 0.299434
L_T 0.15499
L_N 0.14445
W 10.7659
I 0.465718
I_T 0.35955
I_N 0.0843359
IM 0.114022
TB -0.164745
pi 1
r 0.00755668
ex 1.95987
x 1
MODEL_DIAGNOSTICS: The Jacobian of the static model is singular
MODEL_DIAGNOSTICS: there is 3 colinear relationships between the variables and the equations
Relation 1
Colinear variables:
Y_T
Y_N
C
C_T
C_N
C_F
P
P_T
P_N
P_F
P_FT
K_T
K_N
L
L_T
L_N
W
I
I_T
I_N
IM
TB
ex
Relation 2
Colinear variables:
x
Relation 3
Colinear variables:
Y
Y_T
Y_N
C
C_T
C_N
C_F
P
P_T
P_N
P_F
P_FT
K_T
K_N
L
L_T
L_N
W
I
I_T
I_N
IM
TB
ex
Relation 1
Colinear equations
6 7 16 19
Relation 2
Colinear equations
6 16 19
Relation 3
Colinear equations
6 7
MODEL_DIAGNOSTICS: The singularity seems to be (partly) caused by the presence of a unit root
MODEL_DIAGNOSTICS: as the absolute value of one eigenvalue is in the range of ±1e-6 to 1.
MODEL_DIAGNOSTICS: If the model is actually supposed to feature unit root behavior, such a warning is expected,
MODEL_DIAGNOSTICS: but you should nevertheless check whether there is an additional singularity problem.
MODEL_DIAGNOSTICS: The presence of a singularity problem typically indicates that there is one
MODEL_DIAGNOSTICS: redundant equation entered in the model block, while another non-redundant equation
MODEL_DIAGNOSTICS: is missing. The problem often derives from Walras Law.

The timing of your capital also seems wrong to me. Maybe you should recheck the model equations carefully.

THANK YOU!!! How did you find the steady stare? Can you give me the code please? I will try to fix the other bugs! Thanks again!!

I just used a different steady state solver:

resid(1);
steady(solve_algo=1,maxit=10000);
model_diagnostics;

Thanks! If I can’t solve the singularity problem, can I draw a IRF plot? I need a result to submit:sob:

Sorry to bother you. I’m really new to dsge model and I have so many problems can’t handle. I’ve checked the model and didn’t find any problems. :sob: Do you have any advices to the singularity problem or the IRF plot? Thank u very much !!

One issue is that both your variables for capital should be predetermined variables, check the Dynare documentation. Also there is the problem with the singularity. This, as the output tells you, most often comes from the fact that you have included redundant equations but left out important ones. For anyone but you, it is almost impossible to say which ones these are as only you know your model well.
Typically, people start from a working model code and than extend it. I guess you did something similar. So what you should do, especially if you are new to DSGE modelling and Dynare, is to go back to a smaller and easier understandable model that actually works and from there extend one feature at a time.
To your first question, no you cannot simulate the model, ie draw IRF’s, if you not solve the issues explained above.

OK!I get it! Thank you again!!

Declaring

predetermined_variables K_T K_N ;

allows generating IRFs.

dsge3.mod (2.8 KB)

WOW!!! THANK YOU!!! I almost gave up :sob:

I just got the IRF results. But it seems to be wrong. I used stoch_simul()
Why the variable “x” and “ex” are constant? I set a positive shock to the disturbing term of “x”, and “ex” is supposed to be negatively correlated to “x”. The other variables are also strange. Because they can’t return to the steady state.
Were my results wrong?
PLEASE HELP ME!!! THANKS!!!

You set rho_x, which introduces a unit root. Thus, the responses are permanent.

I changed the value of rho_x to 0.5. The results of “x” and “ex” seem to be right.

Please have a look at Timing of capital in two sector economy

1 Like

Very helpful! It worked. Thank you very much!