Error in rmse

HI
I try to compute the root mean square error (RMSE) with dynare_sensitivity for a DSGE model but I encounter this error:

Operands to the || and && operators must be convertible to logical scalar values.
Error in initialize_dataset (line 35)
if isempty(nobs) || rows(rawdata)<nobs+first-1 %case 2: dataset has changed
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_sensitivity (line 87)
[dataset_,xparam1,hh, M_, options_, oo_, estim_params_,bayestopt_]=dynare_estimation_init(M_.endo_names,fname_,1, M_,
options_, oo_, estim_params_, bayestopt_);
Error in dsge (line 376)
dynare_sensitivity(options_gsa);
Error in dynare (line 180)
evalin(‘base’,fname) ;

Thank you for your help!

dsge.rar (11.1 KB)

Please upgrade to Dynare 4.5. I am getting a different error message there. The problem is that your dataset has 96 observation, but you set first_obs=10 and nobs=[90:96], meaning that you want to select 90 periods after first_obs, which would imply you want to use observation 10 to 99.

Hi
Thank you very much for your reply.
I have 96 observation. My goal is that have an in-sample forecast for the last two data and for 2 horizons and then do RMSE.I upgrade my dynare and I write this nobs=[85:86]

**Estimation
(datafile=data_dsge,first_obs=10,prefilter=1,mh_nblocks=2,tex,mh_jscale=0.6,mh_replic=1500,mode_compute=6,lik_init=2,mh_drop=0.4,nodisplay,nograph,mode_check,nobs=[85:86],forecast=2)pi;

dynare_sensitivity (datafile=data_dsge,first_obs=10,pprior=0,ppost=1,prefilter=1,lik_only = 0,nobs=[85:86],rmse=1,var_rmse=(pi)) ;
**
But this error accrue:
Error using : (line 38)
dates::colon: In an expression like A:B, A and B must be dates objects!

Error in makedataset (line 252)
DynareDataset = DynareDataset(FIRSTOBS:lastobs);

Error in dynare_estimation_init (line 538)
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag);

Error in dynare_sensitivity (line 121)
[dataset_,dataset_info,xparam1,hh, M_, options_, oo_,
estim_params_,bayestopt_]=dynare_estimation_init(M_.endo_names,fname_,1, M_, options_, oo_, estim_params_,
bayestopt_);
Error in dsge (line 387)
dynare_sensitivity(options_gsa);
Error in dynare (line 228)
evalin(‘base’,fname) ;

What should i exactly write for dynare_sensitivity?
Thanks for your reply.

Please provide the updated file

hi
this is my update file

dsge.rar (16.7 KB)

thanks for your reply

In contrast to the estimation command, the command dynare_sensitivity does not take a vector-sized nobs. Please use a scalar here.

Hi
As you said, I write nobs=85 (use a scalar) in dynare_sensitivity, but my program is still not working and this error occurs. I am confused.

Error using load
Unable to read file ‘dsge/metropolis\dsge_data.mat’. No such file or directory.

Error in filt_mc_ (line 146)
load([DirectoryName filesep M_.fname ‘_data.mat’]);

Error in dynare_sensitivity (line 416( filt_mc_(OutputDirectoryName,options_gsa,dataset_,dataset_info);

Error in dsge (line 387)
dynare_sensitivity(options_gsa);

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

Thanks for your reply.

There is an incompatibility of

with estimation being run in recursive estimation. I will try to fix this soon. For now, try to run the code for each nobs separately.