diff --git a/matlab/dynare_estimation_1.m b/matlab/dynare_estimation_1.m index 6eb4361f8..0a27271de 100644 --- a/matlab/dynare_estimation_1.m +++ b/matlab/dynare_estimation_1.m @@ -44,6 +44,11 @@ end %store qz_criterium qz_criterium_old=options_.qz_criterium; +if isnan(options_.first_obs) + first_obs_nan_indicator=true; +else + first_obs_nan_indicator=false; +end % Set particle filter flag. if options_.order > 1 @@ -775,3 +780,6 @@ if reset_options_related_to_estimation options_.mode_compute = mode_compute_o; options_.mh_replic = mh_replic_o; end +if first_obs_nan_indicator + options_.first_obs=NaN; +end \ No newline at end of file diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m index 7532f1432..b8e8b4ff6 100644 --- a/matlab/dynare_estimation_init.m +++ b/matlab/dynare_estimation_init.m @@ -527,13 +527,16 @@ if ~isempty(options_.datafile) end end +if isnan(options_.first_obs) + options_.first_obs=1; +end [dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag); %set options for old interface from the ones for new interface if ~isempty(dataset_) options_.nobs = dataset_.nobs; - options_.first_obs=double(dataset_.init); end + % setting steadystate_check_flag option if options_.diffuse_filter || options_.steadystate.nocheck steadystate_check_flag = 0; diff --git a/tests/Makefile.am b/tests/Makefile.am index 53bd9e9a3..3ff31697a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,6 +12,7 @@ MODFILES = \ observation_trends_and_prefiltering/MCMC/Trend_loglin_prefilt_first_obs_MC.mod \ observation_trends_and_prefiltering/MCMC/Trend_prefilter_MC.mod \ observation_trends_and_prefiltering/MCMC/Trend_prefilter_first_obs_MC.mod \ + dates/dseries_interact.mod \ estimation/slice/fs2000_slice.mod \ optimizers/fs2000_9.mod \ optimizers/fs2000_10.mod \ diff --git a/tests/dates/dseries_interact.mod b/tests/dates/dseries_interact.mod new file mode 100644 index 000000000..068d070b2 --- /dev/null +++ b/tests/dates/dseries_interact.mod @@ -0,0 +1,57 @@ +%% Mod-file tests interaction between estimation and shock_decomposition when dseries is used or not +var hh nn log_nn; +varexo eps_a; +parameters alfa nbar lambda betta rho_a std_a nn_init; + +nn_init = -0.1; +alfa = 0.05; +lambda = 0.054; +betta = 0.99; +nbar = 1; +rho_a = 0; +std_a = 1; + + +model(linear); + +hh = - alfa * nn + betta * ( hh(+1) + 0 * eps_a(+1) ) + eps_a; + +log_nn = log_nn(-1) + hh * lambda / (1-lambda); + +log_nn = ln(nbar) + nn; + +end; + +steady_state_model; +log_nn = log(nbar); +nn = 0; +hh = 0; +end; + +shocks; +var eps_a; stderr 1; +end; + +estimated_params; +alfa, beta_pdf, 0.1, 0.05; +std_a, inv_gamma_pdf, 0.05, 1; +end; + +varobs log_nn; + +if ~isoctave() && ~matlab_ver_less_than('8.4') + websave('data_uav.xlsx','http://www.dynare.org/Datasets/data_uav.xlsx', weboptions('Timeout', 30)) +else + urlwrite('http://www.dynare.org/Datasets/data_uav.xlsx','data_uav.xlsx') +end + +%reading Excel sheet from column A on creates quarterly dseries starting in +%1950 +estimation(first_obs=2,datafile=data_uav, xls_sheet=Tabelle1, xls_range=a1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ; +shock_decomposition( parameter_set=posterior_median ) nn hh; + +%reading Excel sheet from column B on creates annual dseries starting with 1 +estimation(first_obs=2,datafile=data_uav, xls_sheet=Tabelle1, xls_range=b1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ; +shock_decomposition( parameter_set=posterior_median ) nn hh; + +delete('data_uav.xlsx')