diff --git a/doc/dynare.texi b/doc/dynare.texi index 0382dcf78..d7b88d109 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -1166,6 +1166,20 @@ are supposed to be decided one period ahead of all other endogenous variables. For stock variables, they are supposed to follow a ``stock at the beginning of the period'' convention. +Note that Dynare internally always uses the ``stock at the end of the period'' +concept, even when the model has been entered using the +@code{predetermined_variables}-command. Thus, when plotting, +computing or simulating variables, Dynare will follow the convention to +use variables that are decided in the current period. For example, +when generating impulse response functions for capital, Dynare +will plot @code{k}, which is the capital stock decided upon by +investment today (and which will be used in tomorrow's production function). +This is the reason that capital is shown to be moving on impact, because +it is @code{k} and not the predetermined @code{k(-1)} that is displayed. +It is important to remember that this also affects simulated time +series and output from smoother routines for predetermined variables. +Compared to non-predetermined variables they might otherwise appear +to be falsely shifted to the future by one period. @examplehead The following two program snippets are strictly equivalent. @@ -5580,6 +5594,48 @@ DSGE model, @code{simulation_type} has to be set equal to @code{deterministic}. @end table +@outputhead + +The results are not stored in the @code{oo_} structure but in a separate structure @code{forecasts} saved to the harddisk into a file called @code{conditional_forecasts.mat}. + +@defvr {MATLAB/Octave variable} forecasts.cond +Variable set by the @code{conditional_forecast} command. It stores the conditional forecasts. Fields are @code{periods+1} by 1 vectors storing the steady state (time 0) and the subsequent @code{periods} forecasts periods. Fields are of the form: +@example +@code{forecasts.cond.@var{FORECAST_MOMENT}.@var{VARIABLE_NAME}} +@end example +where @var{FORECAST_MOMENT} is one of the following: + +@table @code + +@item Mean +Mean of the conditional forecast distribution. + +@item ci +Confidence interval of the conditional forecast distribution. The size corresponds to @code{conf_sig}. +@end table + +@end defvr + +@defvr {MATLAB/Octave variable} forecasts.uncond +Variable set by the @code{conditional_forecast} command. It stores the unconditional forecasts. Fields are of the form: +@example +@code{forecasts.uncond.@var{FORECAST_MOMENT}.@var{VARIABLE_NAME}} +@end example +@end defvr + +@defvr {MATLAB/Octave variable} forecasts.instruments +Variable set by the @code{conditional_forecast} command. Stores the names of the exogenous instruments. +@end defvr + +@defvr {MATLAB/Octave variable} forecasts.controlled_variables +Variable set by the @code{conditional_forecast} command. Stores the position of the constrained endogenous variables in declaration order. +@end defvr + +@defvr {MATLAB/Octave variable} forecasts.graphs +Variable set by the @code{conditional_forecast} command. Stores the information for generating the conditional forecast plots. +@end defvr + + @examplehead @example @@ -6948,6 +7004,13 @@ The total number of draws is equal to @item adaptive_mh_draws = @var{INTEGER} Tuning period for Metropolis-Hasting draws. Default: @code{30,000} +@item save_draws +Save all elements of @math{A^0}, @math{A^+}, @math{\xi}, and the +transition matrix to a file named @code{draws_<>.out} with +each draw on a separate line. A file that describes how these matrices +are laid out is contained in +@code{draws_header_<>.out}. Default: @code{off} + @end table @end deffn diff --git a/matlab/imcforecast.m b/matlab/imcforecast.m index 6592c9cc0..de69d7bcd 100644 --- a/matlab/imcforecast.m +++ b/matlab/imcforecast.m @@ -205,7 +205,7 @@ tt = (1-options_cond_fcst.conf_sig)/2; t1 = round(options_cond_fcst.replic*tt); t2 = round(options_cond_fcst.replic*(1-tt)); -forecasts.controled_variables = constrained_vars; +forecasts.controlled_variables = constrained_vars; forecasts.instruments = options_cond_fcst.controlled_varexo; for i = 1:EndoSize diff --git a/matlab/ms-sbvar/clean_ms_simulation_files.m b/matlab/ms-sbvar/clean_ms_simulation_files.m index cccbf3e6d..b6a807859 100644 --- a/matlab/ms-sbvar/clean_ms_simulation_files.m +++ b/matlab/ms-sbvar/clean_ms_simulation_files.m @@ -30,4 +30,6 @@ function clean_ms_simulation_files(file_tag) delete_if_exists(['simulation_' file_tag '.out']); delete_if_exists(['simulation_info_' file_tag '.out']); +delete_if_exists(['draws_test_' file_tag '.out']); +delete_if_exists(['draws_header_' file_tag '.out']); end diff --git a/matlab/ms-sbvar/initialize_ms_sbvar_options.m b/matlab/ms-sbvar/initialize_ms_sbvar_options.m index 369cbfead..121813ae8 100644 --- a/matlab/ms-sbvar/initialize_ms_sbvar_options.m +++ b/matlab/ms-sbvar/initialize_ms_sbvar_options.m @@ -73,6 +73,7 @@ options_.ms.mh_replic = 10000; % default differs from Dan's code options_.ms.thinning_factor = 1; options_.ms.drop = 0.1*options_.ms.mh_replic*options_.ms.thinning_factor; options_.ms.adaptive_mh_draws = 30000; +options_.ms.save_draws = 0; % mdd options_.ms.proposal_draws = 100000; options_.ms.use_mean_center = 0; diff --git a/matlab/ms-sbvar/ms_simulation.m b/matlab/ms-sbvar/ms_simulation.m index a5ffe36cb..04a2e1eea 100644 --- a/matlab/ms-sbvar/ms_simulation.m +++ b/matlab/ms-sbvar/ms_simulation.m @@ -45,6 +45,10 @@ opt = [opt ' -burnin ' num2str(options_.ms.drop)]; opt = [opt ' -thin ' num2str(options_.ms.thinning_factor)]; opt = [opt ' -mh ' num2str(options_.ms.adaptive_mh_draws)]; +if options_.ms.save_draws + opt = [opt ' -flat ']; +end + % simulation [err] = ms_sbvar_command_line(opt); mexErrCheck('ms_simulation',err); diff --git a/matlab/reports/@elements/addTable.m b/matlab/reports/@elements/addTable.m index afcc8e052..72d7cc100 100644 --- a/matlab/reports/@elements/addTable.m +++ b/matlab/reports/@elements/addTable.m @@ -18,5 +18,5 @@ function e = addTable(e, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -e.objArray = e.objArray.addObj(table(varargin{:})); +e.objArray = e.objArray.addObj(report_table(varargin{:})); end \ No newline at end of file diff --git a/matlab/reports/@graph/graph.m b/matlab/reports/@graph/graph.m index 270d5efe1..c328f823d 100644 --- a/matlab/reports/@graph/graph.m +++ b/matlab/reports/@graph/graph.m @@ -128,7 +128,7 @@ assert(isempty(o.yrange) || (isfloat(o.yrange) && length(o.yrange) == 2 && ... assert(isempty(o.data) || isa(o.data, 'dseries'), ['@graph.graph: data must ' ... 'be a dseries']); assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@graph.graph: ' ... - 'series to use must be a cell array of string(s)']); + 'seriesToUse must be a cell array of string(s)']); assert(isempty(o.graphSize) || ((isfloat(o.graphSize) && length(o.graphSize) == 2)),... ['@graph.graph: graphSize is specified as an array with two float ' ... diff --git a/matlab/reports/@report/addSeries.m b/matlab/reports/@report/addSeries.m index 95f90e4d0..be5f6126e 100644 --- a/matlab/reports/@report/addSeries.m +++ b/matlab/reports/@report/addSeries.m @@ -30,8 +30,8 @@ function o = addSeries(o, varargin) % along with Dynare. If not, see . assert(isa(o.pages(end).sections(end).elements(end), 'graph') || ... - isa(o.pages(end).sections(end).elements(end), 'table'), ... - '@report.addSeries: you can only add a series to a table or graph object'); + isa(o.pages(end).sections(end).elements(end), 'report_table'), ... + '@report.addSeries: you can only add a series to a report_table or graph object'); o.pages(end).sections(end).elements(end) = ... o.pages(end).sections(end).elements(end).addSeries(varargin{:}); diff --git a/matlab/reports/@table/display.m b/matlab/reports/@report_series/display.m similarity index 91% rename from matlab/reports/@table/display.m rename to matlab/reports/@report_series/display.m index 658722079..1992b0994 100644 --- a/matlab/reports/@table/display.m +++ b/matlab/reports/@report_series/display.m @@ -1,9 +1,9 @@ function display(o) %function display(o) -% Display a Table object +% Display a Report_Series object % % INPUTS -% o [table] table object +% o [report_series] report_series object % % OUTPUTS % none diff --git a/matlab/reports/@series/getData.m b/matlab/reports/@report_series/getData.m similarity index 100% rename from matlab/reports/@series/getData.m rename to matlab/reports/@report_series/getData.m diff --git a/matlab/reports/@series/getLine.m b/matlab/reports/@report_series/getLine.m similarity index 69% rename from matlab/reports/@series/getLine.m rename to matlab/reports/@report_series/getLine.m index 3745389c6..134ae9286 100644 --- a/matlab/reports/@series/getLine.m +++ b/matlab/reports/@report_series/getLine.m @@ -1,10 +1,10 @@ function h = getLine(o, xrange) %function h = getLine(o, xrange) -% Create the series +% Create the report_series % % INPUTS -% o [series] series object -% xrange [dates] range of x values for line +% o [report_series] series object +% xrange [dates] range of x values for line % % OUTPUTS % h [handle] handle to line @@ -30,15 +30,15 @@ function h = getLine(o, xrange) % along with Dynare. If not, see . %% Validate options provided by user -assert(~isempty(o.data) && isa(o.data, 'dseries'), ['@series.getLine: must ' ... +assert(~isempty(o.data) && isa(o.data, 'dseries'), ['@report_series.getLine: must ' ... 'provide data as a dseries']); % Line -assert(ischar(o.graphLineColor), '@series.getLine: graphLineColor must be a string'); +assert(ischar(o.graphLineColor), '@report_series.getLine: graphLineColor must be a string'); valid_line_style = {'none', '-', '--', ':', '-.'}; assert(any(strcmp(o.graphLineStyle, valid_line_style)), ... - ['@series.getLine: graphLineStyle must be one of ' strjoin(valid_line_style, ' ')]); -assert(isfloat(o.graphLineWidth), ['@series.getLine: graphLineWidth must be a ' ... + ['@report_series.getLine: graphLineStyle must be one of ' strjoin(valid_line_style, ' ')]); +assert(isfloat(o.graphLineWidth), ['@report_series.getLine: graphLineWidth must be a ' ... 'positive number']); % GraphMarker @@ -46,22 +46,22 @@ valid_graphMarker = {'+', 'o', '*', '.', 'x', 's', 'square', 'd', 'diamond', ... '^', 'v', '>', '<', 'p', 'pentagram', 'h', 'hexagram', ... 'none'}; assert(isempty(o.graphMarker) || any(strcmp(o.graphMarker, valid_graphMarker)), ... - ['@series.getLine: graphMarker must be one of ' strjoin(valid_graphMarker)]); + ['@report_series.getLine: graphMarker must be one of ' strjoin(valid_graphMarker)]); -assert(ischar(o.graphMarkerEdgeColor), '@series.getLine: graphMarkerEdgeColor must be a string'); -assert(ischar(o.graphMarkerFaceColor), '@series.getLine: graphMarkerFaceColor must be a string'); -assert(isfloat(o.graphMarkerSize), ['@series.getLine: graphMarkerSize must be a ' ... +assert(ischar(o.graphMarkerEdgeColor), '@report_series.getLine: graphMarkerEdgeColor must be a string'); +assert(ischar(o.graphMarkerFaceColor), '@report_series.getLine: graphMarkerFaceColor must be a string'); +assert(isfloat(o.graphMarkerSize), ['@report_series.getLine: graphMarkerSize must be a ' ... 'positive number']); % Marker & Line -assert(~(strcmp(o.graphLineStyle, 'none') && isempty(o.graphMarker)), ['@series.getLine: ' ... +assert(~(strcmp(o.graphLineStyle, 'none') && isempty(o.graphMarker)), ['@report_series.getLine: ' ... 'you must provide at least one of graphLineStyle and graphMarker']); % Validate xrange assert(isempty(xrange) || isa(xrange, 'dates')); % Zero tolerance -assert(isfloat(o.zerotol), '@series.write: zerotol must be a float'); +assert(isfloat(o.zerotol), '@report_series.write: zerotol must be a float'); %% if isempty(xrange) || xrange == o.data.time @@ -70,7 +70,7 @@ else ds = o.data(xrange); end -% if graphing data that is within zerotol, set to zero, create series and +% if graphing data that is within zerotol, set to zero, create report_series and % get line: thedata = ds.data; stz = bsxfun(@and, ... diff --git a/matlab/reports/@series/getName.m b/matlab/reports/@report_series/getName.m similarity index 100% rename from matlab/reports/@series/getName.m rename to matlab/reports/@report_series/getName.m diff --git a/matlab/reports/@series/getRange.m b/matlab/reports/@report_series/getRange.m similarity index 100% rename from matlab/reports/@series/getRange.m rename to matlab/reports/@report_series/getRange.m diff --git a/matlab/reports/@series/getTexName.m b/matlab/reports/@report_series/getTexName.m similarity index 100% rename from matlab/reports/@series/getTexName.m rename to matlab/reports/@report_series/getTexName.m diff --git a/matlab/reports/@series/series.m b/matlab/reports/@report_series/report_series.m similarity index 71% rename from matlab/reports/@series/series.m rename to matlab/reports/@report_series/report_series.m index ce30bf417..e630bb9f6 100644 --- a/matlab/reports/@series/series.m +++ b/matlab/reports/@report_series/report_series.m @@ -1,15 +1,15 @@ -function o = series(varargin) -%function o = series(varargin) -% Series Class Constructor +function o = report_series(varargin) +%function o = report_series(varargin) +% Report_Series Class Constructor % % INPUTS -% varargin 0 args : empty series object -% 1 arg : must be series object (return a copy of arg) +% varargin 0 args : empty report_series object +% 1 arg : must be report_series object (return a copy of arg) % > 1 args: option/value pairs (see structure below for % options) % % OUTPUTS -% o [series] series object +% o [report_series] report_series object % % SPECIAL REQUIREMENTS % none @@ -57,13 +57,13 @@ o.tableRowColor = 'white'; o.zerotol = 1e-6; if nargin == 1 - assert(isa(varargin{1}, 'series'),['@series.series: with one arg you ' ... - 'must pass a series object']); + assert(isa(varargin{1}, 'report_series'),['@report_series.report_series: with one arg you ' ... + 'must pass a report_series object']); o = varargin{1}; return; elseif nargin > 1 if round(nargin/2) ~= nargin/2 - error(['@series.series: options must be supplied in name/value ' ... + error(['@report_series.report_series: options must be supplied in name/value ' ... 'pairs.']); end @@ -76,11 +76,11 @@ elseif nargin > 1 if ~isempty(ind) o.(optNames{ind}) = pair{2}; else - error('@series.series: %s is not a recognized option.', pair{1}); + error('@report_series.report_series: %s is not a recognized option.', pair{1}); end end end -% Create series object -o = class(o, 'series'); +% Create report_series object +o = class(o, 'report_series'); end \ No newline at end of file diff --git a/matlab/reports/@series/subsasgn.m b/matlab/reports/@report_series/subsasgn.m similarity index 88% rename from matlab/reports/@series/subsasgn.m rename to matlab/reports/@report_series/subsasgn.m index cb14b1e4e..fdf0f7db5 100644 --- a/matlab/reports/@series/subsasgn.m +++ b/matlab/reports/@report_series/subsasgn.m @@ -34,9 +34,9 @@ switch S.type case fieldnames(A) B.(S.subs) = V; otherwise - error(['@series.subsasgn: field ' S.subs 'does not exist']); + error(['@report_series.subsasgn: field ' S.subs 'does not exist']); end otherwise - error('@series.subsasgn: syntax error'); + error('@report_series.subsasgn: syntax error'); end end \ No newline at end of file diff --git a/matlab/reports/@series/subsref.m b/matlab/reports/@report_series/subsref.m similarity index 84% rename from matlab/reports/@series/subsref.m rename to matlab/reports/@report_series/subsref.m index 5fb142fcf..4042a540c 100644 --- a/matlab/reports/@series/subsref.m +++ b/matlab/reports/@report_series/subsref.m @@ -31,12 +31,12 @@ switch S(1).type A = feval(S(1).subs, A); end otherwise - error(['@series.subsref: unknown field or method: ' S(1).subs]); + error(['@report_series.subsref: unknown field or method: ' S(1).subs]); end case {'()', '{}'} - error(['@series.subsref: ' S(1).type ' indexing not supported.']); + error(['@report_series.subsref: ' S(1).type ' indexing not supported.']); otherwise - error('@series.subsref: impossible case') + error('@report_series.subsref: impossible case') end S = shiftS(S); diff --git a/matlab/reports/@series/write.m b/matlab/reports/@report_series/write.m similarity index 72% rename from matlab/reports/@series/write.m rename to matlab/reports/@report_series/write.m index 76ade7e56..f175ecd74 100644 --- a/matlab/reports/@series/write.m +++ b/matlab/reports/@report_series/write.m @@ -3,15 +3,15 @@ function o = write(o, fid, dates, precision, yrsForAvgs) % Write Table Row % % INPUTS -% o [series] series object -% fid [int] file id -% dates [dates] dates for series slice -% precision [float] precision with which to print the data -% yrsForAvgs [bool] the years for which to compute averages +% o [report_series] report_series object +% fid [int] file id +% dates [dates] dates for report_series slice +% precision [float] precision with which to print the data +% yrsForAvgs [bool] the years for which to compute averages % % % OUTPUTS -% o [series] series object +% o [report_series] report_series object % % SPECIAL REQUIREMENTS % none @@ -39,24 +39,24 @@ assert(isa(dates, 'dates')); assert(isint(precision)); %% Validate options provided by user -assert(ischar(o.tableSubSectionHeader), '@series.write: tableSubSectionHeader must be a string'); +assert(ischar(o.tableSubSectionHeader), '@report_series.write: tableSubSectionHeader must be a string'); if isempty(o.tableSubSectionHeader) assert(~isempty(o.data) && isa(o.data, 'dseries'), ... - '@series.write: must provide data as a dseries'); + '@report_series.write: must provide data as a dseries'); end -assert(ischar(o.tableNegColor), '@series.write: tableNegColor must be a string'); -assert(ischar(o.tablePosColor), '@series.write: tablePosColor must be a string'); -assert(ischar(o.tableRowColor), '@series.write: tableRowColor must be a string'); -assert(islogical(o.tableShowMarkers), '@series.write: tableShowMarkers must be true or false'); -assert(islogical(o.tableAlignRight), '@series.write: tableAlignRight must be true or false'); -assert(isfloat(o.tableMarkerLimit), '@series,write: tableMarkerLimit must be a float'); +assert(ischar(o.tableNegColor), '@report_series.write: tableNegColor must be a string'); +assert(ischar(o.tablePosColor), '@report_series.write: tablePosColor must be a string'); +assert(ischar(o.tableRowColor), '@report_series.write: tableRowColor must be a string'); +assert(islogical(o.tableShowMarkers), '@report_series.write: tableShowMarkers must be true or false'); +assert(islogical(o.tableAlignRight), '@report_series.write: tableAlignRight must be true or false'); +assert(isfloat(o.tableMarkerLimit), '@report_series,write: tableMarkerLimit must be a float'); %% Write Output dataString = ['%.' num2str(precision) 'f']; precision = 10^precision; -fprintf(fid, '%% Table Row (series)\n'); +fprintf(fid, '%% Table Row (report_series)\n'); if ~isempty(o.tableRowColor) fprintf(fid, '\\rowcolor{%s}', o.tableRowColor); end diff --git a/matlab/reports/@table/addSeries.m b/matlab/reports/@report_table/addSeries.m similarity index 100% rename from matlab/reports/@table/addSeries.m rename to matlab/reports/@report_table/addSeries.m diff --git a/matlab/reports/@series/display.m b/matlab/reports/@report_table/display.m similarity index 91% rename from matlab/reports/@series/display.m rename to matlab/reports/@report_table/display.m index 5ad241bee..14123e503 100644 --- a/matlab/reports/@series/display.m +++ b/matlab/reports/@report_table/display.m @@ -1,9 +1,9 @@ function display(o) %function display(o) -% Display a Series object +% Display a Report_Table object % % INPUTS -% o [series] series object +% o [report_table] report_table object % % OUTPUTS % none diff --git a/matlab/reports/@table/table.m b/matlab/reports/@report_table/report_table.m similarity index 63% rename from matlab/reports/@table/table.m rename to matlab/reports/@report_table/report_table.m index 9ec32f5b9..5f29225f7 100644 --- a/matlab/reports/@table/table.m +++ b/matlab/reports/@report_table/report_table.m @@ -1,10 +1,10 @@ -function o = table(varargin) -%function o = table(varargin) -% Table Class Constructor +function o = report_table(varargin) +%function o = report_table(varargin) +% Report_Table Class Constructor % % INPUTS -% 0 args => empty table -% 1 arg (table class) => copy object +% 0 args => empty report_table +% 1 arg (report_table class) => copy object % % OUTPUTS % none @@ -49,13 +49,13 @@ o.range = {}; o.precision = 1; if nargin == 1 - assert(isa(varargin{1}, 'table'),['With one arg to Table constructor, ' ... - 'you must pass a table object']); + assert(isa(varargin{1}, 'report_table'),['With one arg to Report_Table constructor, ' ... + 'you must pass a report_table object']); o = varargin{1}; return; elseif nargin > 1 if round(nargin/2) ~= nargin/2 - error(['Options to Table constructor must be supplied in name/value ' ... + error(['Options to Report_Table constructor must be supplied in name/value ' ... 'pairs.']); end @@ -68,35 +68,35 @@ elseif nargin > 1 if ~isempty(ind) o.(optNames{ind}) = pair{2}; else - error('%s is not a recognized option to the Table constructor.', pair{1}); + error('%s is not a recognized option to the Report_Table constructor.', pair{1}); end end end % Check options provided by user -assert(ischar(o.title), '@table.table: title must be a string'); -assert(islogical(o.annualAverages), '@table.table: annualAverages must be true or false'); -assert(islogical(o.showHlines), '@table.table: showHlines must be true or false'); -assert(islogical(o.showVlines), '@table.table: showVlines must be true or false'); -assert(isint(o.precision), '@table.table: precision must be an int'); +assert(ischar(o.title), '@report_table.report_table: title must be a string'); +assert(islogical(o.annualAverages), '@report_table.report_table: annualAverages must be true or false'); +assert(islogical(o.showHlines), '@report_table.report_table: showHlines must be true or false'); +assert(islogical(o.showVlines), '@report_table.report_table: showVlines must be true or false'); +assert(isint(o.precision), '@report_table.report_table: precision must be an int'); assert(isempty(o.range) || (isa(o.range, 'dates') && o.range.ndat >= 2), ... - ['@table.table: range is specified as a dates range, e.g. ' ... + ['@report_table.report_table: range is specified as a dates range, e.g. ' ... '''dates(''1999q1''):dates(''1999q3'')''.']); assert(isempty(o.data) || isa(o.data, 'dseries'), ... - '@table.table: data must be a dseries'); + '@report_table.report_table: data must be a dseries'); assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ... - '@table.table: seriesToUse must be a cell array of string(s)'); + '@report_table.report_table: seriesToUse must be a cell array of string(s)'); assert(isempty(o.vlineAfter) || isa(o.vlineAfter, 'dynDate'), ... - '@table.table: vlineAfter must be a dynDate'); + '@report_table.report_table: vlineAfter must be a dynDate'); if o.showVlines o.vlineAfter = ''; end assert(islogical(o.vlineAfterEndOfPeriod), ... - '@table.table: vlineAfterEndOfPeriod must be true or false'); + '@report_table.report_table: vlineAfterEndOfPeriod must be true or false'); valid_title_sizes = {'Huge', 'huge', 'LARGE', 'Large', 'large', 'normalsize', ... 'small', 'footnotesize', 'scriptsize', 'tiny'}; assert(any(strcmp(o.titleSize, valid_title_sizes)), ... - ['@table.table: titleSize must be one of ' strjoin(valid_title_sizes, ' ')]); + ['@report_table.report_table: titleSize must be one of ' strjoin(valid_title_sizes, ' ')]); % using o.seriesToUse, create series objects and put them in o.seriesElements if ~isempty(o.data) @@ -113,6 +113,6 @@ end o = rmfield(o, 'seriesToUse'); o = rmfield(o, 'data'); -% Create table object -o = class(o, 'table'); +% Create report_table object +o = class(o, 'report_table'); end \ No newline at end of file diff --git a/matlab/reports/@table/subsasgn.m b/matlab/reports/@report_table/subsasgn.m similarity index 87% rename from matlab/reports/@table/subsasgn.m rename to matlab/reports/@report_table/subsasgn.m index 1b903e6cc..2e2dc300d 100644 --- a/matlab/reports/@table/subsasgn.m +++ b/matlab/reports/@report_table/subsasgn.m @@ -34,9 +34,9 @@ switch S.type case fieldnames(A) B.(S.subs) = V; otherwise - error(['@table.subsasgn: field ' S.subs 'does not exist in the table class']) + error(['@report_table.subsasgn: field ' S.subs 'does not exist in the report_table class']) end otherwise - error('@table.subsasgn: syntax error') + error('@report_table.subsasgn: syntax error') end end \ No newline at end of file diff --git a/matlab/reports/@table/subsref.m b/matlab/reports/@report_table/subsref.m similarity index 84% rename from matlab/reports/@table/subsref.m rename to matlab/reports/@report_table/subsref.m index 7062d72ff..10636005e 100644 --- a/matlab/reports/@table/subsref.m +++ b/matlab/reports/@report_table/subsref.m @@ -31,12 +31,12 @@ switch S(1).type A = feval(S(1).subs, A); end otherwise - error(['@table.subsref: unknown field or method: ' S(1).subs]); + error(['@report_table.subsref: unknown field or method: ' S(1).subs]); end case {'()', '{}'} - error(['@table.subsref: ' S(1).type ' indexing not supported.']); + error(['@report_table.subsref: ' S(1).type ' indexing not supported.']); otherwise - error('@table.subsref: subsref.m impossible case') + error('@report_table.subsref: subsref.m impossible case') end S = shiftS(S); diff --git a/matlab/reports/@table/write.m b/matlab/reports/@report_table/write.m similarity index 87% rename from matlab/reports/@table/write.m rename to matlab/reports/@report_table/write.m index 85bc34cfd..32d1a8c1e 100644 --- a/matlab/reports/@table/write.m +++ b/matlab/reports/@report_table/write.m @@ -1,13 +1,13 @@ function o = write(o, fid) %function o = write(o, fid) -% Write a Table object +% Write a Report_Table object % % INPUTS -% o [table] table object +% o [report_table] report_table object % fid [integer] file id % % OUTPUTS -% o [table] table object +% o [report_table] report_table object % % SPECIAL REQUIREMENTS % none @@ -31,7 +31,7 @@ function o = write(o, fid) assert(fid ~= -1); if ~o.seriesElements.numSeriesElements() - warning('@table.write: no series to plot, returning'); + warning('@report_table.write: no series to plot, returning'); return; end @@ -49,7 +49,7 @@ else end ndates = dates.ndat; -fprintf(fid, '%% Table Object\n'); +fprintf(fid, '%% Report_Table Object\n'); fprintf(fid, '\\setlength{\\tabcolsep}{4pt}\n'); fprintf(fid, '\\begin{tabular}{@{}l'); @@ -105,7 +105,7 @@ switch dates.freq for i=2:size(thdr, 1) split = find(thdr{i-1, 2} == 4, 1, 'first'); if isempty(split) - error('@table.write: Shouldn''t arrive here'); + error('@report_table.write: Shouldn''t arrive here'); else thdr{i, 2} = thdr{i-1, 2}(split+1:end); thdr{i-1, 2} = thdr{i-1, 2}(1:split); @@ -127,9 +127,9 @@ switch dates.freq end end case 12 - error('@table.write: weekly dates not yet implemented'); + error('@report_table.write: weekly dates not yet implemented'); otherwise - error('@table.write: invalid dseries frequency'); + error('@report_table.write: invalid dseries frequency'); end for i=1:length(yrsForAvgs) fprintf(fid, ' & %d', years(i)); @@ -138,7 +138,7 @@ fprintf(fid, '\\\\[-2pt]%%\n'); fprintf(fid, '\\hline%%\n'); fprintf(fid, '%%\n'); -% Write Table Data +% Write Report_Table Data ne = o.seriesElements.numSeriesElements(); for i=1:ne o.seriesElements(i).write(fid, dates, o.precision, yrsForAvgs); @@ -149,5 +149,5 @@ end fprintf(fid, '\\bottomrule\n'); fprintf(fid, '\\end{tabular} \\par \\medskip\n\n'); -fprintf(fid, '%% End Table Object\n'); +fprintf(fid, '%% End Report_Table Object\n'); end diff --git a/matlab/reports/@section/addTable.m b/matlab/reports/@section/addTable.m index 1668793cc..831ff7003 100644 --- a/matlab/reports/@section/addTable.m +++ b/matlab/reports/@section/addTable.m @@ -1,11 +1,11 @@ function o = addTable(o, varargin) %function o = addTable(o, varargin) -% Add a table to the Cell Array of tables in the report +% Add a report_table to the Cell Array of report_tables in the report % % INPUTS -% 1 args => add empty table -% 2 args => add given table -% 3 args => add table at index +% 1 args => add empty report_table +% 2 args => add given report_table +% 3 args => add report_table at index % % OUTPUTS % updated section object diff --git a/matlab/reports/@seriesElements/addSeries.m b/matlab/reports/@seriesElements/addSeries.m index 3c683576c..37b95d47f 100644 --- a/matlab/reports/@seriesElements/addSeries.m +++ b/matlab/reports/@seriesElements/addSeries.m @@ -18,5 +18,5 @@ function o = addSeries(o, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -o.objArray = o.objArray.addObj(series(varargin{:})); +o.objArray = o.objArray.addObj(report_series(varargin{:})); end \ No newline at end of file diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index a53fa0d3b..81e3f29d2 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -116,7 +116,7 @@ class ParsingDriver; %token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL %token NAME %token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS -%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF +%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS %token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED %token PARALLEL_LOCAL_FILES PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERFECT_FORESIGHT PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE %token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN PRUNING @@ -1987,6 +1987,7 @@ ms_simulation_option : o_output_file_tag | o_ms_drop | o_thinning_factor | o_adaptive_mh_draws + | o_save_draws ; ms_simulation_options_list : ms_simulation_option COMMA ms_simulation_options_list @@ -2648,6 +2649,7 @@ o_random_parameter_convergence_criterion : RANDOM_PARAMETER_CONVERGENCE_CRITERIO { driver.option_num("ms.random_parameter_convergence_criterion",$3); }; o_thinning_factor : THINNING_FACTOR EQUAL INT_NUMBER { driver.option_num("ms.thinning_factor",$3); }; o_adaptive_mh_draws : ADAPTIVE_MH_DRAWS EQUAL INT_NUMBER { driver.option_num("ms.adaptive_mh_draws",$3); }; +o_save_draws : SAVE_DRAWS { driver.option_num("ms.save_draws","1"); }; o_proposal_draws : PROPOSAL_DRAWS EQUAL INT_NUMBER { driver.option_num("ms.proposal_draws",$3); }; o_use_mean_center : USE_MEAN_CENTER { driver.option_num("ms.use_mean_center","1"); }; o_proposal_type : PROPOSAL_TYPE EQUAL INT_NUMBER { driver.option_num("ms.proposal_type",$3); } diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index a5a3f6d73..f7ea3a9a9 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -473,6 +473,7 @@ string eofbuff; filter_decomposition {return token::FILTER_DECOMPOSITION; } selected_variables_only {return token::SELECTED_VARIABLES_ONLY; } pruning {return token::PRUNING; } +save_draws {return token::SAVE_DRAWS; } deflator {return token::DEFLATOR;} log_deflator {return token::LOG_DEFLATOR;} growth_factor {return token::GROWTH_FACTOR;}