# Error message running dynare first codes

Hi,
I am dynare new user.
I try to run this model on .mod file :

var y c k i l r w a lamda;
varexo e;

parameters beta delta gamma alpha sigmae rho_a;

alpha = 0.33;
beta = 0.99;
delta = 0.023;
gamma = 0.3;
rho_a = 0.95;
sigmae = 0.01;

model;

gamma/c = lamda;
((1-gamma)/gamma)(c/(1-l))=w;
lamda=beta
lamda(+1)(1-delta+r(+1));
k=(1-delta)k(-1)+ i;
y=exp(a)
(k(-1))^alpha
l^(1-alpha);
w=(1-alpha)(y/l);
r=alpha
(y/k(-1));
y=c+i;
a=rho_a*a(-1)+e;

initval;

k= log(29);
y= log(3);
a=0;
c=log(2.5);
i=log(1.5);
l = 0.34;
w = 3.23;
lamda = 0.32;
r = 0.033;
end;

shocks;
var e = sigmae^2;
end;

stoch_simul(hp_filter=6.25,order = 1, irf=20);

• And I have these error returns :
Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.3.3).
Starting preprocessing of the model file …
ERROR: test.mod:31.1-7: Unknown symbol: initval

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

1. Please, tell me where I am wrong
2. Is it advised to put the langrangian multiplier in the model like variable? If yes, what type of variable?

I am working on dynare 4.3.3 and MATLAB 7.9.0(R2009b). Thank you!

I am 99% sure that the error is because you forgot to write “end;” after your “model;” section. For these things, often the error is very small and just takes comparing it closely.

RE: Lagrangian – no, I do not think it is necessary since you can write in the FOCs yourself. Dynare is not great at defining new variables unless they are explicitly endogenous or exogenous at the beginning; Matlab you can do that with no problem, but then you face other challenges.

Yes, there is an end missing after the model block.

The Langrange multiplier is an endogenous variable in the model that is equal to the marginal utility of consumption. For a CES power utility function

You can add such an equation to the model and then use lambda as any other variable.

Thank a lot, jpfeifer and macroresearch123!
Everything is ok now!