Dear all,

I am trying to create a simple NOEM model. (with tradable and non-tradable goods)

It works fine if I do not allow HH to borrows.

But as soon as I introduce debt in the model agents will borrow and keep financing by rolling over their debt.

I don’t know if you have a solution?

```
var PIE U Nn Nt N PN PT P PTF PTH E W YN YT CN CT CTH CTF C B lambda
G r;
varexo An At ;
parameters omega k sigma phi theta v alpha Phi beta T;
k=0.48;
omega=0.5;
sigma=2;
phi=3;
theta=2;
v =0.5;
Phi=0.3;
alpha=01;
mu=1.5;
T=0;
beta=0.98;
model;
//period 1
PN=1;
PTF=1;
//market clearing
N=Nt+Nn;
YN=G/PN+CN;
//price definition
P=(omega*PT^(1-k)+(1-omega)*(PN)^(1-k))^(1/(1-k));
PT=(v*PTH^(1-theta)+(1-v)*(E*PTF)^(1-theta))^(1/(1-theta));
E=P/PTF;
//utility and consumption definition
U=(1-Phi)*(C^(1-sigma))/(1-sigma)+Phi*((G/PN)^(1-sigma))/(1-sigma)-N^(1+phi)/(1+phi);
C=(omega^(1/k)*CT^((k-1)/k)+(1-omega)^(1/k)*CN^((k-1)/k))^(k/(k-1));
CT=(v^(1/theta)*CTH^((theta-1)/theta)+(1-v)^(1/theta)*CTF^((theta-1)/theta))^(theta/(theta-1));
//production and profit maximization
An*alpha*(Nn)^(alpha-1)*PN=W;
At*alpha*(Nt)^(alpha-1)*PT=W;
PIE=YN*PN+CTH*PTH+E*PTF*(YT-CTH)-N*W;
YN=An*(Nn)^(alpha);
YT=At*(Nt)^(alpha);
//BC and FOC
PTH*CTH+PN*CN+PTF*E*CTF+B=W*N+PIE-T+(1+r)*B(-1);
lambda*W=N^phi;
lambda*PTF*E=(1-Phi)*C^((1-sigma*k)/k)*omega^(1/k)*CT^((k-1)/k+(1-theta)/theta)*(1-v)^(1/theta)*CTF^(-1/theta);
lambda*PTH=(1-Phi)*C^((1-sigma*k)/k)*omega^(1/k)*CT^((k-1)/k+(1-theta)/theta)*v^(1/theta)*CTH^(-1/theta);
lambda*PN=(1-Phi)*C^((1-sigma*k)/k)*(1-omega)^(1/k)*CN^(-1/k);
lambda=beta*(1+r)*lambda(+1);
r=0.026;
//r=1/beta-1;
//Government, now for simplicity =0
G=0;
//T+Bg-(1+r)*Bg(-1);
end;
initval;
An=1;
At=1;
G=0.2;
Nn=0.5;
Nt=0.3;
PN=1;
PT=1.2;
PTF=1;
PTH=1.2;
P=1.2;
E=1.2;
W=0.8;
N=0.2;
YT=0.3;
YN=0.3;
CN=0.2;
CTH=0.25;
CTF=0.25;
lambda=0.9;
C=1;
CT=0.5;
U=-2.4;
PIE=0.2;
//Bg=0;
B=-1;
end;
steady;
shocks;
var An = 1;
var At = 1;
end;
stoch_simul(order=1,irf=20,nograph,ar=1);
```