Undefined function or variable 'mc'

Dear Everyone:
When I run the [dsgevar_forward_calibrate_lambda.mod ] file in dynare again,
there is a trouble that I don’t know how to solve it. it is coming up with the following
message:

??? Error using ==> eval
Undefined function or variable ‘mc’.

Error in ==> read_variables at 72
dyn_tmp_01 = eval(var_names_01(dyn_i_01,:));

Error in ==> initialize_dataset at 32
rawdata = read_variables(datafile,varobs,],xls.sheet,xls.range);

Error in ==> dynare_estimation_init at 347
dataset_=initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);

Error in ==> dynare_estimation_1 at 59
[dataset_,xparam1,M_,options_,oo_,estim_params_,bayestopt_]=dynare_estimation_init(var_list_, dname, ], M_, options_, oo_, estim_params_, bayestopt_);

Error in ==> dynare_estimation at 70
dynare_estimation_1(var_list,dname);

Error in ==> dsgevar_forward_calibrate_lambda at 259
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin(‘base’,fname) ;

I am very confused,so I really hope someone can help me to explain what’s gone
wrong?
Thanks
Yun

the dsgevar_forward_calibrate_lambda.mod file attachment as follows:
dsgevar_forward_calibrate_lambda.mod (3.04 KB)

Could you please copy the mod-file to an completely empty folder and then try again.

Dear professor jpfeifer:
When I copy the mod-file to an completely empty folder and then try again,but the results as the same as before:

??? Error using ==> eval
Undefined function or variable ‘mc’.

Error in ==> read_variables at 72
dyn_tmp_01 = eval(var_names_01(dyn_i_01,:));

Error in ==> initialize_dataset at 32
rawdata = read_variables(datafile,varobs,],xls.sheet,xls.range);

Error in ==> dynare_estimation_init at 347
dataset_=initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);

Error in ==> dynare_estimation_1 at 59
[dataset_,xparam1,M_,options_,oo_,estim_params_,bayestopt_]=dynare_estimation_init(var_list_, dname, ], M_, options_, oo_, estim_params_, bayestopt_);

Error in ==> dynare_estimation at 70
dynare_estimation_1(var_list,dname);

Error in ==> dsgevar_forward_calibrate_lambda at 259
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin(‘base’,fname) ;

I want to know why?
Thanks
Yun

Are you executing the mod-file in this folder? Does the folder after running the mod-file contain a datafile named datarabanal_hybrid.mat?

Dear professor jpfeifer:
Yes, after running the mod-file contain a datafile named datarabanal_hybrid.mat. I cann’t understand why Undefined function or variable ‘mc’?
in fact,datarabanal_hybrid.mat has contain variable ‘mc’.
Thank you very much for you reply! I am very confused!
yun

Please type

in the Matlab command windows and post the answer here.

OK,the results is D:\DSGE\4.3.3\myyy\datarabanal_hybrid.m

That is the source of your problems. Delete that file.

And while you are at it, also delete the Matlab path to that directory.

Dear professor jpfeifer:
You are very enthusiastic, thank you very much! Under the guidance of your wise, this problem solved!Thank you very much !
yun

Hi,
I am trying to convert a estimated US model ( please see nonlinearomega.mod file ) into a multi-country model ( with three countries, please see nonlinearomegamulti.mod file ).
The estimated US model already runs. Nevertheless, I got the following errors with the multi-country version:

Error using eval
Undefined function or variable ‘c3sigma’.

Error in nonlinearomega_steadystate (line 44)
eval(‘M_.params(icount) = ‘,M_.param_names(icount,:),’;’])

Error in evaluate_steady_state_file (line 49)
[ys,check] = h_steadystate(ys_init, exo_ss);

Error in evaluate_steady_state (line 58)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, …

Error in steady_ (line 54)
[steady_state,params,info] = evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in nonlinearomega (line 3094)
steady;

Error in dynare (line 180)
evalin(‘base’,fname) ;

It seems weird as ‘c3sigma’ is already defined. I would really appreciate if someone could help on this matter.
nonlinearomega.mod (61 KB)
nonlinearomegamulti.mod (86.3 KB)

Hi,
I am trying to convert a estimated US model ( please see nonlinearomega-2.zip file ) into a multi-country model ( with three countries, please see nonlinearomega-multi copy.zip file ).
The estimated US model already runs. Nevertheless, I got the following errors with the multi-country version:

Error using eval
Undefined function or variable ‘c3sigma’.

Error in nonlinearomega_steadystate (line 44)
eval(‘M_.params(icount) = ‘,M_.param_names(icount,:),’;’])

Error in evaluate_steady_state_file (line 49)
[ys,check] = h_steadystate(ys_init, exo_ss);

Error in evaluate_steady_state (line 58)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, …

Error in steady_ (line 54)
[steady_state,params,info] = evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in nonlinearomega (line 3094)
steady;

Error in dynare (line 180)
evalin(‘base’,fname) ;

It seems weird as ‘c3sigma’ is already defined. I would really appreciate if someone could help on this matter.
nonlinearomega-2.zip (602 KB)
nonlinearomega-multi copy.zip (807 KB)

This sounds like a mistake in your steady state file. But you did not post it

The steady state file of the multi-country model is very similar to the estimated US model. In the former file I only added the steady state variables of the third country.

If possible, please, see the nonlinearomega_steadystate.m file in the folders attached below.
nonlinearomega-2.zip (602 KB)
nonlinearomega-multi copy.zip (807 KB)

Your steady state file does not correctly read in the parameters of the model. You should be using the header/footer of the NK_baseline_steady_state.m file in the Dynare examples folder.

I already followed your advice. The problem is if I use the header/footer of the NK_baseline_steady_state.m file in the Dynare examples folder I get the following error:

Undefined function or variable ‘c1welfss’.

Error in nonlinearomega_steadystate (line 26)
c1welf = c1welfss;

Error in evaluate_steady_state_file (line 49)
[ys,check] = h_steadystate(ys_init, exo_ss);

Error in evaluate_steady_state (line 58)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, …

Error in steady_ (line 54)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in nonlinearomega (line 3094)
steady;

Error in dynare (line 180)
evalin(‘base’,fname) ;

And, unfortunately, I have no idea about what should be done.
nonlinearomega_steadystate.m (13.5 KB)

That is because you never defined a c1welfss in your mod-file