Error Message

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Error Message

Postby Defoliant » Tue Jul 06, 2010 2:41 pm

The below program generates an error message '??? Error: Unexpected MATLAB operator'

Can anyone help?

var k pi c n b g a;
varexo epsilon_g epsilon_a;

parameters alpha beta delta gamma_c gamma_c_tilde eta lambda lambda_p mu_p phi_b phi_g phi_pi psi rho rho_a rho_g theta theta_n theta_t omega sigma_tilde;
alpha = .33;
beta = .99;
delta = .025;
gamma_c = .7;
gamma_c_tilde = .1;
eta = 1;
lambda_p = .5;
mu_p = .2;
phi_b = .33;
phi_g = .1;
phi_pi = 1.5;
psi = .2;
rho = .01;
rho_a = .97;
rho_g = .9;
theta = .75;
theta_n = .27;
theta_t = .07;
sigma_tilde = 0.5;


model (linear);
k = (1-delta+(delta*alpha/(1-gamma_c_tilde)))*k(-1) + (delta*(1-alpha)/(1-gamma_c_tilde))*n(-1) - (delta*gamma_c/(1-gamma_c_tilde))*c(-1) - (delta/(1-gamma_c_tilde))*g(-1) + (delta/(1-gamma_c_tilde))*a(-1);
pi = (pi(-1) - lambda_p*c(-1) + lambda_p*alpha*k(-1) - (alpha + psi)*lambda_p*n(-1) + lambda_p*a(-1)) / beta;
c = c(-1) - theta_n*n(-1) + theta_n*phi_b*b(-1) - (phi_pi/sigma_tilde)*pi(-1) - (1/sigma_tilde)*pi + theta_n*n - theta_t*phi_b*b - theta_t*phi_g*(rho_g - 1)*g(-1);
n = ( (1-alpha)*n - gamma_c*c(-1) - (1-gamma_c_tilde)*k(-1) + ((1-gamma_c_tilde)*eta*phi_pi)*pi(-1) - (omega-(beta*gamma_c))*c + (omega+beta*(1-gamma_c_tilde-alpha))*k - ((1-gamma_c_tilde)*eta)*pi - (1-(beta*rho_g))*g(-1) + (1-(beta*rho_a))*a(-1) ) / (omega*(1+psi)+beta*(1-alpha));
b = (1 + rho)*(1 - phi_b)*b(-1) + (1 + rho)*(1 - phi_g)*g(-1);
g = rho_g*g(-1) + epsilon_g;
a = rho_a*a(-1) + epsilon_a;
end;

initval;
k = 9;
pi = 1;
c = .76;
n = .3;
b = .76;
a = 1;
g = 0;
end;

steady;

shocks;
var a = .007;
var g = .005;
end;

stoch_stimul;
Defoliant
 
Posts: 10
Joined: Wed Jun 23, 2010 11:28 pm

Re: Error Message

Postby jpfeifer » Tue Jul 06, 2010 3:46 pm

Hi,
I do not get this error message with your program. Could you please post the mod-file as a file. Note also that you did not define/initialize the parameter omega.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Error Message

Postby tom.pacey » Tue Jul 06, 2010 3:50 pm

Thanks, you are correct. I pasted the wrong file (the original also did not initialize lampda_p but neither is used in the model block) but the attached file is the correct one. It still generates the same error message. The full error message, if it helps, is...

??? Error: Unexpected MATLAB operator.

Error in ==> dynare at 132
evalin('base',fname) ;

Also, I am using v4.1.1
Attachments
model.mod
(1.66 KiB) Downloaded 83 times
tom.pacey
 
Posts: 5
Joined: Mon Jul 20, 2009 3:08 pm

Re: Error Message

Postby jpfeifer » Tue Jul 06, 2010 6:10 pm

You have no variables a and g, so use:
Code: Select all
shocks;
var epsilon_a = .007;
var epsilon_g = .005;
end;


stoch_stimul should be stoch_simul.

The lambda in line 25
Code: Select all
sigma_tilde = gamma_c*(gamma_c*mu_p-(lambda*(1-alpha)))^(-1)*mu_p;

is not defined/should be lambda_p.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Error Message

Postby tom.pacey » Tue Jul 06, 2010 6:25 pm

Thank you J. I had assumed that once I got through the preprocessor, I would no longer have syntax errors, but that is clearly not the case. However, having fixed those two problems, I still receive the same error message. I am now going through the code completely once again to check for missing parentheses, etc. However, can anyone tell me what the error message

??? Error: Unexpected MATLAB operator.

Error in ==> dynare at 132
evalin('base',fname) ;

typically means?
tom.pacey
 
Posts: 5
Joined: Mon Jul 20, 2009 3:08 pm

Re: Error Message

Postby jpfeifer » Tue Jul 06, 2010 6:49 pm

I don't know what is happening here, but the code you posted did not go through the preprocessor on my machine. And I never got the error you mention.

Did you probably use any special characters or spaces when naming your mod-file? This might yield the error.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Error Message

Postby tom.pacey » Tue Jul 06, 2010 7:20 pm

Thank you for continuing to try to help. Just to clarify, I am using Dynare 4.1.1 in MatLab version 7.8.0 for students (R2009a). The full error message I receive is

EDU>> dynare y:\test.mod

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.1.1).
Starting preprocessing of the model file ...
Found 7 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

??? Error: Unexpected MATLAB operator.

Error in ==> dynare at 132
evalin('base',fname) ;

I rewrote the file from scratch just to check my work and have attached it. Thanks again!
Attachments
test.mod
(1.66 KiB) Downloaded 71 times
tom.pacey
 
Posts: 5
Joined: Mon Jul 20, 2009 3:08 pm

Re: Error Message

Postby jpfeifer » Wed Jul 07, 2010 5:42 am

I found your problem. Do not use
Code: Select all
dynare y:\test.mod

Rather set your working directory to y:\ and use
Code: Select all
dynare test.mod

The reason is that if you use the first command, Dynare tries to execute y:\test.m in line 132, but : and \ are reserved for math operations if not given to Matlab as a string path.

Note that there again is the problem that you have no variables a and g, so use:
Code: Select all
shocks;
var epsilon_a = .007;
var epsilon_g = .005;
end;
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Error Message

Postby tom.pacey » Wed Jul 07, 2010 11:58 am

Thanks very much! This has my program running though I now have issues with my initial values but I can work on that. Also, when I retyped the program I apparently mistyped the shocks section. Thanks for catching that, as well!
tom.pacey
 
Posts: 5
Joined: Mon Jul 20, 2009 3:08 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests