Dear Johannes,

That works. Thank you so much!

By the way, as I run the attached file to search for the posterior mode, I got the following error message if I use Dynare 4.4.3

Cell contents reference from a non-cell array object.

Error in dynare_estimation_init (line 64)

id = strmatch(options_.varobs{i}, M_.endo_names, ‘exact’);

Error in dynare_estimation_1 (line 81)

[dataset_,dataset_info, xparam1, hh, M_, options_, oo_, estim_params_,

bayestopt_] = …

Error in dynare_estimation (line 89)

dynare_estimation_1(var_list,dname);

Error in test2 (line 520)

dynare_estimation(var_list_);

Error in dynare (line 180)

evalin(‘base’,fname) ;

If I change to the latest version of the unstable version 2016-04-04, I got the following error message

Error using check_matlab_path (line 99)

You put all the dynare/matlab subfolders in matlab’s path! Only the

dynare/matlab folder (without subfolders)

should be in the path, Dynare will automatically add any required subfolders in

the path.

Error in dynare (line 60)

check_matlab_path(change_path_flag);

I get the code run successfully when I use a very old version of Dynare, which I downloaded a few years ago, version 2014-12-25.

Could you please help me check what the problem is?

Thank you!

mydata.xls (65.5 KB)

test2.mod (15 KB)