Error in read variables for estimation

Hi everyone,

I’m getting an error that I haven’t been able to solve and I’m desperate now.

I’m running dynare on a mac (just in case this matters). When the code gets to the estimation command, I pass on the datafile which
is an m file and it has all the observables. Then dynare says that there is an error in read_variables and it says “Reference to a cleared variable var_names_01”.

I think var_names_01 is the same options_.varobs, is this true? does anyone have any idea what this error mean? let me know if more specific information is needed.

Its not my first time estimating in dynare, I have another model and it worked just fine.

I would really appreciate any help.


Hi Paulina, Can you post a mod file and a data file replicating your problem ? Yes, var_names_01 is an array of strings containing the names of the observed endogenous variables.

Best, Stéphane.

Hi Stephane,

Thank you so much for your response. Here are the files.


irbcdata.m (2.65 KB)
IRBC.mod (14.3 KB)

Hi Paulina,

The problem is in the matlab script irbcdata.m, where you load the data. In this file you clear all the variables in the matlab’s workspace. If you remove the first line, it should be ok.


Hi Stephane!! You are totally right… I didn’t realize that that matlab command would clear the variables created by dynare.

Thank you so much it could have taken me ages to realize that.

Thanks again!