Page 1 of 2

Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 6:53 am
by yy1985
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:

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 8:53 am
by jpfeifer
Could you please copy the mod-file to an completely empty folder and then try again.

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 9:09 am
by yy1985
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

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 9:17 am
by jpfeifer
Are you executing the mod-file in this folder? Does the folder after running the mod-file contain a datafile named datarabanal_hybrid.mat?

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 10:21 am
by yy1985
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

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 10:36 am
by jpfeifer
Please type
Code: Select all
which datarabanal_hybrid.m

in the Matlab command windows and post the answer here.

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 10:39 am
by yy1985
OK,the results is D:\DSGE\4.3.3\myyy\datarabanal_hybrid.m

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 10:40 am
by jpfeifer
That is the source of your problems. Delete that file.

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 10:41 am
by jpfeifer
And while you are at it, also delete the Matlab path to that directory.

Re: Undefined function or variable 'mc'

PostPosted: Fri Feb 14, 2014 10:55 am
by yy1985
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

Re: Undefined function or variable 'mc'

PostPosted: Mon Mar 09, 2015 6:57 pm
by Oriana
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.

Re: Undefined function or variable 'mc'

PostPosted: Tue Mar 10, 2015 11:00 am
by Oriana
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.

Re: Undefined function or variable 'mc'

PostPosted: Tue Mar 10, 2015 11:11 am
by jpfeifer
This sounds like a mistake in your steady state file. But you did not post it

Re: Undefined function or variable 'mc'

PostPosted: Tue Mar 10, 2015 1:04 pm
by Oriana
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.

Re: Undefined function or variable 'mc'

PostPosted: Tue Mar 10, 2015 1:24 pm
by jpfeifer
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.