# Hello,everyone,when i dynare my code there are some problems which i cannot to solve,There are 4 eigenvalue(s) larger than 1 in modulus for 6 forward-looking variable(s) The rank condition ISN'T verified! thanks

``````var lam C Rk i inv  Y N  pi  K G omegag B tauc taul tauk  w ;
varexo eg ei etauc etauk etaul ;
parameters beta alpha delta b eta omegags psi rhotaul rhotauk pis;
parameters  rhog rhoi sdg sdi phipi phiy rhotauc ;
parameters lams Cs Rks Bs is invs  Ks ws  Ys Ns taucs tauls tauks Gs ;

%calibration of the parameters
beta = 0.99;
alpha =1/3;
delta = 0.025;
b = 0.65;
eta = 1;
omegags = 0.2;
psi=0.3;
pis=1;
phipi = 1.5;
phiy = 0.5;
rhog = 0.9;
rhoi =0.9;
sdg =0.01;
sdi =0.0;

rhotauc=.5;
rhotaul = .5;
rhotauk =.5;
rhoa = .5;
sigtauc =0;
sigtaul =0;
sigtauk=0;
siga=.01;

taucs = 0.17; //for illustration only
tauls = 0.2;
tauks=0.3;

Rks= ((1/beta) - (1-delta))/(1-tauks); %capital rate
c1= (1/(1+taucs))*((1-beta*b)/(1-b)); %simplifying parameter
Ns = 1/3;
Ks=(Rks/(alpha*Ns^(1-alpha)))^(1/(alpha-1));
Ys =(Ks^alpha)*(Ns^(1-alpha));
ws=(1-alpha)*(Ks^alpha)*Ns^(-alpha);
invs = delta*Ks;
Gs = Ys*omegags;
Cs = Ys - invs - Gs;
lams = c1/Cs;
is =1/(beta*(1-tauks))-1;
Tn=taucs*Cs+tauls*ws*Ns+tauks*Rks*Ks;
Bs = (Tn-Gs)/(1-is);

model;
%(1) 消费一阶条件
exp(lam) *1/(1+exp(tauc))= (1/(exp(C) - b*exp(C(-1))) - beta*b/(exp(C(+1)) - b*exp(C)));

%(2) 劳动一阶条件
psi*exp(eta*N)=exp(lam)*(1-exp(taul))*exp(w);

%(3) 资本一阶条件
exp(lam) = beta*exp(lam(+1))*((1-exp(tauk(+1)))*exp(Rk(+1))-delta +1);

%(4) 债券一阶条件
exp(lam) = beta*exp(lam(+1))*(1-exp(tauk))*(1+exp(i))/exp(pi(+1));

%(5)生产函数
exp(Y)=exp(alpha*K)*exp((1-alpha)*N);

%(6)资本收益率一阶导
exp(Rk)=alpha*exp((alpha-1)*K)*exp((1-alpha)*N);

%(7)工资一阶导
exp(w)=(1-alpha)*exp(alpha*K)*exp((-alpha)*N);

%(8)resource constraint
exp(Y) = exp(C) + exp(inv) + exp(G);

%(9)capital evolution
exp(K) = exp(inv)+(1-delta)*exp(K(-1));

%(11) Budget
exp(G)+exp(i(-1))*exp(B) = exp(tauc)*exp(C)+exp(tauk)*Rk*exp(K)+exp(taul)*exp(w)*exp(N)+exp(B(+1));

%(12) government spending
exp(G) = omegag*exp(Y);

%(13) law of government spending share,omegag could be zero or negative in simulation
omegag = (1-rhog)*omegags + rhog*omegag(-1) + eg;

%(14) consumption tax shock
tauc = (1-rhotauc)*log(taucs)+ rhotauc*tauc(-1) + etauc;

%(15)labor income tax shock
taul = (1-rhotaul)*log(tauls)+rhotaul*taul(-1) + etaul;

%(16) capital gain tax shock
tauk = (1-rhotauk)*log(tauks)+rhotauk*tauk(-1) + etauk;

%(17) Taylor rule
i = (1-rhoi)*log(is) + rhoi*i(-1) + (1-rhoi)*(phipi*(pi - log(pis))+phiy*(Y-Y(-1)))+ei;

end;

initval;
lam = log(lams);
C = log(Cs);
Rk =Rks;
i  = log(is);
inv  =log(invs);
w =log(ws);
Y  =log(Ys);
N =log(Ns);
B=log(Bs);
K =log(Ks);
G =log(Gs);
B=log(Bs);
omegag = omegags;
tauc = log(taucs);
taul = log(tauls);
tauk = log(tauks);
end;

shocks;

var eg = sdg^2;
var ei  = sdi^2;
var etauc = sigtauc^2;
var etaul = sigtaul^2;
var etauk = sigtauk^2;
end;

resid(1);
check;

stoch_simul(order=1,irf=20)  Y C inv N i pi w B G  ;
%stoch_simul(order=1,irf=20) ;
``````

It seems your timing is wrong. In some equations you correctly lagged capital, but not in others (like the production function)

thanks a lot, sir