Dear professor, I am completely new with Dynare. I am working on this two agents macro model with energy sector and i need to see the effect of a TFP shock. I first computed manually the steady state (by pen), obtaining everything as a function of capital, since I cannot go further. So I put it on dynare, making several guesses for capital, but the error is always the same: the steady state does not exist or is too far from guess values. could you please help me with this issue .
thank you very much; Here it is the code:
var
X % aggregate consumption
X_h % HTM consumption (constrained)
X_s % Saver consumption (unconstrained)
Y % aggregate income
h_y % employment production sector
h_e %employment energy sector
r % interest rate
W % aggregate wage
K % capital
e % energy
p_e % price of energy
p % price of good
I % investments
A_e % TFP
;
varexo
eps_a % productivity shock
;
parameters
h %labor hour normalization
lambda % share of keynesians
sigma % elasticity of consumption
beta % discount factor
phi % labor utility weight
alpha % capital share
v % energy share
epsilon_w % elasticity of substitution labor inputs
theta % labor supply elasticity
delta % depreciation rate
rhoa % persistance of the productivity shock
Y_ss % income steady state
X_h_ss % keynesian consumption steady state (constrained)
X_s_ss % ricardian consumption steady state (unconstrained)
A_ss % TFP steady state
W_ss % wage steady state
X_ss % aggregate Consumption steady state
h_y_ss % employment production sector steady state
h_e_ss %employment energy sector steady state
r_ss % interest rate steady state
e_ss % energy steady state
p_e_ss % price of energy steady state
p_ss % price of good steady state
I_ss % investments steady state
K_ss % capital at steady state
;
sigma=1.5;
phi=0.783;
beta=0.99;
theta=1.5;
epsilon_w=10;
tau=0.21;
lambda=0.15;
alpha=0.275;
delta = 0.025;
v = 0.085;
rhoa=0.95;
h=1;
r_ss =1/beta - 1+ delta;
A_ss = 1.5;
e_ss = v/(1-alpha) ;
h_e_ss = v/(1-alpha);
h_y_ss = e_ss;
K_ss = 0.003;
Y_ss = K_ss^alpha*e_ss^v*h_y_ss^(1-alpha-v);
I_ss = K_ss*delta;
p_ss = (r_ss*K_ss)/(alpha*Y_ss);
p_e_ss = p_ss*v*Y_ss/e_ss;
W_ss = p_e_ss;
X_ss = (W_ss*(epsilon_w -1)/(phi*epsilon_w))^(1/sigma);
X_h_ss = W_ss;
X_s_ss = 1/(1-lambda)*(X_ss - lambda*X_h_ss);
model;
%Euler for Savers
X_s^(-sigma)=(1+r(+1)-delta)*beta*X_s(+1)^(-sigma);
% Budget Constraints for HTM
X_h=W*h;
%aggregate labor
h = h_y + h_e;
%energy firm
W/p_e = e/h_e;
e= A_e*h_e;
% production sector
Y= K^alpha*e^v*h_y^(1-alpha-v);
r = p*alpha*Y/K;
p_e = p*v*Y/e;
W = p*(1-alpha-v)*Y/h_y;
%Aggregate Consumption
X=(1-lambda)*X_s+lambda*X_h;
%Wage
W=phi*X^(sigma)*h^theta*(epsilon_w/(epsilon_w -1));
%Market Clearing Condition
X + I=Y;
%law of motion of capital
K(+1) = I + (1-delta)*K;
% law of motion of productivity
A_e=rhoa*A_e(-1)+eps_a;
end;
initval ;
K = K_ss;
X =X_ss;
X_h=X_h_ss;
X_s=X_s_ss;
Y= Y_ss;
e= e_ss;
h_y= h_y_ss;
h_e=h_e_ss;
I=I_ss;
r= r_ss;
p= p_ss;
p_e= p_e_ss;
W= W_ss;
A_e = A_ss ;
end;
resid(1);
steady;
check;
shocks;
var eps_a; stderr 0.01;
end;
stoch_simul(irf=40,order=1);