Fixing equations

Hi,

I’m developing a NK Model with banks and CBDC. But my model apparently does not have a SS and a has a bunch of residuals. I have rechecked the parameter values and calculated steady state values but I’m not sure what I’m doing wrong

The code is given below:

var cs cb ms mb rs rb ws wb ls lb f q d id iq y x ir l i o;
varexo eps_e;
parameters BETAS, BETAB, BETAF, PHI, GAMMA, ETA, KTILDE, XSS, RHOS, RHOP, RHOY, CHI, SIGMA, DELTA;
BETAS = 0.98 ; %discount factor, savers
BETAB = 0.95; %discount factor, borrowers
BETAF = 0.95; %discount factor, banks
ETA = 2.7 ; %labour supply elasticity
PHI = 0.1; %share of savers in labour market
CHI = 0.01791; %preference for money
SIGMA = 0.2; %preference for cbdc
KTILDE = 0.088;
XSS = 1.1;
GAMMA = 0.1925; %statutory liquidity ratio
RHOS = 0.8; %money growth smoothening
RHOP = 1.2 ; %weight on inflation
RHOY = 0.5 ; %weight on output gap
DELTA = 0.75; %shock persistance
STDERR_AE = 0.0029 ;

model;

%SAVERS
1/cs = BETAS*(ir/(i(+1)*cs(+1))) ; %euler equation
1/cs = (CHI/ms) + BETAS*(1/(i(+1)*cs(+1))); % money demand
1/cs = (SIGMA/rs) + BETAS*(1/(i(+1)*cs(+1))); %cbdc demand
ws = (ls^ETA)*cs; %labour supply

%BORROWERS
cb = (wb*lb) + (mb(-1)/i) + (rb(-1)/i) + q - mb - rb - (iq(-1)*q(-1)); %budget constraint
1/cb = (CHI/mb) + BETAB*(1/(i(+1)*cb(+1))); %money demand
1/cb = (SIGMA/rb) + BETAB*(1/(i(+1)*cb(+1))); %cbdc demand
wb = (lb^ETA)*cb ; %labour demand

%BANK
1/q = BETAB*(iq/cb(+1)) - 1/cb; %loan demand
1/d = 1/cs - BETAS*(id/cs(+1)); %deposit supply
iq = (1/BETAF)*(f(+1)/f); %optimal lending rate
id = (1/BETAF)*(1 - GAMMA)*(f(+1)/f); %optimal deposit rate

%FIRMS
y=PHI*ls + (1 - PHI)*lb; %production function
ws = (PHI*y)/(ls*x); %labour demand, savers
wb = ((1 - PHI)*y)/(lb*x); %labour demand, borrowers
i = BETAS*i(+1) - KTILDE*(x-log(XSS)) ;

%MARKET CLEARING OR AGGREGATION
y = cs + cb; %goods market
q = d; %deposits market
l = ls + lb; %labour market aggregation

%MONETARY POLICY
ir = RHOS*ir(-1) + (1-RHOS)*(1+RHOP)*i + (1-RHOS)*RHOY*y + o; %monetary policy rule
o = DELTA*o(-1) + eps_e; %shock process
end ;

initval;
cs = 1;
ms = 1;
rs = 1;
ls = 1;
ws = 1;
cb = 1;
mb = 1;
rb = 1;
lb = 1;
wb = 1;
f = 1;
q = 1;
id = 0.85;
iq = 1.05;
d = 1;
y = 2;
x = 1;
l = 2;
ir = 1.02;
i = 1;
o = 0;
end;
resid;
steady ;

shocks;
var eps_e; stderr 100*STDERR_AE; end;

stoch_simul(dr_algo=0,order=1,irf=20) ;

Are you sure your mixture of linearized and nonlinear equations is correct?

I entered it as completely non-linear (except for the NKPC, it’s the same thing I’ve used in other models as well) and got the same result. Only difference was that my sum of square residuals was smaller, but only marginally

I don’t get it. You use the same name for the mean 0 deviation from steady state and the non-zero level. That cannot work.

I’m sorry, I don’t understand what you’re referring to

You have

i = BETAS*i(+1) - KTILDE*(x-log(XSS)) ;

which requires i=0. How does that work in

1/cs = BETAS*(ir/(i(+1)*cs(+1))) ; %euler equation

?