# RBC with government spending

This is a simple RBC model with government spending. The government levies a constant consumption tax. This tax rate does not change. The government issues a bond for price q and pays back the bond quantity in the next period. The government transfers to household. The higher the difference between the output in the two period, the lower the transfer will be (feedback rule for government).

There is no problem when I run model diagnostics, but I cant run the simulation.

var c n k z r w y q b t;
predetermined_variables k b;
varexo e_z;
parameters beta theta delta rho a tau psi;

beta = 0.99;
delta = 0.025;
theta = 0.36;
a = 1.72;
rho = 0.95;
tau = 0.05;
psi = -0.003;

params = [beta theta delta a tau psi];
init = [0.5 0.1 1 0.1 0.1 0.1 0.01 0.001];

options = optimset(‘Display’,‘iter’);
[ss,Fval,exitflag] = fsolve(‘rbc_gov_ss’,init,options,params);

model;
(w / c)(1 / (1 + tau)) = a / (1 - n);
beta * ((1/c(+1)) * (1 / (1 + tau)) * (r(+1) + 1 - delta)) = (1 / c) * (1 / (1 + tau));
beta * ((1/c(+1)) * (1 / (1 + tau))) = (q / c) * (1 / (1 + tau));
(1 + tau) * c + k(+1) + q * b(+1) = w * n + r * k + (1 - delta) * k + b + t;
y = exp(z) * k^(theta) * n^(1 - theta);
w = (1 - theta) * exp(z) * k^(theta) * n^(-theta);
r = theta * exp(z) * k^(theta - 1) * n^(1 - theta);
z = rho
(z(-1)) + e_z;
tau * c + q * b(+1) = b + t;
t = psi * (y - y(-1));
end;

initval;
z = 0;
c = ss(1);
n = ss(2);
k = ss(3);
r = ss(4);
w = ss(5);
y = ss(6);
q = ss(7);
b = ss(8);
t = 0;
end;

model_diagnostics;
resid;

shocks;
var e_z = 0.01^2;
end;

stoch_simul(periods=2000, drop=200,irf = 100,order=1);

You have various mistakes in the code snippet you attach, lines 21 and 28 are missing `*` times operator (I guess). Also what `rbc_gov_ss` is? (I mean where is it defined)

The ss calculation is done in another script.

Here is the fixed model.

``````var c n k z r w y q b t;
predetermined_variables k b;
varexo e_z;
parameters beta theta delta rho a tau psi;

beta = 0.99;
delta = 0.025;
theta = 0.36;
a = 1.72;
rho = 0.95;
tau = 0.05;
psi = -0.003;

params = [beta theta delta a tau psi];
init = [0.5 0.1 1 0.1 0.1 0.1 0.01 0.01];

options = optimset('Display','iter');
[ss,Fval,exitflag] = fsolve('rbc_gov_ss',init,options,params);

model;
(w / c) * (1 / (1 + tau)) = a / (1 - n);
beta * ((1/c(+1)) * (1 / (1 + tau)) * (r(+1) + 1 - delta)) = (1 / c) * (1 / (1 + tau));
beta * ((1/c(+1)) * (1 / (1 + tau))) = (q / c) * (1 / (1 + tau));
(1 + tau) * c + k(+1) + q * b(+1) = w * n + r * k + (1 - delta) * k + b + t;
y = exp(z) * k^(theta) * n^(1 - theta);
w = (1 - theta) * exp(z) * k^(theta) * n^(-theta);
r = theta * exp(z) * k^(theta - 1) * n^(1 - theta);
z = rho*(z(-1)) + e_z;
tau * c + q * b(+1) = b + t;
t = psi * (y - y(-1));
end;

initval;
z = 0;
c = ss(1);
n = ss(2);
k = ss(3);
r = ss(4);
w = ss(5);
y = ss(6);
q = ss(7);
b = ss(8);
t = 0;
end;

model_diagnostics;
resid;

shocks;
var e_z = 0.01^2;
end;

stoch_simul(periods=2000, drop=200,irf = 100,order=1);

``````

For the calculation of the ss;

``````function X = rbc_gov_ss(initial,param)

beta = param(1);
theta = param(2);
delta = param(3);
a = param(4);
tau = param(5);
psi = param(6);

c = initial(1);
n = initial(2);
k = initial(3);
r = initial(4);
w = initial(5);
y = initial(6);
q = initial(7);
b = initial(8);

X = [
(w / c) * (1 / (1+tau))- (a / (1 - n));
beta * ((r + 1 - delta)) - 1;
beta - q;
(1 + tau) * c + k + q*b - w * n - r * k - (1 - delta) * k - b;
y - k^(theta) * n^(1 - theta);
w - (1 - theta) * k^(theta) * n^(-theta);
r - theta * k^(theta - 1) * n^(1 - theta);
tau * c + q * b - b;
];

``````

Hi,
I think that there is a mistake in the timing of capital. I also guess that there is a mistake in the timing of your consumption tax within your Euler equation.

I don’t think so.

This was done from a simpler RBC model using the same capital timing.

It seems your model requires debt feedback. As is, what assures government solvency?

So, I put the transfer to also be dependent on changes from last period debt.

Still have this error;

Blanchard & Kahn conditions are not satisfied: no stable equilibrium.

``````var c n k z r w y q b t;
predetermined_variables k b;
varexo e_z;
parameters beta theta delta rho a tau psi;

beta = 0.99;
delta = 0.025;
theta = 0.36;
a = 1.72;
rho = 0.95;
tau = 0.05;
psi = -0.003;

params = [beta theta delta a tau psi];
init = [0.5 0.1 1 0.1 0.1 0.1 0.01 0.01];

options = optimset('Display','iter');
[ss,Fval,exitflag] = fsolve('rbc_gov_ss',init,options,params);

model;
(w / c) * (1 / (1 + tau)) = a / (1 - n);
beta * ((1/c(+1)) * (1 / (1 + tau)) * (r(+1) + 1 - delta)) = (1 / c) * (1 / (1 + tau));
beta * ((1/c(+1)) * (1 / (1 + tau))) = (q / c) * (1 / (1 + tau));
(1 + tau) * c + k(+1) + q * b(+1) = w * n + r * k + (1 - delta) * k + b + t;
y = exp(z) * k^(theta) * n^(1 - theta);
w = (1 - theta) * exp(z) * k^(theta) * n^(-theta);
r = theta * exp(z) * k^(theta - 1) * n^(1 - theta);
z = rho*(z(-1)) + e_z;
tau * c + q * b(+1) = b + t;
t = psi * (y - y(-1)) + psi * (b - b(-1));
end;

initval;
z = 0;
c = ss(1);
n = ss(2);
k = ss(3);
r = ss(4);
w = ss(5);
y = ss(6);
q = ss(7);
b = ss(8);
t = 0;
end;

model_diagnostics;
resid;

shocks;
var e_z = 0.01^2;
end;

stoch_simul(periods=2000, drop=200,irf = 100,order=1);

``````
``````var c n k z r w y q b t;
predetermined_variables k b;
varexo e_z;
parameters beta theta delta rho a tau psi;

beta = 0.99;
delta = 0.025;
theta = 0.36;
a = 1.72;
rho = 0.95;
tau = 0.05;
psi = 100.3;

params = [beta theta delta a tau psi];
init = [0.5 0.1 1 0.1 0.1 0.1 0.01 0.01];

options = optimset('Display','iter');
[ss,Fval,exitflag] = fsolve('rbc_gov_ss',init,options,params);

model;
(w / c) * (1 / (1 + tau)) = a / (1 - n);
beta * ((1/c(+1)) * (1 / (1 + tau)) * (r(+1) + 1 - delta)) = (1 / c) * (1 / (1 + tau));
beta * ((1/c(+1)) * (1 / (1 + tau))) = (q / c) * (1 / (1 + tau));
(1 + tau) * c + k(+1) + q * b(+1) = w * n + r * k + (1 - delta) * k + b + t;
y = exp(z) * k^(theta) * n^(1 - theta);
w = (1 - theta) * exp(z) * k^(theta) * n^(-theta);
r = theta * exp(z) * k^(theta - 1) * n^(1 - theta);
z = rho*(z(-1)) + e_z;
tau * c + q * b(+1) = b + t;
t = 0 * (y - y(-1)) + psi * log(b(+1)/b);
end;

initval;
z = 0;
c = ss(1);
n = ss(2);
k = ss(3);
r = ss(4);
w = ss(5);
y = ss(6);
q = ss(7);
b = ss(8);
t = 0;
end;

model_diagnostics;
resid;

shocks;
var e_z = 0.01^2;
end;
check;
stoch_simul(periods=2000, drop=200,irf = 100,order=1);
``````

works, so it may be a problem with the parameters/rule

Thanks. How did you come up with the number for psi?

Also, is this the way to express deviation from X (past level/steady state). If I want the transfer to be related to SS then, I have to put b(+1)/ss right?

1. I just played around with the numbers until it worked. This was to confirm my hunch that it’s about debt dynamics.
2. The formulation `psi*log(b(+1)/b)` implements feedback to percentage changes in debt. That makes it easier to interpret `psi` as a semi-elasticity. You could also use `psi * log(b(+1)/steady_state(b))`
1 Like

That’s very useful. Thanks.

So, is there a reason why we don’t use b(-1)/steady_state?

Or, do we interpret this as the debt market this period clears first, then the government decide on how much to transfer?

You can use a different timing. Contemporaneous relations often make finding the stability region easier. But `b(-1)` would be weird as `b` is already predetermined.