# Error message wrt Jacobian

Dear Johannes Pfeifer,

I have a Problem with the attached mod file. Dynare says that “The Jacobian contains Inf or NaN.” The variable “u” has steady state 1, such that (u-1)^2=(0)^2 may be the problem?

I am wondering if this can be the problem because variable capital utilization has been introduced as proposed here:

In fact, I guess if I would log-linearize the model by hand, the problem might not occurr?

Kind regards

``````% Basic RBC model
% + habit formation
var Uc Ul F Fk Fl c y k z w l r i q M c_l k_l u delta Uchat Ulhat Fhat Fkhat Flhat chat yhat khat zhat what lhat rhat ihat qhat;

varexo e_z;

parameters delta0 delta1 delta2 beta alpha eta rho h phi;

delta0 = 0.025;
delta1 = 1/beta - 1 + delta0;
delta2 = 0.10;
rho    = 0.90;
alpha  = 0.3;
eta    = 1.5;
beta   = 0.95;
h      = 0.9;
phi    = 2.0;

model;

// (1) marginal utility wrt consumption
//Uc = 1/c;
Uc = (1-h)/(c-h*c(-1));

// (2) marginal utility wrt labor
Ul = eta/(1-l);

// (3) production function
//F = z*k(-1)^alpha*l^(1-alpha);
F = z*(u*k(-1))^alpha*l^(1-alpha);

// (4) marginal productivity of capital
//Fk = alpha*z*(l/k(-1))^(1-alpha);
Fk = alpha*z*(l/(u*k(-1)))^(1-alpha);

// (5) marginal productivity of labor
//Fl = (1-alpha)*z*(k(-1)/l)^alpha;
Fl = (1-alpha)*z*(u*k(-1)/l)^alpha;

// (6)
M = Uc/Uc(-1);

// (7)
q = beta*(M(+1))*(r(+1)*u(+1)+(1-delta(+1))*q(+1));

// (8)
1 = q*(1-phi/2*(i/i(-1)-1)^2 -phi*(i/i(-1)-1)*i/i(-1)) + beta*M(+1)*q(+1)*phi*(i(+1)/i-1)*(i(+1)/i)^2;
//Uc = beta*(1+r(+1)-delta)*Uc(+1);

// (9) rental rate of capital
Fk = r;

// (10) output
y = F;

// (11) capital accumulation
//i = k - (1-delta)*k(-1);
k = (1-phi/2*(i/i(-1)-1)^2)*i + (1-delta)*k(-1);

// (12) closed economy identity
y = c + i;

// (13) wage
w = Fl;

// (14) MRS consumption/labor
w*Uc = Ul;

// (15) productivity shock (exogenous)
log(z) = rho*log(z(-1)) + e_z;

// (16)
delta = delta0 + delta1*(u-1) + (delta2/2)*(u-1)^2;

// (17)
delta1 + delta2*(u-1) = r;

// (18)
c_l = c/l;

// (19)
k_l = k/l;

end;

initval;
z     = 1;
r     = 1/beta - 1 + delta0;
k_l   = (alpha*z/r)^(1/(1-alpha));
w     = (1-alpha)*z*(k_l)^alpha;
c_l   = (k_l)^alpha - delta0*k_l;
l     = 1/(1+eta/(1-alpha) - delta0*eta/((1-alpha)*z*k_l^(1-alpha)));
k     = k_l*l;
i     = delta0*k;
y     = z*k_l^alpha*l;
c     = c_l*l;
F     = y;
Uc    = 1/c;
Ul    = eta/(1-l);
Fl    = w;
Fk    = alpha*z*(l/k)^(1-alpha);
M     = 1;
q     = 1;
u     = 1;
delta = delta0;

Uchat = 0;
Ulhat = 0;
Fhat  = 0;
Fkhat = 0;
Flhat = 0;
chat  = 0;
yhat  = 0;
khat  = 0;
zhat  = 0;
what  = 0;
lhat  = 0;
rhat  = 0;
ihat  = 0;
qhat  = 0;
end;

shocks;
var e_z = 1^2;
end;

``````delta0 = 0.025;
But `beta` is only defined later on.