# Error message

Hi,

I am receiving this error message " ERROR: in the ‘steady_state’ block, variable ‘theta2’ is undefined in the declaration of variable 'varrho "

here it is my steady state block

% Asset Markets

varrho=exp((1-tauk)rk+theta2((1-tauh)rh-(1-tauk)rk)-delta+ (((1-gamma)/2)(theta2)^2)sigmat^2 +(0.5)(theta2)(1-theta2)*sigmat^2);
shr=0;
ex1=0;
ex2=0;
Rap = Rf^(1-gamma);
theta1=0;
theta2=((1-tauh)*rh-(1-tauk)rk)/(gamma(sigmat^2));

% Optimal choice

u=1-(beta^eps)varrho^(eps-1);
u=v^(1-(1/mu));
k=(1-theta2)
(1-u)/(1+gr)-b;
h=theta2*(1-u)/(1+gr);
kh=k/h;

R=(1-theta2)Rk+theta2Rh;
Rk=1+(1-tauk)*rk-delta;
Rh=1+(1-tauh)*rh-delta;
Rf=Rk;

%% Average growth rate

gr=R*(1-u);

%% Supply side

rk=exp(A)alphakh^(alpha-1);
rh=exp(A)*(1-alpha)kh^(alpha);
y=exp(A)
(kh^alpha)*h;

b=((gov-taukrkk-tauhrhh)/(gr-(1-tauk)*rk+delta));

gov=p*y;
A=ln(A_bar);
sigmat=sigma_y/theta2;

end;[/code]

Any ideas on what’s wrong ?

many thanks

Most probably theta2 was not declared as a parameter.

theta2 I have declared it in the “var”, is an endogenous variable. here there are my declarations

[code]% 1. Declaring endogenous variables

var varrho
v
Rap
Rf
theta1
theta2
ex1
ex2
shr
u
k
h
b
kh
R
Rk
Rh
rk
rh
y
gr
sigma
sigmat
A
gov ;

%% Declaring predetermined variables
%% Those that are indexed in the paper with t_{t+1} while are actually choosen at t

predetermined_variables b k h theta1 theta2 ;

%% Declaring exogenous variables

varexo e
eta;

parameters beta
gamma
eps
delta
alpha
rho
lambda
sigma_y
tauk
tauh
Abar
p
mu;

beta = 0.9090;
gamma = 3;
eps = 0.8;
delta = 0.06;
alpha = 0.36;
rho = 0.95;
lambda = 0.002;
sigma_y= 0.1769;
tauk = 0.1839;
tauh =0.1955;
Abar =0.6817;
p =0.18;
mu =1/eps;[/code]

Then this is the problem. You cannot use theta2 to compute another variable if theta2 was not set before.

I cannot understand then the meaning of this block. I actually, it is the first time I use it, after I checked one of your codes.

To the extend I understood, I shall put the model ordered, starting with a guess ? Or shall I use an actual value ? In fact I know the values of the steady state of my model for given parameters. But the purpose is to calculate the steady state model if some of the parameters change.

UPDATE

I am receiving this error message now: The steadystate file did not compute the steady state

My new steady state block is:

```steady_state_model; A=ln(Abar); theta2=0.331722; k=0.481069; h=0.282029; b=0.0870984; sigmat=sigma_y/theta2; kh=k/h; rk=exp(A)*alpha*kh^(alpha-1); rh=exp(A)*(1-alpha)*kh^(alpha); varrho=exp((1-tauk)*rk+theta2*((1-tauh)*rh-(1-tauk)*rk)-delta+ (((1-gamma)/2)*(theta2)^2)*sigmat^2 +(0.5)*(theta2)*(1-theta2)*sigmat^2); u=1-(beta^eps)*varrho^(eps-1); v=u^(1/(1-eps)); psi=v^(1-gamma); Rk=1+(1-tauk)*rk-delta; Rh=1+(1-tauh)*rh-delta; Rf=Rk; Rap = Rf^(1-gamma); R=(1-theta2)*Rk+theta2*Rh; gr=R*(1-u); y=exp(A)*(kh^alpha)*h; gov=p*y; shr=0; ex1=0; ex2=0; theta1=0; end;```

Ok, so you got rid of the incorrect recursive steady state definition in your steady state file.
The message you obtain now tells you that your provided steady state does not solve your entered model. That means that either your analytical steady state is wrong or some of your model equations. Check the residuals using

to see from which equation the problem stems from.

Thank you. But I am unfamiliar with what you suggest about the residuals. How I can understand if something is wrong with an equation by looking at the residuals ? they should be close to zero I guess correct ?

My original model is in non-linear form, where to get a closed form solution for a particular variable that I am interested I used a second order approximation and the rest of the model left as it is. In the steady state of the model, this is not necessary as I could get a closed form solution for the particular variable. You believe that there something wrong with this approach ?

If an equations shows a residual, there is either a mistake in that equation or the steady state of a variable used in the equation is wrong.

There is nothing wrong with your approach as any Taylor approximation is perfectly accurate in the approximation point. I am rather afraid that your analytical steady state is incorrect.

According to the output for the residuals (please check below), I should essentially focus on equations 1, 7,8. Is that correct ?

```Equation number 1 : -4945005947.5595 Equation number 2 : 0 Equation number 3 : 0 Equation number 4 : 0 Equation number 5 : -0.28309 Equation number 6 : 0 Equation number 7 : NaN Equation number 8 : NaN Equation number 9 : -0.035236 Equation number 10 : 0 Equation number 11 : 0.48107 Equation number 12 : 2.7306e-06 Equation number 13 : -0.48106 Equation number 14 : 0 Equation number 15 : 0 Equation number 16 : 0 Equation number 17 : 0 Equation number 18 : 0 Equation number 19 : -0.33138 Equation number 20 : -1.0049 Equation number 21 : -0.44283 Equation number 22 : -1.8158e-06 Equation number 23 : 0 Equation number 24 : 0 Equation number 25 : 0.53328 Equation number 26 : -0.53328```

Exactly. Big residuals like this often indicate a problem with taking logs.