# Non-linear vs Log-linearized Model

I am a beginner, is it advisable to use non-linear model and let Dynare linearize or manually log-linearize the model? For example, I cannot find one implementation of non-linear BGG (1999) Financial Accelerator model except super-complex CMR 2010 Risk Shock implementation.

Can you point one to me please?

Usually, it is advisable to let Dynare linearize as this step is very error prone. The problem is that some models do not have a closed-form recursive representation that can be entered in computer code. In contrast, for a linearized model such a closed-form representation sometimes exist. In that case, people typically use the linearized version.

For the BGG model, people historically have used the linearized version presented in their paper. But there is no good reason for this. The problematic equation is the pricing equation that is the same as in any New Keynesian model. We know that a closed form recursive representation exists.

1 Like

May I revive this topic. I have a log-linearized model which solves in dynare but the non-linear version (of the same model) does not solve in dynare…steady state cannot be found in the non-linear model in dynare. That could sometimes happen?

``````//Non linear model

//Variables
var R C I K L M N P Ph PIh RB rf S Sm W X Y A;

//Shocks
varexo epsilon_A epsilon_rf epsilon_Sm;

//Parameters
parameters alpha beta delta phi sigma rho;

alpha = 0.36;
beta = 0.95;
delta = 0.025;
phi = 1.5;
sigma = 2;
rho = 0.6;

model;
//1-Labor supply
W * C^(-sigma) - L^phi = 0;

//2-Euler equation
beta * ((1 - delta) * (C(+1)^(-sigma)) + (R(+1) * C(+1)^(-sigma))) - C^(-sigma) = 0;

//3-Law of motion of capital
I - K + K(-1) * (1 - delta) = 0;

//4-Production function
-Y + A * K(-1)^alpha * L^(1 - alpha) = 0;

//5-Demand for capital
-R + alpha * A * K(-1)^(-1 + alpha) * L^(1 - alpha) = 0;

//6-Demand for labor
-W + A * (1 - alpha) * K(-1)^alpha * L^(-alpha) = 0;

//7-Equilibrium condition
Y = M + X + N;

//8-Productivity shock
A = rho*A(-1) + epsilon_A;

//9-Aggregate price
-P + Ph^0.5 * S^0.5 = 0;

//10 M (Index of consumption of domestic goods)
-M + 0.5 * C * P^-2 * Ph^2 = 0;

//11 N (Index of investment of domestic goods)
-N + 0.5 * I * P^-2 * Ph^2 = 0;

//12 X (Export)
-X + 0.5 * Ph^-2 * S^2 = 0;

//13 Domestic inflation
PIh - Ph(-1)^-1 * Ph = 0;

//14 Domestic price
-Ph + A^-1 * (alpha^-1 * R)^alpha * (W * (1 - alpha)^-1)^(1 - alpha) = 0;

//15 UIP
RB * rf^-1 - S^-1 * S(+1) = 0;

//16 Foreign interest rate
rf = rho*rf(-1) + epsilon_rf;

//17 Domestic interest rate
RB = 0.8*RB(-1)+(1-0.8)*(2*(PIh) + 2*(Y))+Sm;

//18 Monetary policy shock
Sm = rho*Sm(-1)+epsilon_Sm;
end;

P = 1;
R = P*((1/beta)-(1-delta));
W = (1-alpha)*(P^(1/(1-alpha)))*((alpha/R)^(alpha/(1-alpha)));
Y = ((R/(R-delta*alpha))^(sigma/(sigma+phi)))*(((1-alpha)^(-phi))*((W/P)^(1+phi)))^(1/(sigma+phi));
K = alpha*(Y/R/P);
I = delta*K;
L = (1-alpha)*(Y/W/P);
S = 1;
RB = 1/beta;
rf = 1/beta;
A = 1;
Ph  = R + W - A;
PIh = Ph - Ph;
X = (0.5)*(Ph/S)^-2;
C = Y - I - X;
M = ((0.5)*(Ph/P)^-0.5)*C;
N = ((0.5)*(Ph/P)^-0.5)*I;
Sm = 1;
end;

resid;

shocks;
var epsilon_A; stderr 0.01;
var epsilon_rf; stderr 0.00;
var epsilon_Sm; stderr 0.00;
end;
stoch_simul(irf=10, periods=1000, qz_zero_threshold=1e-20, pruning) Y;
``````
``````// log linearized model
var R C I K L M N P Ph PIh RB rf S Sm W X Y A;

varexo e epr e_m;

parameters sigma phi alpha beta delta rhoa;

sigma = 2;
phi = 1.5;
alpha = 0.35;
beta = 0.985;
delta = 0.025;
rhoa = 0.6;
model(linear);
#Pss = 1;
#Iss = delta*Kss;
#Css = Yss - Iss;
#Lss = (1-alpha)*(Yss/Wss/Pss);
#Sss = 1;
#phiB = 0.7;
#Bss = phiB*Yss;
#bfss = Bss;
#RBss = 1/beta;
#rfss = 1/beta;
#Ass = 1;
#Phss  = Rss + Wss - Ass;
#PIhss = Phss - Phss;
#Xss = (0.5)*(Phss/Sss)^-2;
#Mss = ((0.5)*(Phss/Pss)^-0.5)*Css;
#Nss = ((0.5)*(Phss/Pss)^-0.5)*Iss;
#Smss = 1;
//1-Labor supply
sigma*C + phi*L = W;

//2-Euler equation

//3-Law of motion of capital
K = (1-delta)*K(-1)+delta*I;

//4-Production function
Y = A + alpha*K(-1) + (1-alpha)*L;

//5-Demand for capital
R = Y - K(-1);

//6-Demand for labor
W = Y - L;

//7-Equilibrium condition
Yss*Y = Mss*M + Xss*X + Nss*N;

//8-Productivity shock
A = rhoa*A(-1) + e;

//9-Aggregate price
Pss*P = 0.5*Phss*Ph + 0.5*Sss*S;

//10 M (Index of consumption of domestic goods)
M = -2*Ph + 2*P + C;

//11 N (Index of investment of domestic goods)
N = -2*Ph + 2*P + I;

//12 X (Export)
X = - 2*(Ph - S);

//13 Domestic inflation
PIh = Ph - Ph(-1);

//14 Domestic price
Ph = W + R - A;

//15 UIP
RB = (rf + S(+1) - S);

//16 Foreign interest rate
rf = rhoa*rf(-1) + epr;

//17 Domestic interest rate
RB = 0.8*RB(-1)+(1-0.8)*(2*(PIh) + 2*(Y))+Sm;

//18 Monetary policy shock
Sm = rhoa*Sm(-1)+e_m;
end;

check;
model_diagnostics;
model_info;
shocks;
var e; stderr 0.01;
var epr; stderr 0.00;
var e_m; stderr 0.00;
end;
stoch_simul(periods=500,qz_zero_threshold=1e-1000, irf =35) Y;
``````

It seems you are missing an `exp()` around some exogenous processes like `A`. Otherwise, you will have TFP be mean 0.

Many thanks! So for example from `A` to `exp(A)`?. Hmmm…does not seem to work though…will change function forms and check if the problem persists.

No, not everywhere. But

``````A = rho*A(-1) + epsilon_A;
``````

implies that `A` is mean 0. Thus,

``````//4-Production function
-Y + A * K(-1)^alpha * L^(1 - alpha) = 0;
``````

is missing an exp() around A.

1 Like