# Error message

HI,
i tried to do this example in matalb by dynare( to be fimliar with dynare), but dynare give me in every steps an error message, like this one:

?? Error: File: Untitled.m Line: 17 Column: 19
The expression to the left of the equals sign is not a valid target for an assignment.
i think he mean the by line 17 column 19 the sign (=) , but really i dont see what’s wrong with (=)

periods 20100;
var y, c, k, a, h, b;
varexo e,u;

parameters beta, rho, beta, alpha, delta, theta, psi, tau;

alpha = 0.36;
rho = 0.95;
tau = 0.0025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;

model;

cthetah^(1+psi)=(1-alpha)* y;
k = beta*(((exp(b)c)/exp(b(+1))c(+1)))(exp(b(+1)alphay(+1)+(1-delta)k));
y = exp(a)
(k(-1)^alpha)
(h^(1-alpha));
k= exp(b)(y-c)+(1-delta)k(-1);
a= rho
a (-1)+ tau
b(-1)+ e;
b= taua(-1)+rhob(-1)+ u;

initval;
y = 1.08068253095672;
c = 0.80359242014163;
h = -1.2;
k = 2.4;
a = 0;
b = 0;
e = 0;
u = 0;
sigma_e = 0.000081, phi0.0090.009; 0.000081];
stoch_simul;

You are missing the keyword “end;”

at the end of the model section and of the initval section

Best

Michel

sorry i have just miss it in uploading the code, but i have done it correctly in dynare . now the error message is : ?? Error using ==> var
Too many input arguments.
matlab give this error message any time i try to do an example.

Thanks

Could you put your file in attachment so that we can see exactly what you are submitting to Dynare?

Thanks

Michel

ok this an example of what i have try to done ( i repeat your example, to see how does work)

periods 20100;

var y, c, k, a, h, b;
varexo e,u;

parameters beta, rho, beta, alpha, delta, theta, psi, tau;

alpha = 0.36;
rho = 0.95;
tau = 0.0025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;

model;
exp(k) = beta
(exp(b(+1))alphaexp(y(+1))+(1-delta)exp(k)));
exp(y)=exp(a)
(exp(k(-1))^alpha)
(exp(h)^(1-alpha));
exp(k)= exp(b)
a = rho
a (-1)+tau
b(-1)+ e;
b = taua (-1)+rhob(-1)+u;

end;

initval;
y = 0.1;
c = -0.2;
h = -1.2;
k = 2.4;
a = 0;
b = 0;
e = 0;
u = 0;
end;

and this the error message of matlab:

??? Error: File: Untitled3.m Line: 17 Column: 29
The expression to the left of the equals sign is not a valid target for an assignment.

thanks for help

I’m attaching example1.mod that does what you are trying to do. I believe that when you are writing the model file, you aren’t saving it the right way. This is indicated by “untitled.m”
When you save the file you should give it a name like “example1.mod”. You shouldn’t save it with the Matlab default extension .m

Note that with

Dynare performs a Monte Carlo simiulation over 20100 periods which takes a long time. This isn’t necessary to get the solution.

Best

Michel
example1.mod (740 Bytes)

Thanks a lot , merci beaucoup.

as you suggest the problem was the way i have save the file, i haven’t change the extension to .mod

merci encore, mille merci