Hi,

I attach below the dynare code of an RBC model with government and fiscal policy shocks.

There’s an error on the number of forward looking variables and I can’t really find which one. tax rates are exogenous (become endo. with shocks) and government investment, spending and transfers are all proportions of output. it works when I move some variables one period forward (with results that make sense) but the timing become weird.

Here’s the code:

```
% Endogenous variables
var C L K KG I IG G B Y A iB T R W BtY TRA Tw Tc Tr g ig tra sTc sTw sTr sG sIG sTRA;
% Exogenous variables (Shocks)
varexo eA eTc eTw eTr eG eIG eTRA;
% Parameters
parameters Phi Sigma Beta Alpha1 Alpha2 Alpha3 Rho Delta DeltaG RhoTRA RhoG RhoIG RhoTc RhoTw RhoTr;
% Parameter values
Beta = 0.985;
Sigma = 2;
Phi = 1.5;
Delta = 0.025;
DeltaG = 0.025;
Alpha1 = 0.4;
Alpha2 = 0.6;
Alpha3 = 0.05;
Rho = 0.9;
RhoTc = 0.0;
RhoTr = 0.0;
RhoTw = 0.0;
RhoG = 0.0;
RhoIG = 0.0;
RhoTRA = 0.0;
% The Steady State
Tcss = 0.2;
Twss = 0.1;
Trss = 0.35;
igss = 0.2/3;
gss = 0.8/9;
trass = 0.4/9;
Rss = ((1/Beta)-1+Delta)/(1-Trss);
iBss = (1/Beta);
m1 = (((((1-Twss)/(1+Tcss))^(1/Sigma))*((Alpha2)^(-Phi/Sigma)))/(1-Delta*(Alpha1/Rss)-igss-gss))^(-Sigma/(Sigma+Phi));
m2 = (((DeltaG/igss)^Alpha3)*((1/Alpha2)^Alpha2)*((Rss/Alpha1)^Alpha1))^(1/Alpha3);
m3 = 1/(((Phi+1)/(Phi+Sigma))-(Alpha2/Alpha3));
Wss = (m1*m2)^m3;
Yss = m2*(Wss^(Alpha2/Alpha3));
Kss = Alpha1*Yss/Rss;
Lss = Alpha2*Yss/Wss;
Iss = Delta*Kss;
Gss = gss*Yss;
IGss = igss*Yss;
TRAss = trass*Yss;
KGss = IGss/DeltaG;
Css = Yss-Iss-IGss-Gss;
Tss = Tcss*Css+Twss*Wss*Lss+Trss*Rss*Kss;
Bss = (Tss-Gss-IGss)*(1/(1-Beta));
BtYss = Bss/Yss;
% The (Nonlinear) Model
model;
(C^Sigma)*(L^Phi) = ((1-Tw)/(1+Tc))*W;
(C(+1)/C)^Sigma = Beta*(1-Delta+(1-Tr)*R(+1));
1-Delta+(1-Tr)*R(+1) = iB;
I = K-(1-Delta)*K(-1);
Y = A*(K(-1)^Alpha1)*(L^Alpha2)*(KG(-1)^Alpha3);
K(-1) = Alpha1*(Y/R);
L = Alpha2*(Y/W);
G+IG+TRA+B(-1) = T+B/iB;
IG = KG-(1-DeltaG)*KG(-1);
T = Tc*C+Tw*W*L+Tr*R*K(-1);
IG = ig*Y;
G = g*Y;
TRA = tra*Y;
BtY = B/Y;
ig = (0.2/3)*sIG;
g = (0.8/9)*sG;
tra = (0.4/9)*sTRA;
Tc = 0.2*sTc;
Tw = 0.1*sTw;
Tr = 0.35*sTr;
Y = C+I+IG+G;
A = exp(eA)*(A(-1))^Rho;
sTc = exp(eTc)*(sTc(-1))^RhoTc;
sTr = exp(eTr)*(sTr(-1))^RhoTr;
sTw = exp(eTw)*(sTw(-1))^RhoTw;
sG = exp(eG)*(sG(-1))^RhoG;
sIG = exp(eIG)*(sIG(-1))^RhoIG;
sTRA = exp(eTRA)*(sTRA(-1))^RhoTRA;
end;
% Initial guess values for the definitive steady state
initval;
A = 1;
C = Css;
Y = Yss;
K = Kss;
KG = KGss;
L = Lss;
W = Wss;
R = Rss;
I = Iss;
B = Bss;
iB = iBss;
T = Tss;
BtY = BtYss;
G = Gss;
IG = IGss;
TRA = TRAss;
Tc = Tcss;
Tw = Twss;
Tr = Trss;
sG = 1;
sIG = 1;
sTRA = 1;
sTc = 1;
sTr = 1;
sTw = 1;
end;
% Finding the steady state and checking for stability
steady;
check;options_.noprint=1;
% AR(1) processes with exogenous shocks (All shocks but TFP's set to zero)
shocks;
var eA; stderr 0.01;
var eTc; stderr 0.0;
var eTr; stderr 0.0;
var eTw; stderr 0.0;
var eG; stderr 0.0;
var eIG; stderr 0.0;
var eTRA; stderr 0.0;
end;
%Simulation and Impulse-response
stoch_simul(irf=50,periods=500,qz_zero_threshold=1e-20);
```

Thank you.