Page 1 of 1

Syntax error, unexpected EQUAL matlab

PostPosted: Mon Dec 28, 2015 1:36 pm
by khdjabbas
I am running a Dynare model and I have a lot of equations. For one of the equations, I receive error as follows:

Starting Dynare (version 4.4.3).
Starting preprocessing of the model file ...
ERROR: code1a.mod: line 17, col 96: syntax error, unexpected EQUAL

Error using dynare (line 174)
DYNARE: preprocessing failed


I input all equations as given. How can I resolve this problem?

Re: Syntax error, unexpected EQUAL matlab

PostPosted: Mon Dec 28, 2015 5:55 pm
by jpfeifer
The error corresponds to:
Code: Select all
B*B_hat + tau_k*alpha*Y*(that_k+Y_hat)+(tau_l*(1-alpha)

The bracket in front of tau_l does never close.

Re: Syntax error, unexpected EQUAL matlab

PostPosted: Wed Dec 30, 2015 8:49 am
by khdjabbas
Thanks a lot for your help :) I have fixed the mistakes in my code. However I have a new error can I cannot understand. I have even used the unstable version of dynare but the problem still exists. It gives the following error:

Code: Select all
Reference to non-existent field 'G_hat'.
Error in read_variables (line 84)
            dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,[],xls.sheet,xls.range);
Error in dynare_estimation_init (line 475)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);
Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_,
bayestopt_);
Error in dynare_estimation (line 89)
    dynare_estimation_1(var_list,dname);
Error in code1a (line 430)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin('base',fname) ;


How can I resolve this issue? Kindly help me understand the error.
Thanks,
K

Re: Syntax error, unexpected EQUAL matlab

PostPosted: Wed Dec 30, 2015 10:47 am
by jpfeifer
The datafile is missing.

Re: Syntax error, unexpected EQUAL matlab

PostPosted: Wed Dec 30, 2015 1:25 pm
by khdjabbas
PFA the data file.

Re: Syntax error, unexpected EQUAL matlab

PostPosted: Thu Dec 31, 2015 9:48 am
by khdjabbas
Okay so now I understand the problem that my variable names must be same in .mod and data file. Although I still think that G_hat must be solved from the equation rather than the G constructed before. G_hat needs to be calculated from this equation:
Code: Select all
G_hat = - rho_g*Y_hat - gamma_g*B_hat(-1) + u_g;


Even if I renamed my data for government spending as G_hat; I am unable to understand why dynare is also asking for data on shocks. As per my understanding shouldn't dynare calculate the shocks itself by solving the model?
Now I am getting the following error:

Code: Select all
Reference to non-existent field 'uhat_b'.
Error in read_variables (line 84)
            dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,[],xls.sheet,xls.range);
Error in dynare_estimation_init (line 475)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);
Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_,
bayestopt_);
Error in dynare_estimation (line 89)
    dynare_estimation_1(var_list,dname);
Error in code1a (line 430)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin('base',fname) ;

Re: Syntax error, unexpected EQUAL matlab

PostPosted: Thu Dec 31, 2015 10:33 am
by jpfeifer
Whatever variable you specify in the varobs command needs to be in the data file. You seem to be struggling with specifying a correct observation equation. See Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" at https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.