# My model only works with a weird law of motion of capital

I am trying to solve this model where I have government spending in goods, and government spending in public capital. The way I wrote the private capital law of motion does not seem to agree with dynare conventions. If I make my K law of motion like K = (1-deltaP)K(-1) + Ip, the rank condition cannot be verified. Any ideas on how to improve this model?

``````var Y A K N Z C G Ip Ig R r W;
varexo epsA epsG epsZ;
parameters alpha1 alpha2 alpha3 omega wedge deltaP deltaG beta theta chi;
parameters rhoA rhoG rhoZ;

alpha1 = 0.315; alpha2 = 0.1; alpha3=0.585; omega = 0.35; wedge = 0.15;
deltaP = 0.03; deltaG = 0.02; theta = 4; chi = 1;
beta = 0.97; rhoA = 0.95; rhoG = 0.9; rhoZ=0.9;

model;
% Euler equation for consumption and return on capital
1/C(-1) = beta*((1/C)*(R(-1)+(1-deltaP)));  % (1)

% Euler equation for consumption and return on bonds
1/C(-1) = beta*((1/C)*(1+r));  % (2)

% Wage equation derived from marginal productivity of labor
W = alpha2*A*K^(alpha1)*N^(alpha2-1)*Z^(alpha3);  % (3)

% Return on capital derived from marginal productivity of capital
R = alpha1*A*K^(alpha1-1)*N^(alpha2)*Z^(alpha3);  % (4)

% Labor supply equation
theta*N^(chi) = (1/C)*(W);  % (5)

% Cobb-Douglas production function
Y = A*K^(alpha1)*N^(alpha2)*Z^(alpha3);  % (6)

% Aggregate resource constraint
Y = C + G + Ip + Ig;  % (7)

% Capital accumulation equation
K(+1)= (1-deltaP)*K + Ip;  % (8)

% Public capital accumulation equation
Z = (1-deltaG)*Z(-1) + Ig;  % (9)

% TFP (Total Factor Productivity) AR(1) process
log(A) = rhoA*log(A(-1)) + epsA;  % (10)

log(G) =  rhoG * log(G(-1)) + epsG;  % (11) (1-rhoG) * log(omega*steady_state(Y)) +

log(Ig) =  rhoZ * log(Ig(-1)) + epsZ;  % (12) (1-rhoZ) * log(wedge*steady_state(Y)) +
end;

initval;
A = 1;
K = 2;
N = 1/5.6;
R = (1/beta)-(1-deltaP);
r = (1/beta)-1;
W = (alpha2/alpha1)*(K/N)*R;
Y = (1/alpha1) * K * R;
G = wedge * Y;
Z = omega * Y;
Ip = K*deltaP;
Ig = Z*deltaG;
C = Y - G - Ip - Ig;
end;
resid;
check;
``````

This is just me, for some reason the model was not finding a steady state, and I thought that it was a timing convention at the time that Dynare should be in t and t-1 so I changed that. I will change it back to forward looking.

I have another question: how do you solve steady states when it is not feasible analytically. Once I include public capital to my production function is hard to come up with an analytical solution for the steady state.

See e.g.

Thank you, so from what I read on this other post: First, I need to solve a set of equations numerically, and then compute the rest of the equations analytically. Do you have a blog post reference on how to use the fsolve function for the numerical solution?

See e.g.

and

Thank you very much!!