From 5b08223820afb4d831bee72ae0c7036fddcc75af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Scylla=29?= <stephane.adjemian@univ-lemans.fr> Date: Wed, 16 Jul 2014 17:02:58 +0200 Subject: [PATCH] Changed default value of initial_period (NaN). --- matlab/global_initialization.m | 2 +- matlab/perfect_foresight_solver.m | 8 +++++++- matlab/utilities/dataset/makedataset.m | 5 ++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 32e1fae5d..53a2d5362 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -349,7 +349,7 @@ estimation_info.measurement_error_corr.range_index = {}; estimation_info.structural_innovation_corr_prior_index = {}; estimation_info.structural_innovation_corr_options_index = {}; estimation_info.structural_innovation_corr.range_index = {}; -options_.initial_period = dates(1,1); +options_.initial_period = NaN; %dates(1,1); options_.dataset.file = []; options_.dataset.series = []; options_.dataset.firstobs = dates(); diff --git a/matlab/perfect_foresight_solver.m b/matlab/perfect_foresight_solver.m index 819b3b667..ec88ab319 100644 --- a/matlab/perfect_foresight_solver.m +++ b/matlab/perfect_foresight_solver.m @@ -146,7 +146,13 @@ end dyn2vec; -ts = dseries(transpose(oo_.endo_simul),options_.initial_period,cellstr(M_.endo_names)); +if isnan(options_.initial_period) + initial_period = dates(1,1); +else + initial_period = options_.initial_period; +end + +ts = dseries(transpose(oo_.endo_simul),initial_period,cellstr(M_.endo_names)); assignin('base', 'Simulated_time_series', ts); end diff --git a/matlab/utilities/dataset/makedataset.m b/matlab/utilities/dataset/makedataset.m index 2b4653008..72b04f7cf 100644 --- a/matlab/utilities/dataset/makedataset.m +++ b/matlab/utilities/dataset/makedataset.m @@ -114,7 +114,7 @@ else end % Test if an initial period (different from its default value) is explicitely defined in the mod file with the set_time command. -if isequal(DynareOptions.initial_period, dates(1,1)) +if ~isdates(DynareOptions.initial_period) && isnan(DynareOptions.initial_period) set_time_default_initial_period = 1; else set_time_default_initial_period = 0; @@ -134,8 +134,7 @@ end if ~set_time_default_initial_period && ~dataset_default_initial_period % Check if dataset.init and options_.initial_period are identical. - if DynareOptions.initial_period>DynareDataset.init - %if ~isequal(DynareOptions.initial_period, DynareDataset.init) + if DynareOptions.initial_period<DynareDataset.init error('The date as defined by the set_time command is not consistent with the initial period in the database!') end end -- GitLab