Merge branch 'master' into remove-dynDate-class

Conflicts:
	matlab/reports/@report_series/getLine.m
	matlab/reports/@report_series/write.m
	matlab/reports/@report_table/report_table.m
	matlab/reports/@report_table/write.m
time-shift
Stéphane Adjemian (Charybdis) 2013-10-28 15:04:21 +01:00
commit 9df1b8548e
28 changed files with 171 additions and 98 deletions

View File

@ -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 variables. For stock variables, they are supposed to follow a ``stock at
the beginning of the period'' convention. 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 @examplehead
The following two program snippets are strictly equivalent. 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 @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 @examplehead
@example @example
@ -6948,6 +7004,13 @@ The total number of draws is equal to
@item adaptive_mh_draws = @var{INTEGER} @item adaptive_mh_draws = @var{INTEGER}
Tuning period for Metropolis-Hasting draws. Default: @code{30,000} 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_<<file_tag>>.out} with
each draw on a separate line. A file that describes how these matrices
are laid out is contained in
@code{draws_header_<<file_tag>>.out}. Default: @code{off}
@end table @end table
@end deffn @end deffn

View File

@ -205,7 +205,7 @@ tt = (1-options_cond_fcst.conf_sig)/2;
t1 = round(options_cond_fcst.replic*tt); t1 = round(options_cond_fcst.replic*tt);
t2 = round(options_cond_fcst.replic*(1-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; forecasts.instruments = options_cond_fcst.controlled_varexo;
for i = 1:EndoSize for i = 1:EndoSize

View File

@ -30,4 +30,6 @@ function clean_ms_simulation_files(file_tag)
delete_if_exists(['simulation_' file_tag '.out']); delete_if_exists(['simulation_' file_tag '.out']);
delete_if_exists(['simulation_info_' 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 end

View File

@ -73,6 +73,7 @@ options_.ms.mh_replic = 10000; % default differs from Dan's code
options_.ms.thinning_factor = 1; options_.ms.thinning_factor = 1;
options_.ms.drop = 0.1*options_.ms.mh_replic*options_.ms.thinning_factor; options_.ms.drop = 0.1*options_.ms.mh_replic*options_.ms.thinning_factor;
options_.ms.adaptive_mh_draws = 30000; options_.ms.adaptive_mh_draws = 30000;
options_.ms.save_draws = 0;
% mdd % mdd
options_.ms.proposal_draws = 100000; options_.ms.proposal_draws = 100000;
options_.ms.use_mean_center = 0; options_.ms.use_mean_center = 0;

View File

@ -45,6 +45,10 @@ opt = [opt ' -burnin ' num2str(options_.ms.drop)];
opt = [opt ' -thin ' num2str(options_.ms.thinning_factor)]; opt = [opt ' -thin ' num2str(options_.ms.thinning_factor)];
opt = [opt ' -mh ' num2str(options_.ms.adaptive_mh_draws)]; opt = [opt ' -mh ' num2str(options_.ms.adaptive_mh_draws)];
if options_.ms.save_draws
opt = [opt ' -flat '];
end
% simulation % simulation
[err] = ms_sbvar_command_line(opt); [err] = ms_sbvar_command_line(opt);
mexErrCheck('ms_simulation',err); mexErrCheck('ms_simulation',err);

View File

@ -18,5 +18,5 @@ function e = addTable(e, varargin)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
e.objArray = e.objArray.addObj(table(varargin{:})); e.objArray = e.objArray.addObj(report_table(varargin{:}));
end end

View File

@ -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 ' ... assert(isempty(o.data) || isa(o.data, 'dseries'), ['@graph.graph: data must ' ...
'be a dseries']); 'be a dseries']);
assert(isempty(o.seriesToUse) || iscellstr(o.seriesToUse), ['@graph.graph: ' ... 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)),... assert(isempty(o.graphSize) || ((isfloat(o.graphSize) && length(o.graphSize) == 2)),...
['@graph.graph: graphSize is specified as an array with two float ' ... ['@graph.graph: graphSize is specified as an array with two float ' ...

View File

@ -30,8 +30,8 @@ function o = addSeries(o, varargin)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
assert(isa(o.pages(end).sections(end).elements(end), 'graph') || ... assert(isa(o.pages(end).sections(end).elements(end), 'graph') || ...
isa(o.pages(end).sections(end).elements(end), 'table'), ... isa(o.pages(end).sections(end).elements(end), 'report_table'), ...
'@report.addSeries: you can only add a series to a table or graph object'); '@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) = ...
o.pages(end).sections(end).elements(end).addSeries(varargin{:}); o.pages(end).sections(end).elements(end).addSeries(varargin{:});

View File

@ -1,9 +1,9 @@
function display(o) function display(o)
%function display(o) %function display(o)
% Display a Table object % Display a Report_Series object
% %
% INPUTS % INPUTS
% o [table] table object % o [report_series] report_series object
% %
% OUTPUTS % OUTPUTS
% none % none

View File

@ -1,10 +1,10 @@
function h = getLine(o, xrange) function h = getLine(o, xrange)
%function h = getLine(o, xrange) %function h = getLine(o, xrange)
% Create the series % Create the report_series
% %
% INPUTS % INPUTS
% o [series] series object % o [report_series] series object
% xrange [dates] range of x values for line % xrange [dates] range of x values for line
% %
% OUTPUTS % OUTPUTS
% h [handle] handle to line % h [handle] handle to line
@ -30,15 +30,15 @@ function h = getLine(o, xrange)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
%% Validate options provided by user %% 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']); 'provide data as a dseries']);
% Line % 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', '-', '--', ':', '-.'}; valid_line_style = {'none', '-', '--', ':', '-.'};
assert(any(strcmp(o.graphLineStyle, valid_line_style)), ... assert(any(strcmp(o.graphLineStyle, valid_line_style)), ...
['@series.getLine: graphLineStyle must be one of ' strjoin(valid_line_style, ' ')]); ['@report_series.getLine: graphLineStyle must be one of ' strjoin(valid_line_style, ' ')]);
assert(isfloat(o.graphLineWidth), ['@series.getLine: graphLineWidth must be a ' ... assert(isfloat(o.graphLineWidth), ['@report_series.getLine: graphLineWidth must be a ' ...
'positive number']); 'positive number']);
% GraphMarker % GraphMarker
@ -46,22 +46,22 @@ valid_graphMarker = {'+', 'o', '*', '.', 'x', 's', 'square', 'd', 'diamond', ...
'^', 'v', '>', '<', 'p', 'pentagram', 'h', 'hexagram', ... '^', 'v', '>', '<', 'p', 'pentagram', 'h', 'hexagram', ...
'none'}; 'none'};
assert(isempty(o.graphMarker) || any(strcmp(o.graphMarker, valid_graphMarker)), ... 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.graphMarkerEdgeColor), '@report_series.getLine: graphMarkerEdgeColor must be a string');
assert(ischar(o.graphMarkerFaceColor), '@series.getLine: graphMarkerFaceColor must be a string'); assert(ischar(o.graphMarkerFaceColor), '@report_series.getLine: graphMarkerFaceColor must be a string');
assert(isfloat(o.graphMarkerSize), ['@series.getLine: graphMarkerSize must be a ' ... assert(isfloat(o.graphMarkerSize), ['@report_series.getLine: graphMarkerSize must be a ' ...
'positive number']); 'positive number']);
% Marker & Line % 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']); 'you must provide at least one of graphLineStyle and graphMarker']);
% Validate xrange % Validate xrange
assert(isempty(xrange) || isa(xrange, 'dates')); assert(isempty(xrange) || isa(xrange, 'dates'));
% Zero tolerance % 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 if isempty(xrange) || xrange == o.data.time
@ -70,7 +70,7 @@ else
ds = o.data(xrange); ds = o.data(xrange);
end 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: % get line:
thedata = ds.data; thedata = ds.data;
stz = bsxfun(@and, ... stz = bsxfun(@and, ...

View File

@ -1,15 +1,15 @@
function o = series(varargin) function o = report_series(varargin)
%function o = series(varargin) %function o = report_series(varargin)
% Series Class Constructor % Report_Series Class Constructor
% %
% INPUTS % INPUTS
% varargin 0 args : empty series object % varargin 0 args : empty report_series object
% 1 arg : must be series object (return a copy of arg) % 1 arg : must be report_series object (return a copy of arg)
% > 1 args: option/value pairs (see structure below for % > 1 args: option/value pairs (see structure below for
% options) % options)
% %
% OUTPUTS % OUTPUTS
% o [series] series object % o [report_series] report_series object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
@ -57,13 +57,13 @@ o.tableRowColor = 'white';
o.zerotol = 1e-6; o.zerotol = 1e-6;
if nargin == 1 if nargin == 1
assert(isa(varargin{1}, 'series'),['@series.series: with one arg you ' ... assert(isa(varargin{1}, 'report_series'),['@report_series.report_series: with one arg you ' ...
'must pass a series object']); 'must pass a report_series object']);
o = varargin{1}; o = varargin{1};
return; return;
elseif nargin > 1 elseif nargin > 1
if round(nargin/2) ~= nargin/2 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.']); 'pairs.']);
end end
@ -76,11 +76,11 @@ elseif nargin > 1
if ~isempty(ind) if ~isempty(ind)
o.(optNames{ind}) = pair{2}; o.(optNames{ind}) = pair{2};
else 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 end
end end
% Create series object % Create report_series object
o = class(o, 'series'); o = class(o, 'report_series');
end end

View File

@ -34,9 +34,9 @@ switch S.type
case fieldnames(A) case fieldnames(A)
B.(S.subs) = V; B.(S.subs) = V;
otherwise otherwise
error(['@series.subsasgn: field ' S.subs 'does not exist']); error(['@report_series.subsasgn: field ' S.subs 'does not exist']);
end end
otherwise otherwise
error('@series.subsasgn: syntax error'); error('@report_series.subsasgn: syntax error');
end end
end end

View File

@ -31,12 +31,12 @@ switch S(1).type
A = feval(S(1).subs, A); A = feval(S(1).subs, A);
end end
otherwise otherwise
error(['@series.subsref: unknown field or method: ' S(1).subs]); error(['@report_series.subsref: unknown field or method: ' S(1).subs]);
end end
case {'()', '{}'} case {'()', '{}'}
error(['@series.subsref: ' S(1).type ' indexing not supported.']); error(['@report_series.subsref: ' S(1).type ' indexing not supported.']);
otherwise otherwise
error('@series.subsref: impossible case') error('@report_series.subsref: impossible case')
end end
S = shiftS(S); S = shiftS(S);

View File

@ -3,15 +3,15 @@ function o = write(o, fid, dates, precision, yrsForAvgs)
% Write Table Row % Write Table Row
% %
% INPUTS % INPUTS
% o [series] series object % o [report_series] report_series object
% fid [int] file id % fid [int] file id
% dates [dates] dates for series slice % dates [dates] dates for report_series slice
% precision [float] precision with which to print the data % precision [float] precision with which to print the data
% yrsForAvgs [bool] the years for which to compute averages % yrsForAvgs [bool] the years for which to compute averages
% %
% %
% OUTPUTS % OUTPUTS
% o [series] series object % o [report_series] report_series object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
@ -39,24 +39,24 @@ assert(isa(dates, 'dates'));
assert(isint(precision)); assert(isint(precision));
%% Validate options provided by user %% 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) if isempty(o.tableSubSectionHeader)
assert(~isempty(o.data) && isa(o.data, 'dseries'), ... 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 end
assert(ischar(o.tableNegColor), '@series.write: tableNegColor must be a string'); assert(ischar(o.tableNegColor), '@report_series.write: tableNegColor must be a string');
assert(ischar(o.tablePosColor), '@series.write: tablePosColor must be a string'); assert(ischar(o.tablePosColor), '@report_series.write: tablePosColor must be a string');
assert(ischar(o.tableRowColor), '@series.write: tableRowColor must be a string'); assert(ischar(o.tableRowColor), '@report_series.write: tableRowColor must be a string');
assert(islogical(o.tableShowMarkers), '@series.write: tableShowMarkers must be true or false'); assert(islogical(o.tableShowMarkers), '@report_series.write: tableShowMarkers must be true or false');
assert(islogical(o.tableAlignRight), '@series.write: tableAlignRight must be true or false'); assert(islogical(o.tableAlignRight), '@report_series.write: tableAlignRight must be true or false');
assert(isfloat(o.tableMarkerLimit), '@series,write: tableMarkerLimit must be a float'); assert(isfloat(o.tableMarkerLimit), '@report_series,write: tableMarkerLimit must be a float');
%% Write Output %% Write Output
dataString = ['%.' num2str(precision) 'f']; dataString = ['%.' num2str(precision) 'f'];
precision = 10^precision; precision = 10^precision;
fprintf(fid, '%% Table Row (series)\n'); fprintf(fid, '%% Table Row (report_series)\n');
if ~isempty(o.tableRowColor) if ~isempty(o.tableRowColor)
fprintf(fid, '\\rowcolor{%s}', o.tableRowColor); fprintf(fid, '\\rowcolor{%s}', o.tableRowColor);
end end

View File

@ -1,9 +1,9 @@
function display(o) function display(o)
%function display(o) %function display(o)
% Display a Series object % Display a Report_Table object
% %
% INPUTS % INPUTS
% o [series] series object % o [report_table] report_table object
% %
% OUTPUTS % OUTPUTS
% none % none

View File

@ -1,10 +1,10 @@
function o = table(varargin) function o = report_table(varargin)
%function o = table(varargin) %function o = report_table(varargin)
% Table Class Constructor % Report_Table Class Constructor
% %
% INPUTS % INPUTS
% 0 args => empty table % 0 args => empty report_table
% 1 arg (table class) => copy object % 1 arg (report_table class) => copy object
% %
% OUTPUTS % OUTPUTS
% none % none
@ -49,13 +49,13 @@ o.range = {};
o.precision = 1; o.precision = 1;
if nargin == 1 if nargin == 1
assert(isa(varargin{1}, 'table'),['With one arg to Table constructor, ' ... assert(isa(varargin{1}, 'report_table'),['With one arg to Report_Table constructor, ' ...
'you must pass a table object']); 'you must pass a report_table object']);
o = varargin{1}; o = varargin{1};
return; return;
elseif nargin > 1 elseif nargin > 1
if round(nargin/2) ~= nargin/2 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.']); 'pairs.']);
end end
@ -68,35 +68,35 @@ elseif nargin > 1
if ~isempty(ind) if ~isempty(ind)
o.(optNames{ind}) = pair{2}; o.(optNames{ind}) = pair{2};
else 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 end
end end
% Check options provided by user % Check options provided by user
assert(ischar(o.title), '@table.table: title must be a string'); assert(ischar(o.title), '@report_table.report_table: title must be a string');
assert(islogical(o.annualAverages), '@table.table: annualAverages must be true or false'); assert(islogical(o.annualAverages), '@report_table.report_table: annualAverages must be true or false');
assert(islogical(o.showHlines), '@table.table: showHlines must be true or false'); assert(islogical(o.showHlines), '@report_table.report_table: showHlines must be true or false');
assert(islogical(o.showVlines), '@table.table: showVlines must be true or false'); assert(islogical(o.showVlines), '@report_table.report_table: showVlines must be true or false');
assert(isint(o.precision), '@table.table: precision must be an int'); 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), ... 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'')''.']); '''dates(''1999q1''):dates(''1999q3'')''.']);
assert(isempty(o.data) || isa(o.data, 'dseries'), ... 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), ... 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'), ... 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 if o.showVlines
o.vlineAfter = ''; o.vlineAfter = '';
end end
assert(islogical(o.vlineAfterEndOfPeriod), ... 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', ... valid_title_sizes = {'Huge', 'huge', 'LARGE', 'Large', 'large', 'normalsize', ...
'small', 'footnotesize', 'scriptsize', 'tiny'}; 'small', 'footnotesize', 'scriptsize', 'tiny'};
assert(any(strcmp(o.titleSize, valid_title_sizes)), ... 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 % using o.seriesToUse, create series objects and put them in o.seriesElements
if ~isempty(o.data) if ~isempty(o.data)
@ -113,6 +113,6 @@ end
o = rmfield(o, 'seriesToUse'); o = rmfield(o, 'seriesToUse');
o = rmfield(o, 'data'); o = rmfield(o, 'data');
% Create table object % Create report_table object
o = class(o, 'table'); o = class(o, 'report_table');
end end

View File

@ -34,9 +34,9 @@ switch S.type
case fieldnames(A) case fieldnames(A)
B.(S.subs) = V; B.(S.subs) = V;
otherwise 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 end
otherwise otherwise
error('@table.subsasgn: syntax error') error('@report_table.subsasgn: syntax error')
end end
end end

View File

@ -31,12 +31,12 @@ switch S(1).type
A = feval(S(1).subs, A); A = feval(S(1).subs, A);
end end
otherwise otherwise
error(['@table.subsref: unknown field or method: ' S(1).subs]); error(['@report_table.subsref: unknown field or method: ' S(1).subs]);
end end
case {'()', '{}'} case {'()', '{}'}
error(['@table.subsref: ' S(1).type ' indexing not supported.']); error(['@report_table.subsref: ' S(1).type ' indexing not supported.']);
otherwise otherwise
error('@table.subsref: subsref.m impossible case') error('@report_table.subsref: subsref.m impossible case')
end end
S = shiftS(S); S = shiftS(S);

View File

@ -1,13 +1,13 @@
function o = write(o, fid) function o = write(o, fid)
%function o = write(o, fid) %function o = write(o, fid)
% Write a Table object % Write a Report_Table object
% %
% INPUTS % INPUTS
% o [table] table object % o [report_table] report_table object
% fid [integer] file id % fid [integer] file id
% %
% OUTPUTS % OUTPUTS
% o [table] table object % o [report_table] report_table object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
@ -31,7 +31,7 @@ function o = write(o, fid)
assert(fid ~= -1); assert(fid ~= -1);
if ~o.seriesElements.numSeriesElements() if ~o.seriesElements.numSeriesElements()
warning('@table.write: no series to plot, returning'); warning('@report_table.write: no series to plot, returning');
return; return;
end end
@ -49,7 +49,7 @@ else
end end
ndates = dates.ndat; ndates = dates.ndat;
fprintf(fid, '%% Table Object\n'); fprintf(fid, '%% Report_Table Object\n');
fprintf(fid, '\\setlength{\\tabcolsep}{4pt}\n'); fprintf(fid, '\\setlength{\\tabcolsep}{4pt}\n');
fprintf(fid, '\\begin{tabular}{@{}l'); fprintf(fid, '\\begin{tabular}{@{}l');
@ -105,7 +105,7 @@ switch dates.freq
for i=2:size(thdr, 1) for i=2:size(thdr, 1)
split = find(thdr{i-1, 2} == 4, 1, 'first'); split = find(thdr{i-1, 2} == 4, 1, 'first');
if isempty(split) if isempty(split)
error('@table.write: Shouldn''t arrive here'); error('@report_table.write: Shouldn''t arrive here');
else else
thdr{i, 2} = thdr{i-1, 2}(split+1:end); thdr{i, 2} = thdr{i-1, 2}(split+1:end);
thdr{i-1, 2} = thdr{i-1, 2}(1:split); thdr{i-1, 2} = thdr{i-1, 2}(1:split);
@ -127,9 +127,9 @@ switch dates.freq
end end
end end
case 12 case 12
error('@table.write: weekly dates not yet implemented'); error('@report_table.write: weekly dates not yet implemented');
otherwise otherwise
error('@table.write: invalid dseries frequency'); error('@report_table.write: invalid dseries frequency');
end end
for i=1:length(yrsForAvgs) for i=1:length(yrsForAvgs)
fprintf(fid, ' & %d', years(i)); fprintf(fid, ' & %d', years(i));
@ -138,7 +138,7 @@ fprintf(fid, '\\\\[-2pt]%%\n');
fprintf(fid, '\\hline%%\n'); fprintf(fid, '\\hline%%\n');
fprintf(fid, '%%\n'); fprintf(fid, '%%\n');
% Write Table Data % Write Report_Table Data
ne = o.seriesElements.numSeriesElements(); ne = o.seriesElements.numSeriesElements();
for i=1:ne for i=1:ne
o.seriesElements(i).write(fid, dates, o.precision, yrsForAvgs); o.seriesElements(i).write(fid, dates, o.precision, yrsForAvgs);
@ -149,5 +149,5 @@ end
fprintf(fid, '\\bottomrule\n'); fprintf(fid, '\\bottomrule\n');
fprintf(fid, '\\end{tabular} \\par \\medskip\n\n'); fprintf(fid, '\\end{tabular} \\par \\medskip\n\n');
fprintf(fid, '%% End Table Object\n'); fprintf(fid, '%% End Report_Table Object\n');
end end

View File

@ -1,11 +1,11 @@
function o = addTable(o, varargin) function o = addTable(o, varargin)
%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 % INPUTS
% 1 args => add empty table % 1 args => add empty report_table
% 2 args => add given table % 2 args => add given report_table
% 3 args => add table at index % 3 args => add report_table at index
% %
% OUTPUTS % OUTPUTS
% updated section object % updated section object

View File

@ -18,5 +18,5 @@ function o = addSeries(o, varargin)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
o.objArray = o.objArray.addObj(series(varargin{:})); o.objArray = o.objArray.addObj(report_series(varargin{:}));
end end

View File

@ -116,7 +116,7 @@ class ParsingDriver;
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL %token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL
%token <string_val> NAME %token <string_val> NAME
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS %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 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 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 %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_ms_drop
| o_thinning_factor | o_thinning_factor
| o_adaptive_mh_draws | o_adaptive_mh_draws
| o_save_draws
; ;
ms_simulation_options_list : ms_simulation_option COMMA ms_simulation_options_list 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); }; { 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_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_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_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_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); } o_proposal_type : PROPOSAL_TYPE EQUAL INT_NUMBER { driver.option_num("ms.proposal_type",$3); }

View File

@ -473,6 +473,7 @@ string eofbuff;
<DYNARE_STATEMENT>filter_decomposition {return token::FILTER_DECOMPOSITION; } <DYNARE_STATEMENT>filter_decomposition {return token::FILTER_DECOMPOSITION; }
<DYNARE_STATEMENT>selected_variables_only {return token::SELECTED_VARIABLES_ONLY; } <DYNARE_STATEMENT>selected_variables_only {return token::SELECTED_VARIABLES_ONLY; }
<DYNARE_STATEMENT>pruning {return token::PRUNING; } <DYNARE_STATEMENT>pruning {return token::PRUNING; }
<DYNARE_STATEMENT>save_draws {return token::SAVE_DRAWS; }
<DYNARE_STATEMENT>deflator {return token::DEFLATOR;} <DYNARE_STATEMENT>deflator {return token::DEFLATOR;}
<DYNARE_STATEMENT>log_deflator {return token::LOG_DEFLATOR;} <DYNARE_STATEMENT>log_deflator {return token::LOG_DEFLATOR;}
<DYNARE_STATEMENT>growth_factor {return token::GROWTH_FACTOR;} <DYNARE_STATEMENT>growth_factor {return token::GROWTH_FACTOR;}