Page 1 of 1

error message

PostPosted: Tue May 08, 2007 2:45 pm
by nabilfrance
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;

c*theta*h^(1+psi)=(1-alpha)* y;
k = beta*(((exp(b)*c)/exp(b(+1))*c(+1)))*(exp(b(+1)*alpha*y(+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= tau*a(-1)+rho*b(-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, phi*0.009*0.009; 0.000081];
stoch_simul;

PostPosted: Tue May 08, 2007 4:14 pm
by MichelJuillard
You are missing the keyword "end;"

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

Best

Michel

PostPosted: Wed May 09, 2007 8:30 am
by nabilfrance
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

PostPosted: Wed May 09, 2007 11:55 am
by MichelJuillard
Could you put your file in attachment so that we can see exactly what you are submitting to Dynare?

Thanks

Michel

PostPosted: Wed May 09, 2007 2:40 pm
by nabilfrance
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(c)*theta*exp(h)^(1+psi )=(1-alpha)*exp(y);
exp(k) = beta*(((exp(b)*exp(c))/(exp(b(+1))*exp(c(+1))))
*(exp(b(+1))*alpha*exp(y(+1))+(1-delta)*exp(k)));
exp(y)=exp(a)*(exp(k(-1))^alpha)*(exp(h)^(1-alpha));
exp(k)= exp(b)*(exp(y)-exp(c))+(1-delta)*exp(k(-1));
a = rho*a (-1)+tau*b(-1)+ e;
b = tau*a (-1)+rho*b(-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

PostPosted: Wed May 09, 2007 3:22 pm
by MichelJuillard
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
periods 20100;

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

Best

Michel

PostPosted: Thu May 10, 2007 1:04 pm
by nabilfrance
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