Impossible to find steady state in two agent model

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:

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

eps_a    % productivity shock

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

delta = 0.025;
v = 0.085;  
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);      


%Euler for Savers

% Budget Constraints for HTM

%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

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


initval ;
K = K_ss;
X =X_ss;  
Y= Y_ss;
e= e_ss; 
h_y= h_y_ss;
r= r_ss;
p= p_ss;
p_e= p_e_ss;
W= W_ss;
A_e = A_ss ;


var eps_a; stderr 0.01;


Check your specification.


implies A_e is zero in steady state, which conflicts with other equations.

Thank you very much for your reply. However i don’t know how to change the specification for A_e; Could you please give a suggestion on how to change it?

I also tried to run the model withouth the A_e, so without TFP and TFP shock, just to see if like this it finds the steady state, but it does not. So i guess the problem is not only on A_e. Do you think there is another problem then?


Thank you very much. I understood the problem and fixed it. But still it cannot find the steady state. Now it gives me non-zero residuals only for equation 2. Does it mean that the mistake is there? Do you have other ideas of what else could be wrong? Thank you a lot

Please provide the updated file.

TANK2cdt.log (1.3 KB)
Here it is! Thank you a lot

That’s the log-file, not the mod-file.

TANK2cdt.mod (3.2 KB)
I am sorry here it is

Why are you allowed to set K_ss = 0.003;?

try_exp.mod (2.4 KB)

It was a guess. I also realised maybe was there the problem. So i computed a steady state of a semplified version of the model, to have a better guess for capital. Now the code works. Could you please chack if now do you think enerything is ok in the model? Thank you a lot again!

The file looks ok now.

1 Like

Thank you a lot for your help. Im going further with the analysis and i encountered another problem.
I have introduced consumption of energy by household, that now consume both final good and energy good according to a CES consumption function. Then I introduced the government and it taxes energy consumption. government runs a balance budget so all revenue from tax goes to a transfer to constrained household. The code works, but i something does not make sense in the output. after introducing the government, energy consumption of savers increases. How is this possible? Since now energy is taxed it cost more so it should decrease, also savers don’ benefit from the transfer. Maybe i did something wrong in the specification of the tax. Could you please help me to spot the mistake? Thank you a lot again, i attach the new updated code.
step2.mod (4.1 KB)

I think I have found the mistake. However, fixed that, when introducing the government I cannot solve the steady state analytically. So I think i have to made a guess on transfer. To make the guess I computed a simplified version of the model that i could solve analytically and i use that steady state value. Is it correct to do so? Just want to make sure that is good practice. I upload the updated file.
step2.mod (4.1 KB)

Yes, that is fine. You should just make sure to verify that the steady state makes sense.