I’ve created a small NK model with banks and a money growth equation. My code seems to be correct, except I keep getting the following error:
“The steady state has NaNs or Inf”
I figured out that that means that my values for the initval block are incorrect, but I’m unsure as to how to actually compute them. I was previously told that I can just keep all values (Except for the interest rate) as 0, but evidently, that is not working. I have given the model below.
var ch cb r i l w z y d q m;
varexo eps_e;
parameters BETA, ETA, KTILDE, XSS, GAMMA, SIGMA, ALPHAM, PHIM, CHI;
BETA = 0.985;
ETA = 0.276;
KTILDE = 0.0858;
XSS = 1.2;
GAMMA = 0.065;
SIGMA = 0.5;
ALPHAM = 0.1250;
PHIM = 0.95;
CHI = 0.74;
STDERR_AE = 0.0029;
model;
1/ch = BETA*(r/(ch(+1)*i(+1))); // euler eq
w/ch = l^(ETA-1);
i = BETA*i(+1)-KTILDE*((1/z)-log(XSS));
y = l;
w*l = (z*y)/(1+q);
(1-GAMMA)/cb = BETA*(d*((1+r)/cb(+1)));
1/cb = BETA*(q*((1+r)/cb(+1)));
y = ch;
m = SIGMA*m(-1);
m^(-PHIM) = BETA*((r(-1)-1)/(y(+1)*i(+1)*ALPHAM)) + eps_e;
eps_e = CHI*eps_e(-1);
end;
initval;
ch = 0;
cb = 0;
r = 0.1;
i = 0;
l = 0;
w = 0;
z = 0;
y = 0;
d = 0;
q = 0;
m = 0;
end;
steady;
shocks;
var eps_e; stderr 100*STDERR_AE;
end;
stoch_simul(dr_algo=0,order=1,irf=20);
Right, that makes sense. Would it be better to log linearise my equations and keep SS values as zero or keep the equations as is and calculate the SS values instead?
Oh okay. I thought steady state values are taken as 0 (for most variables) upon log linearisation. Then in that case I’m better off leaving my equations as is (i.e. non-linear) and calculating the steady state values, right?
Regarding this question I posted a while back; I tried solving the system of equations for the steady state values of my variables, using matlab, but for some reason, fsolve stops prematurely. No matter how much I extend my evaluation or iteration limit.
I have now tried to log-linearise my model and keep steady state values (for the most part) as 0, as I was advised/taught by my lecturer. I am being told ‘the steady state has Nans or inf’ and I’m struggling to understand what to do now.
I have given my code below,
var ir c l y w r id iq q d f i n m z o;
varexo eps_e;
parameters ETA ALPHAM SIGMAM ALPHAD SIGMAD ALPHAR SIGMAR THETA BETA GAMMA PHID PHIQ RHOR RHOI RHOY CHI;
ETA = 2.7;
ALPHAM = 1.25;
SIGMAM = 0.95;
ALPHAD = 1.25;
SIGMAD = 0.95;
ALPHAR = 1.25;
SIGMAR = 0.95;
THETA = 0.57;
BETA = 0.9823;
GAMMA = 0.18;
PHID = 0.5;
PHIQ = -0.5;
RHOR = 0.829;
RHOI = 0.89;
RHOY = -0.017;
CHI = 0.75;
STDERR_AE = 0.0029;
model;
1/exp(c) = BETA*exp(r - i(+1) - c(+1)) ;
w - l = (ETA-1)*c ;
y = l ;
y = c ;
id = f - d ;
i = BETA*i(+1) - (1 - THETA)*(1 - BETA*THETA)*z/THETA ;
o = CHI*o(-1) + eps_e ;
r = RHOR*r(-1) + (1 - RHOR)*((RHOI + 1)*i + RHOY*y) + o;
w + l = z + y - q - iq ;
q + w = f + ((1 - GAMMA)*d + n)/f ;
n = (1 + iq)*n(-1) + (((iq - id)*d) + ((iq - ir)*f))/((1 + iq)*n(-1)) ;
c = ALPHAM*SIGMAM*m + BETA*(c(+1) + i(+1)) ;
c = ALPHAR*SIGMAR*r + BETA*(c(+1) + i(+1)) ;
c = ALPHAD*SIGMAD*d - BETA*(id - c(+1)) ;
iq = PHIQ + q + ir + w - n + (q*(1 + PHIQ)*w)/n ;
id = PHID + GAMMA + ir - PHID ;
end;
initval;
ir = 0.01;
c = 0;
l = 0;
y = 0;
w = 0;
r = 0.5;
id = 0.01;
iq = 0.01;
q = 0;
d = 0.4;
f = 0;
i = 1;
n = 0;
m = 0.5;
z = 0;
o = 0;
end;
steady;
shocks;
var eps_e; stderr 100*STDERR_AE;
end;
stoch_simul(dr_algo=0,order=1,irf=20) y i ir q c;