I am trying to replicate

The BGG model with Bubbles from

Bernanke & Gertler “Monetary Policy & Asset Price Volatility” paper (2000).

The link to the paper is https://www.nber.org/system/files/working_papers/w7559/w7559.pdf

However, I came across a problem,

which is that there are 18 equations but 17 endogenous variables in the model.

I would like to solve this problem.

Any help would be greatly appreciated.

The following are my code:

var c ce i g r s k q rq mc y rs n z l pi rn rk;

varexo e_g e_z;

parameters C_Y Ce_Y, I_Y, G_Y sigma phi delta b beta R Rq Y_N N_K alpha vtheta psi chi theta_f theta_b K_N rho_g rho_z kappa tau Rk;

C_Y = 0.61;

Ce_Y = 0.04;

I_Y = 0.18;

G_Y = 0.2;

sigma = 1.0;

phi = 0.25;

delta = 0.025;

b = 0.98*(1-0.025);

beta = 0.99;

R = 1/beta;

Rq = R+0.01;

Y_N = 0.28;

N_K = 0.5;

alpha = 0.98;

vtheta = (1-delta)/(alpha*Y_N*N_K + 1 - delta);

psi = 0.05;

chi = 1.33;

theta_f = 0.5;

theta_b = 0.5;

K_N = 1/N_K;

rho_g = 0.95;

rho_z = 1.0;

rnss = 1.02; // Target nominal interest

kappa = 0.086;

tau = 0.95;

Rk = R + 0.02;

model;

// Aggregate Demand

y = C_Y*c + Ce_Y*ce + I_Y*i + G_Y*g; // A1 Aggregate Demand

c = -sigma*r + c(+1); // A2 Euler Condition for Household Consumption
ce = s + k(+1); // A3 Assumption: Entrepreneurial Cons is prop. to stock value
q(+1) = phi*(i(+1) - k(+1)); // A4 Investment is prop. to fundamental value of capital

//Returns to Stock and Capital

s - q = (1-delta)/(b*Rq)*(s(+1)- q(+1)); // A5 The expected evolution of the bubble

rq = (1-vtheta)*(mc+y-k)+vtheta*q-q(-1); // A6 Fundamental Return to Capital

rs = (1-vtheta)*(mc+y-k)+vtheta*s-s(-1); // A7 Return to Stocks

rs(+1) = rq(+1) - (1-b)*(s-q); // A8 Relation between stock return and fundamental return
rs(+1) = r - psi*(n-s-k(+1)); // A9 Link between spread and firm leverage

// Aggregate Supply

y = z + alpha*k + (1-alpha) l; // A10 Cobb Douglas Production Function*pi(-1); // A12 Evolution of inflation (sticky prices) The Gali n Gertler NK phillip curve

y - l + mc - c = (chi-1)l; // A11 Household Labor-Leisure Decision

pi = kappamc + theta_fpi(+1) + theta_b

// Evolution of state variables and shock process

k(+1) = delta*i + (1-delta)*k; // A13 Capital

n = Rq * ( (K_N) * (rs - rs(-1)) + (1-tau*rk)/(tau) y + n(-1) ); // A14 Internal Equity**

g = rho_g*g(-1) + e_g; // A15 Government Spending AR(1) process
z = rho_z*z(-1) + e_z; // A16 Total Factor Productivity AR(1) process (the technology obey BGG 4.27)

// Monetary Policy Rule

rn = beta* pi(+1); // A17 Policy Rule Accommodative***

r = rn - pi(+1); // A18 Fisher Equation***

end;

steady;

check;

shocks;

var e_g; stderr 0.1;

var e_z; stderr 0.1;

//var e_rn; stderr 1.0;

end;

stoch_simul(irf=24);