# Stationary and linear model in dynare 4.2

Hi

I am a problem with dynare version 4.2
I know that must first stationarize my model, then linearize it
I linearize my model by hand and like that dynare automatically Remove it’s trends in all the equations
so i intern Endogenous variables in dynare version 4.2 :

var phivariant b;
trend_var(growth_factor=1+b) gr;
trend_var(growth_factor=phivariant) M;
var(deflator=gr) Y Yh Ynh i g c h k mch mcnh t;
var(deflator=M) lnh lh d W;
var(deflator=M/gr) ph pc p pk;
var rd Rlh rlh j ns ndh ndnh w ah m po pi pih pic
q1k q1h qc rlnh;

and intern my model to linear in dynare version 4.2 :

model (linear);

Y = yh_yYh+ynh_yYnh;
Ynh = c_ynhc+i_ynhi+g_ynhg;
Yh = (1/delta1)h-((1-delta1)/delta1)h(-1);
d = lnh_d
lnh+lh_d
lh;
k = delta
i+(1-delta)k(-1);
ns = ndh_ns
ndh+ndnh_nsndnh;
c = c(+1)-rd+pic(+1);
q1h = z
j-zh+c+(1+delta1)q1h(+1)-(1+delta1)c(+1);
p = kappa
pc_p
pc+(1-kappa)ph_pph;
q1h = ph-pc;
ph = pih+ph(-1);
pc = pic+pc(-1);
qc = pc-p;
p = pi+p(-1);
q1k = q1k(+1)+c-c(+1);
q1k = pk-pc;
w = W-p;
b = rhob
b(-1)+epsilonvariant;
ndnh = Ynh-alfagr+(1-alfa)pk-(1-alfa)W-x1rlnh;
Rlh = rlh_Rlh
rlh;
k = Ynh-alfa
gr-alfapk+alfaW+x2rlnh;
m = -x3
rd+c+qc;
w = c+qc+etans;
ndh = Yh-ah;
pic = (((1-phi
beta)(1-phi))/phi)mcnh+betapic(+1);
pih = (((1-gamma
beta)(1-gamma))/gamma)mch+betapih(+1);
mcnh = alfa
w+(1-alfa)pk-alfagr+x2rlnh;
mch = W-ah+v2
rlh;
g = t_gt+po_gpo+m_g*(m-m(-1)+pi);
t = sigmaY_tY;
po = rhoOpo(-1)+deltaO;
phivariant = m-m(-1)+pi;
phivariant = landa1
phivariant(-1)+landa2deltaO+epsilon;
lnh = W+ndnh;
lh = W+ndh;
ah = rhoA1
ah(-1)+epsilon1A;
rlnh = rhoLnhrlnh(-1)+epsilonLnh;
rlh = rhoLh
rlh(-1)+epsilonLh;
end;

i think in this model , dynare detrend linear model and not main model and we know before linearize must stationarize model
is it true?
so probably we can’t use dynare version 4.2 , for automatically Removing trend in the linear model???
however i run model in this shape and got error as follows:

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.2.0).
Starting preprocessing of the model file …
Found 39 equation(s).
Evaluating expressions…done
ERROR: the second-order cross partial of equation 19 w.r.t. trend variable gr and endogenous variable W is not null.

??? Error using ==> dynare at 126
DYNARE: preprocessing failed

I attach complete code
please guide me and tell me can i use dynare version 4.2 for automatically Removing trend and also intern model linearize?

Thanks
mymodelcode33.mod (2.7 KB)

Dynare does not remove trends in linear models but in the original non linear model (before linearization). We should add an error message when a user attempt to do what you are trying here.
Best, Stéphane.