# "The steady state contains NaN or Inf" but variables at SS are zero

Dear all,

I am trying to reproduce Bilbiie’s model (Monetary Policy and Heterogeneity: an Analytical Framework, 2019), with two agents: Savers and Hand to Mouth. I have written down all 18 equations for the model, with 18 variables. I am introducing a persistent monetary shock. I am inserting as initial guess for the steady state (initval block) a zero-inflation steady state.

When I run the model I obtain the error message in the object: "The steady state contains NaN or Inf ". However, no steady state values are NaN or Inf!

I have a supposition: in a zero-inflation SS, firms dividends are zero, in this model (this is true given the particular value of the subsidy rate to firms, “taus”, assumed by Bilbiie). The value of the price of firms’ shares is also 0 in steady state. However, this leads to equation 1 in SS being equal to the following:

cs^(-1/sigma) = beta*(((v(+1)+d(+1))/v)*cs(+1)^(-1/sigma)); % FOC omega

Removing time indicators, simplifying and considering that dSS (dividends in steady state) are null, I obtain:

1 = beta* (v/v)

The solution I derive is that v=0, because I write: (1-beta)v=0. I know this is not correct because it leads me to an indeterminate expression (v/v=0/0).

However, given the fact that I set inflation to zero in ss and a subsidy rate to firms that leads them to obtain zero profits (taus=1/(epsilon-1)), this seems to me like the only solution.

Indeed, in his paper, Bilbiie focuses on this particular steady state (zero inflation and zero profits).

Here is the link to the paper:

So, how can I solve the model? Can somebody tell me why I obtain the error message in the object of this post?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Here is my CODE:

``````%--------------------------------------------------------------------------
% 1. Defining variables - first endogenous (var) and then exogenous (varexo)
%--------------------------------------------------------------------------

% endogenous variables

var cs ch zs zh bh bs omega ns nh w v p d c y nc r r_star;

% BRIEF DESCRIPTION OF THE VARIABLES
% cs= consumption by savers (S); ch= cosumption by hand-to-mouth (HTM), i.e. poor ppl
% who consume all their income; zs= liquidity held at the end of period t by S;
% zh= liquidity held at the end of period t by H; bh= liquidity held at the beginning of period t by S;
% bs= liquidity held at the beginning of period t by S; omega= firms shares detained by S (assumed to be in fixed supply);
% ns= labor supply by S; nh= labor supply by H; w= real wage in terms of price of consumption good;
% v= price of a single firm share; p= infation ((Pt-Pt-1)/Pt-1); d= dividends by firms;
% c= total consumption; y= total product; nc= labor demand by firms producing consumption good;
% r= nominal interest rate (it is r and not i bc Dynare gave me problems with i);
% r_star= exogenous AR(1) process for the interest rate shock

% exogenous variables
varexo shock_r_star;

%--------------------------------------------------------------------------
% 2. Set the parameters - names and values
%--------------------------------------------------------------------------

parameters sigma beta h s phi epsilon psi taus lambda taud rho sigma_star p_bar varphi;

%-- Parameters

sigma = 0.5;                     %Parameter on consumption in utility function ((C^(1-(1/sigma))-1)/(1-(1/sigma))
beta = 0.9;                      %Utility Discount factor
h = 0.5;                         %Prob to stay HTM
s = 0.5;                         %Prob to stay rich
phi   = 1;                       %Inverse Frisch Elasticity
epsilon = 1.5;                   %Elasticity of substitution
psi =   0.5;                     %Cost of inflation
taus =  (epsilon-1)^(-1);        %Subsidy rate and tax rate on production (this subsidy rate is the rate that makes firms price at marginal cost, see Bilbiie's paper)
lambda = (1-s)/(2-s-h);          %Fraction of HTM (this is the stationary value of their fraction, i.e. in every period there is an equal fraction of HTM and S)
taud =   0.5   ;                 %Tax rate on profits
sigma_star = 1;                  %Variance of shock to interest rate
rho = 0.9;                       %AR coefficient on last period monetary shock
p_bar = 0;                       %Desired level of inflation
varphi = 1.5;                    %Response to inflation

model;                           % MODEL IS NON LOG! I TYPE BELOW (MY VERSIN OF) BILBIIE'S MODEL

cs^(-1/sigma) = beta*(((v(+1)+d(+1))/v)*cs(+1)^(-1/sigma));    % FOC omega
cs^(-1/sigma) = beta*( ( (1+r)/(1+p(+1)) ) * (s*(cs(+1)^(-1/sigma)) + ( (1-s)*ch(+1)^((-1/sigma))) ) ); % FOC zs(+1)
zs=0;                            % 0 liquidity condition S
zh=0;                            % 0 liquidity condition H
ch = w*nh - zh + ((1+r(-1))/(1+p))*bh + (taud/lambda)*d;                % H BC
bs = s*zs(-1) + (1-s)*zh(-1);       % Law of motion for s
bh = (1-h)*zs(-1) + h*zh(-1);       % Law of motion for h
ns^phi = cs^(-1/sigma)*w;               % FOC ns
nh^phi = ch^(-1/sigma)*w;                % FOC nh
p*(1-p) = (epsilon-1)/psi*( (epsilon/(epsilon-1))*w - (1+taus) ); % price setting by firms
d = ((1 + taus)*y - w*nc - (psi/2)*p^2*y - taus*y);
y = nc;
(1 - (psi/2)*p^2)*y = c;
omega = 1/(1-lambda);
nc = lambda*nh + (1-lambda)*ns;
c = lambda*ch + (1-lambda)*cs;
1 + r = beta^(-1)*(((1+p)/(1+p_bar))^varphi)*exp(r_star);
r_star = rho*r_star(-1) + shock_r_star;

end;

%--------------------------------------------------------------------------
% 4. Providing the guess for the steady states.
%--------------------------------------------------------------------------

initval;

cs = 1;
ch = 1;
zs = 0;
zh = 0;
bh = 0;
bs = 0;
omega = 1/(1-lambda);
ns=1;
nh=1;
w=1;
v=0;
p=0;
d=0;
c=1;
y=1;
nc=1;
r=0.11111111111111111111111111111111;
r_star = 0;

end;

%---------------------------------------------------------------------------
% 5. Checking that the Blanchard - Kahn conditions are fulfilled
%-------------------------------------------------------------------------

check;

%--------------------------------------------------------------------------
% 6. Specifying the variance of the shocks
%--------------------------------------------------------------------------

shocks;

var shock_r_star = sigma_star^2;

end;

%--------------------------------------------------------------------------
% 7. Letting Dynare does (your and mine) dirty job of computing the
%    steady states of the endogenous variables
%--------------------------------------------------------------------------

%--------------------------------------------------------------------------
% 8. Simulation
%--------------------------------------------------------------------------

stoch_simul(order=1, irf=40);
``````

This is the ERROR MESSAGE:

dynare Bilbiie

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Using 64-bit preprocessor
Starting Dynare (version 4.5.7).
Starting preprocessing of the model file …
Found 18 equation(s).
Evaluating expressions…done
Computing static model derivatives:

• order 1
Computing dynamic model derivatives:
• order 1
Processing outputs …
done
Preprocessing completed.

Error using print_info (line 90)
The steady state contains NaN or Inf

Error in check (line 76)
print_info(info, 0, options);

Error in Bilbiie (line 249)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

1 Like

I would also like to point out that, after adding the “resid;” command, I obtain:

Residuals of the static equations:

Equation number 1 : NaN
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0
Equation number 18 : 0

How can I solve this problem?
Thank you

I have now modified the model. I have rewritten equation 1 so:

cs^(-1/sigma)* v = beta*( (v(+1)+d(+1))*cs(+1)^(-1/sigma) ); % FOC omega static

I have moved v from the denominator to the numerator.

Is this correct?

Now the model is running normally.

Thank you

1 Like

This seems correct to me. This should be the correct FOC that allows for `v` to be zero, because you did not yet divide by it.

1 Like

Thank you jpfeifer for the availability and the quick reply. You are a great help!
Happy New Year!