[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Reporting

Dynare provides a simple interface for creating LaTeX reports, comprised of LaTeX tables and TikZ graphs. You can use the report as created through Dynare or pick out the pieces you want for inclusion in your own paper.

Reports are created and modified by calling methods on class objects. The objects are hierarchical, with the following order (from highest to lowest): Report, Page, Section, Graph/Table/Vspace, Series. For simplicity of syntax, we abstract away from these classes, allowing you to operate directly on a Report object, while maintaining the names of these classes in the Report Class methods you will use.

The report is created sequentially, command by command, hence the order of the commands matters. When an object of a certain hierarchy is inserted, all methods will function on that object until an object of equal or greater hierarchy is added. Hence, once you add a Page to the report, every time you add a Section object, it will be added to this Page until another Page is added to the report (via addPage). This will become more clear with the example at the end of the section.

Options to the methods are passed differently than those to Dynare commands. They take the form of named options to Matlab functions where the arguments come in pairs (e.g. function_name('option_1_name', `option_1_value', 'option_2_name', 'option_2_value', ...), where option_X_name is the name of the option while option_X_value is the value assigned to that option). The ordering of the option pairs matters only in the unusual case when an option is provided twice (probably erroneously). In this case, the last value passed is the one that is used.

Below, you will see a list of methods available for the Report class and a clarifying example.

Method on Report: report compiler, showDate, filename, margin, marginUnit, orientation, paper, title

Instantiates a Report object. Options

compiler, FILENAME

The full path to the LaTeX compiler on your system. If this option is not provided, Dynare will try to find the appropriate program to compile LaTeX on your system. Default is system dependent: Windows: the result of findtexmf --file-type=exe pdflatex, Mac OS X and Linux: the result of which pdflatex

showDate, BOOLEAN

Display the date and time when the report was compiled. Default: true

filename, FILENAME

The filename to use when saving this report. Default: report.tex

margin, DOUBLE

The margin size. Default: 2.5

marginUnit, `cm' | `in'

Units associated with the margin. Default: `cm'

orientation, `landscape' | `portrait'

Paper orientation: Default: `portrait'

paper, `a4' | `letter'

Paper size. Default: `a4'

title, STRING

Report Title. Default: none

Method on Report: addPage footnote, orientation, paper, title, titleFormat

Adds a Page to the Report. Options

footnote, STRING

A footnote to be included at the bottom of this page. Default: none

orientation, `landscape' | `portrait'

See orientation.

paper, `a4' | `letter'

See paper.

title, STRING | CELL_ARRAY_STRINGS

With one entry (a STRING), the title of the page. With more than one entry (a CELL_ARRAY_STRINGS), the title and subtitle(s) of the page. Default: none

titleFormat, STRING | CELL_ARRAY_STRINGS

A string representing the LaTeX markup to use on the title. The number of cell array entries must be equal to that of the title option. Default: none

Method on Report: addSection cols, height

Adds a Section to a Page. Options

cols, INTEGER

The number of columns in the section. Default: 1

height, STRING

A string to be used with the \sectionheight LaTeX command. Default: `!'

Method on Report: addGraph data, figname, figDirName, graphSize, showGrid, showLegend, showLegendBox, legendLocation, legendOrientation, legendFontSize, seriesToUse, shade, shadeColor, shadeOpacity, title, xlabel, ylabel, xrange, xTicks, xTickLabels, yrange, showZeroline

Adds a Graph to a Section. Options

data, dseries

The dseries that provides the data for the graph. Default: none

figname, STRING

The name to use when saving this figure. Default: [tempname `.tex']

figDirName, STRING

The name of the folder in which to store this figure. Default: tmpFigDir

graphSize, NUMERICAL_VECTOR

The width and height to be passed to the third and fourth elements of the array passed to the `Position' option of Matlab’s figure command, passed as a vector of size $2$. Default: Matlab sets width and height

showGrid, BOOLEAN

Whether or not to display the minor grid on the graph. Default: true

showLegend, BOOLEAN

Whether or not to display the legend. Default: false

showLegendBox, BOOLEAN

Whether or not to display a box around the legend. Default: false

legendLocation, `North' | `South' | `East' | `West' | `NorthEast' | `SouthEast' | `NorthWest' | `SouthWest' | `NorthOutside' | `SouthOutside' | `EastOutside' | `WestOutside' | `NorthEastOutside' | `SouthEastOutside' | `NorthWestOutside' | `SouthWestOutside' | `Best' | `BestOutside'

Where to place the legend in the graph. NB: some of these are not available under Octave. Default: `SouthEast'

legendOrientation, `vertical' | `horizontal'

Orientation of the legend. Default: `horizontal'

legendFontSize, DOUBLE

The font size for legend entries. Default: 8

seriesToUse, CELL_ARRAY_STRINGS

The names of the series contained in the dseries provided to the data option. If empty, use all series provided to data option. Default: empty

shade, dates

The date range showing the portion of the graph that should be shaded. Default: none

shadeColor, MATLAB_COLOR_NAME

The color to use in the shaded portion of the graph. Default: `green'

shadeOpacity, DOUBLE

The opacity of the shaded area, must be in $[0,1]$. Default: .2

title, STRING

Title for the graph. Default: none

xlabel, STRING

The x-axis label. Default: none

ylabel, STRING

The y-axis label. Default: none

xrange, dates

The boundary on the x-axis to display in the graph. Default: all

xTicks, NUMERICAL_VECTOR

Used only in conjunction with xTickLabels, this option denotes the numerical position of the label along the x-axis. The positions begin at $1$. Default: set by Matlab/Octave.

xTickLabels, CELL_ARRAY_STRINGS

The labels to be mapped to the ticks provided by xTicks. Default: the dates of the dseries

yrange, NUMERICAL_VECTOR

The boundary on the y-axis to display in the graph, represented as a NUMERICAL_VECTOR of size $2$, with the first entry less than the second entry. Default: all

showZeroline, BOOLEAN

Display a solid black line at $y = 0$. Default: false

Method on Report: addTable data, showHlines, precision, range, seriesToUse, title, titleSize, vlineAfter, vlineAfterEndOfPeriod, showVlines

Adds a Table to a Section. Options

data, dseries

See data.

showHlines, BOOLEAN

Whether or not to show horizontal lines separating the rows. Default: false

precision, INTEGER

The number of decimal places to report in the table data. Default: 1

range, dates

The date range of the data to be displayed. Default: all

seriesToUse, CELL_ARRAY_STRINGS

See seriesToUse.

title, STRING

Title for the table. Default: none

titleSize, STRING

LaTeX string representing the size of the table title. Default: large

vlineAfter, dates | CELL_ARRAY_DATES

Show a vertical line after the specified date (or dates if a cell array of dates is passed). Default: empty

vlineAfterEndOfPeriod, BOOLEAN

Show a vertical line after the end of every period (i.e. after every year, after the fourth quarter, etc.). Default: false

showVlines, BOOLEAN

Whether or not to show vertical lines separating the columns. Default: false

Method on Report: addSeries data, graphLineColor, graphLineStyle, graphLineWidth, graphMarker, graphMarkerEdgeColor, graphMarkerFaceColor, graphMarkerSize, tableDataRhs, tableRowColor, tableShowMarkers, tableAlignRight, tableNegColor, tablePosColor, tableSubSectionHeader, zerotol

Adds a Series to a Graph or a Table. Options

data, dseries

See data.

graphLineColor, MATLAB_COLOR

Color to use for the series in a graph. Default: `k'

graphLineStyle, `none' | `-' | `--' | `:' | `-.'

Line style for this series in a graph. Default: '-'

graphLineWidth DOUBLE

Line width for this series in a graph. Default: 0.5

graphMarker, `+' | `o' | `*' | `.' | `x' | `s' | `square' | `d' | `diamond' | `^' | `v' | `>' | `<' | `p' | `pentagram' | `h' | `hexagram' | `none'

The Marker to use on this series in a graph. Default: none

graphMarkerEdgeColor, MATLAB_COLOR

The edge color of the graph marker. Default: `auto'

graphMarkerFaceColor, MATLAB_COLOR

The face color of the graph marker. Default: `auto'

graphMarkerSize, DOUBLE

The size of the graph marker. Default: 6

tableDataRhs, dseries

A series to be added to the right of the current series. Usefull for displaying aggregate data for a series. e.g if the series is quarterly tableDataRhs could point to the yearly averages of the quarterly series. This would cause quarterly data to be displayed followed by annual data. Default: empty

tableRowColor, STRING

The color that you want the row to be. Predefined values include LightCyan and Gray. Default: white.

tableShowMarkers, BOOLEAN

In a Table, if true, surround each cell with brackets and color it according to tableNegColor and tablePosColor. No effect for graphs. Default: false

tableAlignRight, BOOLEAN

Whether or not to align the series name to the right of the cell. Default: false

tableMarkerLimit, DOUBLE

For values less than $-1*@code{tableMarkerLimit}$, mark the cell with the color denoted by tableNegColor. For those greater than tableMarkerLimit, mark the cell with the color denoted by tablePosColor. Default: 1e-4

tableNegColor, LATEX_COLOR

The color to use when marking Table data that is less than zero. Default: `red'

tablePosColor, LATEX_COLOR

The color to use when marking Table data that is greater than zero. Default: `blue'

tableSubSectionHeader, STRING

A header for a subsection of the table. No data will be associated with it. It is equivalent to adding an empty series with a name. Default: ''

zerotol, DOUBLE

The zero tolerance. Anything smaller than zerotol and larger than -zerotol will be set to zero before being graphed. Default: $1e-6$

Method on Report: addVspace hline, number

Adds a Vspace (vertical space) to a Section. Options

hline, INTEGER

The number of horizontal lines to be inserted. Default: 0

number, INTEGER

The number of new lines to be inserted. Default: 1

Method on Report: write

Writes the LaTeX representation of this Report, saving it to the file specified by filename.

Method on Report: compile compiler

Compiles the report written by write into a pdf file. If the report has not already been written (determined by the existence of the file specified by filename, write is called. optionshead

compiler, FILENAME

Like compiler, except will not overwrite the value of compiler contained in the report object. Hence, passing the value here is useful for using different LaTeX compilers or just for passing the value at the last minute.

Example

The following code creates a one page report. The first part of the page contains two graphs displayed across two columns and one row. The bottom of the page displays a centered table.

 
%% Create dseries
dsq = dseries(`quarterly.csv');
dsa = dseries(`annual.csv');
dsca = dseries(`annual_control.csv');

%% Report
rep = report();

%% Page 1
rep = rep.addPage(`title', `My Page Title', `titleFormat', `\large\bfseries');

% Section 1
rep = rep.addSection(`cols', 2);
rep = rep.addGraph(`title', `Graph (1,1)', `showLegend', true, ...
                   `xrange', dates(`2007q1'):dates(`2013q4'), ...
                   `shade', dates(`2012q2'):dates(`2013q4'));
rep = rep.addSeries(`data', dsq{`SERIES1'}, `color', `b', ...
                    `graphLineWidth', 1);
rep = rep.addSeries(`data', dsq{`SERIES2'}, `color', `g', ...
                    `graphLineStyle', '--', `graphLineWidth', 1.5);
rep = rep.addGraph(`title', `Graph (1,2)', `showLegend', true, ...
                   `xrange', dates(`2007q1'):dates(`2013q4'), ...
                   `shade', dates(`2012q2'):dates(`2013q4'));
rep = rep.addSeries(`data', dsq{`SERIES3'}, `color', `b', ...
                    `graphLineWidth', 1);
rep = rep.addSeries(`data', dsq{`SERIES4'}, `color', `g', ...
                    `graphLineStyle', '--', `graphLineWidth', 1.5);

% Section 2
rep = rep.addSection();
rep = rep.addTable(`title', `Table 1', ...
                   `range', dates(`2012Y'):dates(`2014Y'));
shortNames = {`US', `EU'};
longNames  = {`United States', `Euro Area'};
for i=1:length(shortNames)
    rep = rep.addSeries(`data', dsa{[`GDP_' shortNames{i}]});
    delta = dsa{[`GDP_' shortNames{i}]}-dsca{[`GDP_' shortNames{i}]};
    delta = delta.tex_rename(`$\Delta$');
    rep = rep.addSeries(`data', delta, ...
                        `tableShowMarkers', true, ...
                        `tableAlignRight', true);
end

%% Write & Compile Report
rep.write();
rep.compile();

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Build Daemon user on December 6, 2015 using texi2html 1.82.