0% found this document useful (0 votes)
771 views88 pages

BEAR User Guide v5

The document provides a user guide for the Bayesian Estimation, Analysis and Regression (BEAR) toolbox. The toolbox allows users to estimate various types of VAR models using Bayesian techniques. It has a graphical user interface that makes it accessible for non-technical users. The guide describes how to prepare data, estimate models, and interpret results. Various applications are available in the toolbox, including forecasting, scenario analysis, and historical decompositions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
771 views88 pages

BEAR User Guide v5

The document provides a user guide for the Bayesian Estimation, Analysis and Regression (BEAR) toolbox. The toolbox allows users to estimate various types of VAR models using Bayesian techniques. It has a graphical user interface that makes it accessible for non-technical users. The guide describes how to prepare data, estimate models, and interpret results. Various applications are available in the toolbox, including forecasting, scenario analysis, and historical decompositions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

The Bayesian Estimation, Analysis and

Regression (BEAR) Toolbox

User guide

Version 5.0

Alistair Dieppe
Björn van Roye

with contributions from


Boris Blagov, Marius Schulte, Ben Schumann

previous versions with


Romain Legrand

These programmes are the responsibilities of the authors and not of the ECB and all errors and
ommissions remain those of the authors.
Acknowledgments

This documentation guide serves as a supplement to the Bayesian Estimation, Analysis and Regres-
sion (BEAR) Toolbox developed on Matlab. The BEAR toolbox and the accompanying guide have
been initially developed by Alistair Dieppe1 , Romain Legrand, and Björn van Roye2 . The updated
version 5 of BEAR has benefitted from major contributions from Boris Blagov, Marius Bruno Schulte
and Ben Schumann.

The authors are grateful to the following people for valuable input and advice which contributed
to improve the quality of the toolbox: Mirco Balatti, Paolo Bonomolo, Marta Banbura, Niccolo Bat-
tistini, Gabriel Bobeica, Martin Bruns, Fabio Canova, Matteo Ciccarelli, Marek Jarocinski, Michele
Lenza, Francesca Loria, Mirela Miescu, Carlos Montes-Caldon, Chiara Osbat, Gary Koop, Giorgio
Primiceri, Michal Rubaszek, Peter Welz, Hugo Vega de la Cruz, Andrej Sokol, and Barbara Rossi.

These programmes are the responsibilities of the authors and not of the ECB nor Bloomberg LP and
all errors and ommissions remain those of the authors.

Using the BEAR toolbox implies acceptance of the End User Licence Agreement and appropri-
ate acknowledgement should be made.

Latest update: 16.04.2021

1
ECB, [email protected]
2
Bloomberg LP, [email protected]

i
Contents

1 Introduction 1
1.1 BEAR-Toolbox - available features and applications . . . . . . . . . . . . . . . . . . . 1
1.2 What’s new in BEAR? BEAR 5 vs. 4.2 . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Preparing your project 5


2.1 Preparing your folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Opening your data sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Preparing your data sheet for a standard OLS VAR, Bayesian VAR or mean-adjusted
BVAR model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Preparing your data sheet for a panel VAR . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Running your project 12


3.1 Launching the toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Setting basic information for your model . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Setting prior information for a Bayesian VAR . . . . . . . . . . . . . . . . . . 15
3.4 Setting prior information for a time-varying BVAR . . . . . . . . . . . . . . . 16
3.5 Setting prior information for a panel VAR . . . . . . . . . . . . . . . . . . . . . 18
3.6 Setting the applications for your model . . . . . . . . . . . . . . . . . . . . . . . 20
3.7 Running BEAR without interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 24

4 Setting your applications on Excel 26


4.1 Prior values for the mean-adjusted model . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2 Setting priors for the long run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3 Predicted exogenous (OLS VAR, Bayesian VAR, mean-adjusted BVAR and Stochastic
volatility BVAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.4 Grid search (Bayesian VAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.5 Block exogeneity (Bayesian VAR, mean-adjusted BVAR and stochastic volatility BVAR) 32
4.6 Sign restrictions (Bayesian VAR, mean-adjusted BVAR and stochastic volatility BVAR) 33
4.7 Conditional forecasts (Bayesian VAR, mean-adjusted BVAR and stochastic volatility
BVAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.7.1 Standard methodology (all shocks) . . . . . . . . . . . . . . . . . . . . . . . . 38

ii
Contents

4.7.2 Standard methodology (shock-specific) . . . . . . . . . . . . . . . . . . . . . . 41


4.7.3 Tilting methodology (median) . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.7.4 Tilting methodology (intervals) . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.8 Predicted exogenous (panel BVAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.9 Conditional forecasts (panel BVAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.9.1 Standard methodology (all shocks) . . . . . . . . . . . . . . . . . . . . . . . . 55
4.9.2 Standard methodology (shock-specific) . . . . . . . . . . . . . . . . . . . . . . 57

5 Interpreting your results 65


5.1 Matlab output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.2 Matlab charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.3 Excel record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

6 Appendix: description of the example datasets 79

Frequently asked questions 80

Bibliography 83

iii
CHAPTER 1
Introduction
The Bayesian Estimation, Analysis and Regression (BEAR) toolbox has been developed for forecast-
ing and policy analysis. There has been an increasing use of Bayesian VARs to address a wide range
of issues in macroeconomics, including forecasting, scenario analysis as well as exploring the con-
tribution of different factors (e.g. via historical decompositions) to the evolution of macroeconomic
variables. Bayesian estimation is particularly useful in cases where there is limited data availability.
It is also one approach to address the issue of large dimensionality in estimation and has the ad-
vantage of providing an empirical measure of uncertainty surrounding the estimates. In many ways
Bayesian VARs are preferable to traditionally estimated VARs.
Some codes and software for Bayesian VARs already exist. However, they have very limited features.
Furthermore, they tend to lack flexibility, are difficult to augment, and are typically not very user-
friendly. Accordingly, it has been decided to create a more comprehensive Bayesian VAR toolbox
where the programme is easy for non-technical users to understand, augment and adapt.
In particular the BEAR toolbox includes a user-friendly graphical interface which allows the tool to
be used by country desk economists. Furthermore, the toolbox is well documented, both within the
code as well as including a detailed theoretical and user’s guide.
By making available the toolbox we aim at sharing expertise and hope this could become a key
tool for macroeconomic analysis which exploits synergies and increases efficiency as well as avoids
unnecessary duplication of work.

BEAR-Toolbox - available features and applications

We next list an overview of the applications available in BEAR. BEAR Version 5 offers the following
applications:

• Estimation techniques of VAR models


– OLS (maximum likelihood) VAR
– Standard Bayesian VAR (Doan et al. (1983) and Litterman (1986))

1
Chapter 1 Introduction

– Mean-adjusted BVAR with informative prior on the steady-state (Villani (2009)) and with
trends and regime changes
– Bayesian Panel VAR (as in Canova and Ciccarelli (2013))
– Stochastic Volatility
– Time Varying Parameters

• Alternative priors for Bayesian VAR models


– Minnesota (Litterman (1986))
– Normal Wishart (Kadiyala and Karlsson (1997))
– Independent Normal Wishart with Gibbs sampling
– Normal diffuse (Kadiyala and Karlsson (1997))
– Dummy observations (Banbura et al. (2010))

• Prior extensions for Bayesian VARs


– Hyperparameter optimisation by grid search (similar to Giannone et al. (2015))
– Block exogeneity
– Dummy observation extentions: sum-of-coefficient, dummy initial obervation (Banbura
et al. (2010))
– Long-run priors (Giannone et al. (2017))

• Panel models
– OLS Mean-group estimator (Pesaran and Smith (1995))
– Bayesian pooled estimator
– Random effect model, Zellner-Hong (Zellner and Hong (1989))
– Random effect model, hierarchical (Jarocinski (2010))
– Static factor model (Canova and Ciccarelli (2013))
– Dynamic factor model (Canova and Ciccarelli (2013))

• Structural VARs
– Choleski factorisation
– Triangular factorisation
– Sign, magnitude and zero restrictions (Arias et al. (2014))

2
Chapter 1 Introduction

• Applications
– Unconditional forecasts
– Impulse response functions
– Forecast error variance decomposition
– Historical decompositions
– Conditional forecasts: shock approach (Waggoner and Zha (1999))
– Conditional forecasts: tilting approach (Robertson et al. (2005))
– Forecast evaluation: standard and Bayesian-specific criteria
– Density forecast evaluation

What’s new in BEAR? BEAR 5 vs. 4.2

Some of you may have already used the BEAR toolbox in its previous version, which was version
4.2. There are many modifications which pertain to BEAR application:

1. OLS (maximum likelihood) VAR


• added sign and magnitude restrictions
• added proxy VAR identification
• added FAVARs

2. Standard Bayesian VAR


• added Bayesian FAVARs
• added Bayesian Proxy SVARs
• added informative prior on steady-state
• added long-run zero restrictions
• added variables specific AR priors
• added priors on exogenous variables

3. Panel VAR (Ciccarrelli and Canova 2013)

4. Time Varying Parameters Stochastic Volatility


• added trendy VARs

5. Mixed Frequency Bayesian VAR

3
Chapter 1 Introduction

There are also modifications:

• BEAR environment
1. Interface
The graphical interface of BEAR has been updates. It is now "Tab"-based and does not
require going back and forth.
2. Tables
All tables are kept to Excel. In the case of large models, the tables could exceed the size
of the screen, making it impossible to fill them. Secondly, the Java table used by Matlab
proved quite unstable: entries filled by the user would sometimes be ignored by the code
without a reason. On these grounds, it seemed preferable to use Excel. As an additional
bonus, the new Excel configuration renders the use of the toolbox more flexible: it is now
possible to modify some elements of the model without having to update the table.
3. Developer’s version
The developers version can now be called with a single command (bear_5_dev.m).
4. Replication option
BEAR now provides the possibility to replicate selected published papers with on click.
This new feature is planned to be developed even further by adding more academic papers.

• BEAR applications
1. Block exogeneity
The shocks and variables in the excel spreadsheet have been flipped to be more consistent
with the rest of the toolbox.
2. Sign restrictions
The sign restriction setup now also allows to combine it with an instruments in the new
Bayesian Proxy SVAR procedure.
3. Output graphs
Improvements to matlab graphical reporting of forecast error variance and historical de-
compositions.

4
CHAPTER 2
Preparing your project
Preparing your folder

The BEAR toolbox package is delivered to you as a zip file. Your unzipped folder should look like
this:

Figure 2.1: Unzipped folder

The folder contains a number of elements:


- the "documentation" folder. This folder contains three documentation files in pdf format: the user
guide (the document you are currently reading), explaining how to use the toolbox; and a technical
guide providing the mathematical derivations for the models and applications implemented by the
toolbox and an overview presentation.
- the "files" folder. This folder contains the set of matlab functions run by the code. Except in a
few specific cases indicated in this guide, you should not alter nor delete any elements in this folder.
Doing so may result in the code not working properly anymore.
- the "results" folder. This folder stores output from BEAR.

5
Chapter 2 Preparing your project

- the "replications" folder. This folder has a number of files to replicate papers from the literature.
- the "bear5.m" matlab file. This file is used to start the application and run the estimation. Further
details can be found in chapter 3: Running your project.
- the "bear5dev.m" matlab file. This file is used to run the developers version.
- the "bear_replications.m" matlab file. This file is used to run the developers version.
- the "data.xlsx" Excel file. This file contains the data that will be used by the toolbox to run the
estimation.

By default, the toolbox folder is called "bear-toolbox". However, it is possible to rename the folder
to suit your particular project. You may then place the folder in any directory of your choice. For
example, you may create a new project, and for this project change the folder name from "bear-
toolbox" to "my project". Assume that for convenience you also create a new folder on your D drive
called "bear projects" that gathers all your different projects. You may then move "my project" into
"bear projects".
Note that it is possible to use a single folder (here for instance, "my project") for all your different
projects. In practice however this is not recommended. Different projects imply different datasets,
and you may not want to overwrite the data from former projects. Also, the results from your former
projects saved by the toolbox will be overwritten if you decide to run a new project. For these
reasons, it is preferable to create a new (separate) folder for each of your projects, which is usually
not a problem since the unzipped file only takes 1 Gigabites of space. Gathering all your projects in
a single directory like in the above example with the "bear projects" folder can then be a convenient
option for organisation purposes.

Opening your data sheet

Now that your project folder is ready, you can prepare the dataset for you project. This is done by
the way of the Excel file called "data.xlsx". When you open the file, it should look like Figure 2.2.

The Excel spreadsheet contains many different tabs, distributed into three colours:

- the blue tabs are related to data. They are the tabs that will be of interest for the creation
of the datasets.
- the green tabs are related to applications with the Bayesian VAR and mean-adjusted VAR models.
They can be ignored for now.
- the orange tabs are related to applications with panel Bayesian VAR models. They can also be
ignored for now.

6
Chapter 2 Preparing your project

Figure 2.2: Excel data spreadsheet

Preparing your data sheet for a standard OLS VAR, Bayesian VAR or mean-adjusted BVAR model

If you intend to run any of these three models, then the only sheet you have to care about is the
sheet called "data". You should not rename the sheet as this would cause the code to return an error.
As you may notice, the sheet is not blank: it is filled it with an example in order to make your work
simpler. The easiest and safest way to create the data for your own project set is probably to use this
example spreadsheet and adapt it to your own dataset. The default example dataset is quarterly, but
BEAR accepts six different date formats (yearly, quarterly, monthly, weekly, daily, and undated).
Therefore, the file contains 6 different worksheets respectively called "yearly", "quarterly", "monthly",
"weekly", "daily", and "undated" that all contain example datasets for their corresponding formats
(see chapter 6 for more details on these datasets). Given the date format of your project, you may
thus copy the content of the corresponding sheet and paste it into "data", then adapt it to your own
dataset. Note also that you may just delete these example worksheets if you do not need them.

Considering the example sheet, the organisation is fairly straightforward: the first column is used for
the date labels, while the first row is used for the labels of your data series. The default example for
instance considers a dataset with four variables for the US: real GDP, CPI, policy interest rates and
the oil price. The dataset is quarterly, starts in 1970q2 and ends in 2020q4. More details are now
provided about the different elements.

Variable names

The first row of the spreadsheet is always used for the labels of the data series. The list must
start in cell (1:B), as in the example, and then develop rightward. The series names can just be

7
Chapter 2 Preparing your project

any names, but a name cannot comprise spaces. For instance, "DOMGDP" or "DOM_GDP" would
be correct, but "DOM GDP" would result in a crash of the code. Also, it is recommended you use
names containing less than 20 characters, as otherwise you may face minor display issues of the results.

Dates

The first column of the spreadsheet is always used for the labels of the dates. The list must start in
cell (2:A) and then develop downward. As already stated, BEAR accepts six formats of dates: yearly,
quarterly, monthly, weekly, daily, and undated data. Each format has its own specification. The
specification of each format must be respected exactly, otherwise the code will return an error. Do
not use either the automatic date formatting provided by excel. This format will not be recognised
by the code and will result in an error. The six example sheets are there to help you building your
own set. The different formats have to be specified as follows:

- yearly: dates have to specified as the year (4-digit number) followed by a lower "y", without a
space.
correct example: 1999y
wrong examples: 1999, y1999, 1999Y, 1999 y.

- quarterly: dates have to specified as the year (4-digit number) followed by a lower "q", then by the
quarter (number between 1 and 4), without spaces.
correct example: 1999q2
wrong examples: 2q1999, 1999Q2, 1999 q 2.
The dataset does not have to start at quarter 1. For instance, starting the set at 1999q2 is perfectly
possible. Similarly, the dataset does not have to end at quarter 4. However, the labelling must be
consistent between the start and end dates and there should be no missing quarter.

- monthly: dates have to specified as the year (4-digit number) followed by a lower "m", then by the
month (number between 1 and 12), without spaces.
correct example: 1999m6
wrong examples: 6m1999, 1999M6, 1999 m 6.
The dataset does not have to start at month one, nor to end at month 12. The dates have to be
consistent between the start and end dates, there should be no missing month and no disordering,
and any full year should be made of 12 months.

- weekly: dates have to specified as the year (4-digit number) followed by a lower "w", then by

8
Chapter 2 Preparing your project

the week, without spaces.


correct example: 1999w12
wrong examples: 12w1999, 1999W12, 1999 w 12.
The code is flexible: different years may include a different number of weeks. For instance, the first
year in the set may end at week 52, the second at week 51, and the third at week 53. Any number
of weeks per year is possible: the code will simply identify the numbering which has been used and
adapt to it. Similarly a year does not have to start at week 1, whether it is the first or last data
year, or any year in between.

- daily: dates have to specified as the year (4-digit number) followed by a lower "d", then by the day,
without spaces.
correct example: 1999d208
wrong examples: 208d1999, 1999D208, 1999 d 208.
Similarly to weeks, different years may include a different number of days. Indeed, in the weekly
example file, missing data led to suppress many entries, resulting in 2012 to comprise 261 days, but
2014 to include only 249 of them. This is not an issue, the code will identify the number of days
provided for each year and adapt to it. Any year in the dataset does not have either to start at day
1 and may start at any day value.

- undated: dates have to specified as the period, followed by a lower "u", without a space.
correct example: 53u
wrong examples: 53, u53, 53U, 1999 y.
The dataset does not have to start at period 1 and may just start at any period value. Periods
however have to be consecutive, and skipping period values is not allowed. For instance, jumping
from period 56 to period 58, ignoring period 57, is not possible.

Note that in general the dates don’t have to correspond to the dates of the model to be estimated.
That is, the window of the data in the data sheet can be larger than the dates of the model. For
instance, the example sheet starts date in 1999q1 and ends it in 2015q3. It is perfectly possible to
use this data sheet to estimate a model that will start in 2000q4 and end in 2014q2.

Data

The remaining entries of the "data" worksheet are used for the data itself. The set has to be balanced
and consistent with both the variable and date labels. That is, the dataset must be a rectangular
array, with exactly as many columns as the number of variables, and exactly as many rows as the

9
Chapter 2 Preparing your project

number of periods, similarly to the example datasets. Also, note that non-numerical or blank values
are not permitted, as the code needs to generate a complete numerical array from the spreadsheet.
Values identified as blanks or non-numerical will generate an error and prevent the code from running
correctly. Similarly to dates, the number of data series can be larger than the number of variables
effectively used in the model. The example worksheet contains for instance the series rgdp, inf, un
and exdoll, but it is possible with this sheet to estimate a model only involving rgdp and un.

BEAR allows you to include both endogenous and exogenous variables in your model. Exogenous
variables can be constant terms, time trends, dummy variables, but also actual economic variables
such as oil price. It does not matter whether a variable in the spreadsheet will be used as endogenous
or exogenous by the model, the spreadsheet only uses a unique format. Indeed, if you look at the
example sheet for instance, the variable OIL is just entered as any other variable while it will be
typically used as an exogenous variable. Note finally that if you plan to use a constant term, you do
not need to create a series of ones in the spreadsheet: the constant is a special term that the code
will handle internally.

Preparing your data sheet for a panel VAR

The preparation of your data for a panel VAR model is overall similar to that of a normal VAR
model, except that a bit more planning is required. As a panel involves different units, you need first
to create and name a new worksheet for each unit. In the example file, for instance, four worksheets
were created called Ger, Fr, It, Sp, respectively corresponding to Germany, France, Italy and Spain.
Those names will be the ones used by the code for the estimation of the model, so that rules similar
to variable names apply: any name is possible, but unit names cannot contain spaces.

The variable, dates and data formats for each individual unit are rigorously similar to that of the
standard VAR, and you are referred to section 2.3 for further details. Note that your dataset must
be consistent across units: it must include the same variables over the same periods. The main
difference with a standard VAR model comes from the treatment of exogenous variables. While in a
standard VAR, endogenous and exogenous were treated indifferently, a panel VAR differentiates the
two types of variables: endogenous variables share the same names across units but their values are
unit-specific, while on the other hand exogenous variables have to be common to all units, that is,
their values are similar across units. Hence, unlike a standard VAR model, for a panel VAR you need
to plan in advance which variables will be endogenous (variable values will differ from one unit to
another) and which variable will be exogenous (identical values for all units). In the example work-
sheet, for instance, each unit comprises four variables: real GDP growth, inflation, policy interest
rate, and the oil price. The first three variables are proper to their respective countries and will be

10
Chapter 2 Preparing your project

used as endogenous variables: their values are allowed to be unit-specific. The oil price on the other
hand is common to all countries: it will be used as an exogenous variable, and the values are the
same for all units.

11
CHAPTER 3
Running your project
Launching the toolbox

Now that your dataset is ready, it is possible to run your project. To start the BEAR toolbox,
double-click on the file "bear5.m" on your project folder. This will initiate a Matlab session, and
open the following window:

Figure 3.1: Matlab window

All what you need to do is to press the "Run" button in order to start the toolbox.

Setting basic information for your model

Pressing the "Run" button will open the Specification interface, which looks as follows:

The different entries are now detailed, in turn.

VAR type The BEAR toolbox proposes three different estimation techniques of VAR models: the

12
Chapter 3 Running your project

Figure 3.2: Specification interface

Bayesian VAR, time-varying VAR, and Bayesian panel VAR.

Data frequency Simply select the choice corresponding to your dataset in this menu. Select-
ing a type inconsistent with your data will result in an error from the code.

Estimation sample: start date Type the start date of your estimation sample. This date does
not have to be the first date of your dataset, but has of course to be included in your dataset.

Estimation sample: end date Similar to the sample start date: the date does not have to be the
final date of your dataset, but has to be included in the dataset.

List of endogenous variables Type in this box the names of the variables you want to include as
endogenous in your model, separating them with a space. You may type only a subset of variables
from your Excel spreadsheet, and the order in which you enter them into your model does not have
to be that of your spreadsheet. Note however that names are case-sensitive, and that any case or
spelling mistake will result in a program error.

tip: if you want to save time, you can directly copy the cells of names from your Excel spread-
sheet and paste them without further ado in the window of the interface. While the spaces will look

13
Chapter 3 Running your project

odd, the code has an automatic correction function that will replace them with regular spaces once
you validate the interface. For instance, if with the example file you want to estimate a model with
"DOM_GDP", "DOM_CPI" and "STN", you can just copy the cells with the names and then paste
the cells into the interface. The spaces might look odd, but you do not need to change anything.
List of exogenous variables Type in this box the names of the variables you want to include as
exogenous in your model, separating them with a space. Exogenous variables are facultative: you
may leave the box blank. As already stated, constant terms do not require the creation of a column
of ones in the excel spreadsheet. Instead, the "include constant in the regression" control should be
used, and the code will manage the constant during the whole estimation process. Finally, note that
the tip allowing to copy the labels directly from Excel can be used here as well.

Number of lags Simply type the number of lags you want to include in the model.

Include constant Set this control on "Yes" if you want your model to include a constant term.
The code will then include a constant in every subsequent step of the estimation process. This choice
is set to Yes by default if you select the mean-adjusted BVAR model, since then a constant term is
always included.

Set results file Add the name you want the results files to be called - both the log, excel and
mat file. These files are will be stored in the folder results in your directory. If you select rolling
regressions later on then the results file will be amended with the dates.

Select output If you want the results stored in excel select the check box. If you want Matlab
figures then also select this box. The BEAR runs faster if both of these boxes are unselected.

Path to data Enter the path to the folder containing the Excel data spreadsheet. By default,
the code proposes your project folder. If for any reason you want to place your excel spreadsheet in
another folder, you may type instead the path to this folder. For your own convenience it nevertheless
advised that you simply leave the spreadsheet in your project folder.

Remember preferences By default the interface will remember your last settings.
Your choice of options will depend on your choice of model. If you select the Bayesian VAR, the
time-varying BVAR or the panel VAR, the next interface to open will be specific to the model. All
the interfaces are now detailed in turn.

14
Chapter 3 Running your project

Setting prior information for a Bayesian VAR

If your selected model is the Bayesian VAR, the interface comprises three parts: prior distribution,
hyperparameters, and options.

Prior distribution: The BEAR toolbox proposes five different prior distributions and their de-
clinations. The first is the original Minnesota prior proposed by Litterman (1986), the second is the
normal-Wishart (also called sometimes the natural conjugate prior), the third is the independent
normal-Wishart prior with Gibbs sampling, the fourth is the normal-diffuse prior and the last one is
a dummy-observation prior. For more details on these different priors, please refer to the technical
guide.

Hyperparameters The set of hyperparameters is used to compute the mean and variance of the
prior distribution for the VAR coefficients. As you can see, the code proposes default values: these
are values typically found in the literature. Hence, even if you do not have a precise idea of the
interpretation of these hyperparameters, you can still estimate a BVAR model by using these values
as a reasonable starting point. Note that some values are shaded and deactivated: this is because
they correspond the optional applications. λ5 is associated with block exogeneity, λ6 with the Sum-
of-coefficients application, and λ7 with the Dummy initial observation application. Therefore, these
hyperparameters will activate only if the corresponding applications are selected. For more details
about the interpretation of the hyperparameters, please refer to the technical guide.

Options The options allow for additional flexibility in the design of the prior distribution and
estimation process. The first two options are related to the Gibbs sampling algorithm: they are
used to indicate the total number of iterations of the algorithm, and the number of preliminary
iterations discarded as burn-in iterations. More burn-in iterations and a larger total number of itera-
tions lead to more accurate posterior distributions but are more time-consuming. The default values
of 2000 total iterations including 1000 burn-in iterations is typically sufficient for most BVAR models.

You may also decide to optimise your hyperpameter values with a grid search, based on the com-
bination optimising the marginal likelihood. While this is a very useful option, it can be very
time-consuming. Note also the mention that this application requires additional input on Excel:
please refer to section 4.4 for details.

BEAR also allows you to implement block exogenity in your model in order to prevent certain
variable to be impacted by other given variables, effectively generating exogeneity between them.
This also requires additional input on Excel, and you are refered to section 4.5 for details.

15
Chapter 3 Running your project

Finally, you may consider implementing dummy observation extensions, especially if you are us-
ing non-stationary data (which is typically the case for data in level). Note that you may select
either or both the sum-of-coefficients and dummy initial observation extension: simply check the
box of the applications of interest. These extensions can apply to any of the five prior distributions
proposed in BEAR.

For further theoretical details on block exogeneity and the dummy observation extensions, please
refer to the technical guide. There are also options for choosing OLS, FAVARs or MFVARs. The
options will change depending if these are selected of not.

Setting prior information for a time-varying BVAR

If your selected model is the time-varying BVAR, the interface that will open will look like this:

Figure 3.3: Time-varying BVAR interface

This interface is very similar to the interface for the Bayesian VAR model, except that it includes
fewer options. The interpretation of the different hyperparameters and options is similar to the
Bayesian VAR, hence please refer to section 3.3 if you need additional details.

16
Chapter 3 Running your project

One essential difference with the Bayesian VAR nevertheless is the fact that the time-varying BVAR
requires to set prior distribution values for the coefficients on exogenous variables. As indicated on
top of the interface, this has to be done by the way of a worksheet in Excel.
If your selected model is the time-varying BVAR. This interface has three types of models. The first
model is stochastic volatility. The second time-varying and the third is trends. There are two distinct
parts in this interface: the standard hyperparameters and the stochastic volatility or time-varying
specific hyperparameters.

BEAR proposes three different stochastic volatility models. The first one is the standard model.
The second one is the random inertia model where the inertia of the heteroskadasticity processes for
each variable is endogenously estimated. The final model is the simplified version for large BVAR
models.

Estimation options This part lets you set the total number of iterations run by the algorithm,
and the number of burn-in iterations. The third option allows you to operate a selection over the
values obtained during the post burn phase. If the option is selected and the value set for instance
to 20, then the results will only be retained for every one out of 20 iterations of the post burn phase.
By not retaining successive iterations, this option allows to obtain a better mixing of the posterior
distribution and thus improve the quality of the estimation. This is especially true for the Metropolis-
Hastings step that may produce repeated values from one iteration to another. This process makes
of course the estimation phase longer, so you should taylor it to suit your needs and time constraints.
Note that you do not have to modify the total or burn-in number of iterations to account for this
option. For instance, if you set the total number of iterations to 2000, and the number of burn-in
iterations to 1000, then activate the option with a value of 10, the code will run 1000 initial burn-in
iterations, then in the post burn phase run a total of 10000 iterations keeping only one out of ten,
which will result in a final 1000 post-burn iterations and a total of 2000 retained iterations when
including the burn-in phase. The final option is the possibility to use block exogeneity, similarly to
the standard BVAR model (not available for the large BVAR model due to its specific structure).

Hyperparameters This box allows you to set the hyperparameter values for your stochastic volatil-
ity BVAR model. As not all the models are using the same hyperparameter, the interface will only
activate the hyperparameters which are used by the selected model. For more details about these
hyparameters, please refer to the technical guide. If you want to estimate a model despite limited
knowledge on these hyperparameters and their interpretations, you can use the provided default
values.

17
Chapter 3 Running your project

Remarks

• 4! Warning There are two possible approaches for the random inertia model. One is the
default approach which consists in an agnostic prior for the inertia parameter γ: the prior
mean γ0 of the normal distribution is set to 0, with a very large prior variance of ζ0 = 1000 in
order to let the data speak. A second possible option is to be informative: in this case, you
should set the prior mean to be your desired value (for instance γ0 = 1 for a random walk),
and associate to it a reasonably small variance such as ζ0 = 0.01 in order to give some weight
to your prior information.

• 4! Warning The default number of iterations is 2000 total iterations, with 1000 burn-in iter-

ations. While this may suffice for simple models, in practice this number is often insufficient,
especially for the random inertia model for which convergence of the Gibbs algorithm is typically
slower. For a safe estimation, you may want to try the following values: 15000 total iterations,
including 10000 burn-in iterations, and selection of 1 draw over 10. Be aware though that this
implies a grand total of 100000 iterations for the algorithm, which will significantly increase
the estimation time.

Setting prior information for a panel VAR

If your selected model is the panel VAR, the interface that will open will look like Figure 3.4:
There are four distinct parts in this interface: the panel model, the list of units, the estimation
options, and the hyperparameters.

Panel model This box is associated with the right box "Properties". The left box allows you to
choose your panel model. BEAR includes six types of panel: an OLS mean-group estimator, a
Bayesian pooled estimator, two different random effect models, a static and a dynamic structural
factor model. The right box indicates the properties associated with the selected model. Shaded
properties do not apply, while unshaded properties apply. In the above example, the mean-group
estimator is selected, and all the properties are shaded, indicating that none of the four properties
apply for this model. For further details on the different panel models and their properties, please
refer to the technical guide.

List of units The text box is used to type the list of the units involved into estimation. The
names must correspond to those of the worksheets in the "data.xlsx" file. You do not need to enter
the names of all the unit worksheets, it is perfectly possible to work only with a subset of them.

18
Chapter 3 Running your project

Figure 3.4: Panel VAR interface

Estimation options This part lets you set the total number of iterations run by the algorithm,
and the number of burn-in iterations. The final option allows you to operate a selection over the
values obtained during the post burn phase. If the option is selected and the value say for instance
to 20, then the results will only be retained for every one out of 20 iterations of the post burn phase.
By not retaining successive iterations, this option allows to obtain a better mixing of the posterior
distribution and thus improve the quality of the estimation. While it is available for any of the last
three models, it is especially useful for the last one (the dynamic factor model). Indeed, this model
includes a Metropolis-Hastings step which can lead to repeated values over successive iterations. By
retaining only one iteration over so many, it makes sure that the algorithm will be able to obtain
a new value between any two retained draws. Note that you do not have to modify the total or
burn-in number of iterations to account for this option. For instance, if you set the total number
of iterations to 2000, and the number of burn-in iterations to 1000, then activate the option with a
value of 10, the code will run 1000 initial burn-in iterations, then in the post burn phase run a total
of 10000 iterations keeping only one out of ten, which will result in a final 1000 post-burn iterations
and a total of 2000 retained iterations when including the burn-in phase.

Hyperparameters This box allows you to set the hyperparameter values for your panel VAR

19
Chapter 3 Running your project

model. As not all the models are using the same hyperparameter, the interface will only activate the
hyperparameters which are used by the selected model. For more details about these hyparameters,
please refer to the technical guide. If you want to estimate a model despite limited knowledge on
these hyperparameters and their interpretations, you can use the provided default values.

4
! Warning the Zellner and Hong model assumes that the residual variance is common to all units

and all variables. Therefore, if you plan to use this model, you should normalise all your variables
beforehand, for instance by dividing them by their standard deviation.

4
! Warning the time-varying structural factor model is prone to produce explosive models. This is

due to the time-varying structure of the model which can easily result in unit-root behaviours. In
this respect, the key parameters are the shape parameters on residual variance (α0 ) and structural
factor variance (a0 ), and the auto-regressive coefficients of the law of motion of residual variance (γ)
and structural factors (ρ). The shape parameters are both attributed a default value of 1000, but in
case of explosiveness of the model it is possible to increase these values, say to 10000. This reduces
the prior variance on the laws of motion which favours stationary behaviours. The auto-regressive
coefficients are respectively set at 0.85 and 0.75 by default, but here also it is possible to lower the
values (for instance to 0.75 and 0.6) in order to favour stationarity.

4
! Warning The default values for α and δ (1000 and 1 respectively) are those appropriate for the
0 0

dynamic factor model. Those values are set to constraint the variance of the shocks to heteroskedas-
ticity to take minimal values. They are not appropriate however for the static factor model. For this
model, a diffuse prior should be used to let the data speak, so that the values should be set to the
usual α0 = δ0 = 0.001.

4
! Warning the final hyperparameter (ψ) is used only in the dynamic factor model. It deter-
mines the variance and thus the acceptance rate on the Metropolis-Hastings step. This acceptance
rate is reported in your estimation output, and should typically be comprised between 20% and 30%.
If it is below 20%, you should decrease the value of (ψ) in order to increase the acceptance rate, and
conversely if it is above 30% you should increase the value of (ψ) in order to decrease the acceptance
rate. For more details on the Metropolis-Hastings methodology, please refer to the technical guide.

Setting the applications for your model

The final interface will open once you validate the prior information for your model, or immediately
after the first interface if you selected the OLS VAR model. If you selected the Bayesian VAR, it
will look like 3.5:

20
Chapter 3 Running your project

Figure 3.5: Application interface

If you selected any other model, it will be similar, but may contain fewer options. This interface com-
prises four parts: application options, period options, estimation options, and confidence/credibility
levels.

Application options The BEAR toolbox allows you to run five different applications: impulse
response functions, unconditional forecasts, forecast error variance decomposition, historical decom-
position, and conditional forecasts. If you set an application on no, it will be skipped altogether by
the code and no results will be estimated. As an application relies on the Gibbs sampling algorithm,
it can prove time-consuming to run, especially with large models. If you are not interested in certain
applications, deactivating them can thus constitute an efficient way to save time.

Some applications can be shaded: this is because the toolbox does not allow you to select ap-
plications which are incompatible with your current setting. For instance, forecast error variance
decomposition and historical decomposition require a structural identification as they assume or-
thogonal disturbances. Hence they are unavailable if structural identification is set to "none", as
in the default case. Conditional forecasts can be activated only if either unconditional forecasts
is activated (in which case only the tilting methodology will be available), or if impulse response

21
Chapter 3 Running your project

functions and a structural identification are activated (in which case the standard methodology will
be available).

Period options In this part, you can set the information related to the number of periods for
which the applications have to be run. IRF periods allow you to choose the number of periods for
which you want to estimate the impulse response functions. The other three controls are related to
forecasts. Since most of the time you want to start your forecasts at the period immediately following
your final sample period, in order to obtain post-sample forecasts, the code checks by default the box
"Start forecasts after last sample period". However, it is possible to start forecasts at an earlier point
of the sample. If you want to do so, uncheck the box and enter an in-sample start date for forecasts.
Whatever your choice for the start date, you then have to provide an end date for the forecasts. The
dates have to be entered in a format that is similar to that of the Excel data spreadsheet.

Remarks

• 4! Warning If you are using any exogenous variable(s) other than the constant, you also need

to provide predicted values for these variables are they cannot be endogenously determined by
the model. See section 4.3 for details. If you do not provide such values, the code will fail.

• Forecast error variance decomposition, historical decomposition and conditional forecasts (stan-
dard methodology) all require a structural identification scheme. If you set structural identifi-
cation to "none", these applications will become unavailable.

• As the forecast error variance decomposition application uses the values obtained for impulse
response functions, the number of period is automatically the same for the two applications. If
you want to increase the number of periods for the forecast error variance decomposition then
increase the number of periods for the impulse response functions.

• 4! Warning If you are using Matlab versions prior to 2016b then it Forecast error variance
decompositions will not be plotted in matlab but are outputted in excel (unscaled).

• 4! Warning Forecasts may start before the end of the sample, however, they cannot start after

it (except for the period immediately following the sample end, which is obtained by checking
the box). If you enter a date which is after the sample end date, the code will fail.

• The forecast dates you enter will apply to both unconditional and conditional forecasts.

• While the dataset for weekly and daily data may comprise years with any number of periods,
forecast years are standardised: forecasts for weekly data will be computed assuming that any

22
Chapter 3 Running your project

post-data year comprises 52 weeks, and forecasts for daily data will assume post-data year of
261 working days

Estimation options This part determines three estimation options. The first is the type of struc-
tural identification scheme that applies to the model. This choice will affect the estimation of impulse
response functions, and thus consecutively the estimation of forecast error variance decomposition
application, historical decomposition and possibly conditional forecast (for the standard methodol-
ogy). If set to none, the model estimated is a reduced-form VAR model, and the impulse response
functions are obtained from non-orthogonalised unit shocks. If set to Choleski, triangular factori-
sation or sign/magnitude and zero restrictions, impulse response functions are obtained from the
orthogonalised shocks, in accordance with the selected scheme.

The second option is the computation of forecast evaluation criteria. You may want to set this
option to no if you are not interested in forecasts or in their evaluation, since some criteria (the log
predictive scores) require the use of a Gibbs sampler procedure and can be time-consuming. Note
that to obtain forecast evaluation criteria, there needs to be some overlap between your forecast
periods and actual data values in your Excel spreadsheet. For instance, if you run a quarterly model
and your Excel dataset ends in 2015q4 while your forecasts start in 2015q1, you will have 4 periods of
overlap to compute forecast evaluation. If there are no overlapping periods, the code will not return
an error but will signal that forecast evaluation was not possible. The forecast step ahead evaluation
determines the number of periods ahead with which to evaluate the forecast. The second box is for
a rolling window. If set to the default value of 0 then there is no rolling window but the VAR is
estimated over the whole sample. Otherwise the number of periods over which the VAR should be
estimated should be included. For example if 40 periods are selected then it will estimate first from
1971q1 to 1980q4 and then from 1971q2 to 1981q2 etc. The final box is the percent of the cumulated
forecasts from the rolling window used be used for the density forecast evaluation. This should be
between 0 and 1. See Forecast Evaluation Test guide for more details.

The third option selects the way conditional forecasts are implemented. There can be up to four
different options proposed for this exercise. The first two rely on the standard methodology using
structural shocks to generate the path of the data, while the last two use a relative entropy approach
to generate the conditions. All the methodologies require you to input additional information on
Excel: please refer to section 4.7 for details.

Confidence/credibility level Any Bayesian application results in a posterior distribution, from


which it is straightforward to obtain probability bands. The default values are 66%.

23
Chapter 3 Running your project

Running BEAR without interfaces

While graphical interfaces represent a convenient way to input your model specifications, some users
may prefer to input their information directly in a Matlab script. This avoids spending time validat-
ing every interface each time the code is reinitiated. BEAR now allows you to use such a developer’s
version to input your model information. To do so, first open the "files" folder. There is a file called
"bear_settings.m" which appear as an editable matlab files. If you double-click it, it will open like
3.6

Figure 3.6: bear_settings.m window

The correspondence between the interface entries and the script file should be clear. All what you
have to do is to modify the file to match the settings of your model, then save by pressing the save
button. You can then run the developers version by using the "bear5dev.m" file.

4
! Warning Although the developer’s version is available by default, it is recommended that you
use it only if you have a sufficient level of familiarity with Matlab and its programming language.

4
! Warning Unlike the interface, the developer’s version will not prevent the user to input in-
consistent settings. If the setting you are using is inconsistent (for instance: activating forecast error

24
Chapter 3 Running your project

variance decomposition while no structural identification is selected), no warning will be issued and
the code may either produce incorrect results or fail altogether.

25
CHAPTER 4
Setting your applications on Excel
Most applications run by BEAR rely on user-specified inputs typically organised in tables. For
this reason, Excel tables are used for those applications as they constitute a simple and efficient
solution. All the tables are gathered in the same file "data.xlsx", on different worksheets. While the
blue worksheets were all used for the data, the green and orange worksheets are dedicated to the
application tables. The green worksheets correspond to the OLS VAR, Bayesian VAR and mean-
adjusted VAR models, while the orange ones are used for the panel VAR models.

Prior values for the mean-adjusted model

If you selected the mean-adjusted model, you need to specify prior distribution values for the co-
efficients on exogenous variables before you can run the model. To do this, open the Excel file
"data.xlsx", and select the green worksheet "mean adj prior". It looks like this:

Figure 4.1: Excel sheet: mean-adjusted prior

26
Chapter 4 Setting your applications on Excel

In the table, the column B corresponds to the endogenous variables. In this example, the endogenous
variables are "DOM_GDP", "DOM_CPI" and "STN". In column C, the user can specify a trend to
the variables. A value of "1" translates into a constant, "2" is a linear trend and "3" is a quadratic
trend. In column D the user enters the prior distribution for the value of the equilibrium value or
steady-state for the corresponding endogenous variable if the trend value takes the value "1" (which
is a constant steady-state). It represents a subjective 95% confidence interval set by the user for the
value of the constant term, based on a normal distribution. The first term represents the lower bound
of the interval, and the second term represents the upper bound. Using the properties of the normal
distribution, the prior mean of the distribution is determined as the centre of the interval, while
the variance is obtained by the fact that the bounds of a 95% interval are located at 1.96 standard
deviations from the mean. This applies only to the trend value "1". The priors for the linear and
quadratic trends are automatically set using OLS estimates. In this case the trend prior may also
be left blank. In column E, the user can specify a second steady-state regime. In the example, all
variables have to regimes, the first from 1999q1 until 2008q1 and the new regime begins at 2008q2
and goes to 2014q4. The prior for the second regime has to be entered in column F (remember it is
only relevant for a constant trend - trend value "1"). In the example, a prior value for the natural
rate of interest is set to bounds of 2-5 (median 3.5 percent) in the first regime and to bounds of 0-3
(median 1.5 percent) in the second regime. Note that the regime change applies to all variables at
the same time. Currently it is not yet possible to specify different regimes for different variables!

Hence for instance the above example states that our prior belief for the log-level of US GDP follows
a quadratic trend. In addition, steady-state inflation is assumed to be 2.5 percent in regime one
and 1 percent in regime 2. A tighter interval would imply smaller prior variance and hence greater
confidence that the steady-state value corresponds to the specified prior mean, while a looser interval
would imply larger prior variance and give more weight to the data.

Setting priors for the long run

Giannone et al. (2017) show that flat-prior VARs tend to attribute an implausibly large share of the
variation in observed time series to a deterministic – and thus entirely predictable – component. They
argue that this peculiar "overfitting" behavior of the deterministic component is clearly undesirable.
Instead, one may specify priors disciplining the long-run predictions. These priors can be naturally
elicited using economic theory, which provides guidance on the joint dynamics of macroeconomic time
series in the long run. To specify such a prior, the user has to think about the long-run relationship
between the considered variables first. In our example, we take GDP, inflation and the short-term
interest rate. In this case, the user has to come up with three assumptions for the long run. For the
first variable (GDP) we simply think of a real trend, which is specified simply with a "1" on its own

27
Chapter 4 Setting your applications on Excel

equation and "0" on other the other variables. For inflation, we set a nominal trend, to impose a
relationship between interest rates and inflation. The last relationship just defines the real interest
rate which is specified as the nominal interest rate minus inflation. The relations have to be entered
in the spreadsheet "Long run priors" with "1", "-1", or "0".

Figure 4.2: Excel sheet: priors for the long run

This specification will ensure that the long-run (or steady-state) will be stationary throughout the
forecasting horizon and are not strongly afftected by the intital conditions.

Predicted exogenous (OLS VAR, Bayesian VAR, mean-adjusted BVAR and Stochastic volatility
BVAR)

If you want to produce forecasts for your model and if your model includes any exogenous variable(s)
other than the constant, you will need to provide predicted values for these variables over your fore-
cast windows. Indeed, the model is unable to produce forecast values for such variables, so that they
have to be user-specified. To do so, open the Excel file "data.xlsx", and select the green worksheet
"pred exo". It looks like this:

The sheet is self-explanatory: the first column of the table contains the dates, while the first row of
the table contains the variable names. The entries within the table correspond to the user-specified
predicted values. The table has to provide values for each exogenous variable included into your
model and every period comprised in your forecast window. The table however is flexible: it may
include more variables and cover more dates than what you use in your model. This is not a problem:

28
Chapter 4 Setting your applications on Excel

Figure 4.3: Excel sheet: predicted exogenous

29
Chapter 4 Setting your applications on Excel

the code will only select the dates and variables which are included in your model. This is useful as
it may allow you to modify the set of exogenous variables and forecast dates in the interface without
having to update your table.

Indeed, remember that BEAR allows you to specify any variable of the spreadsheet as exogenous.
In the above example, even though "OIL" will be typically the only variable used as an exogenous,
it may be useful to input predicted values for the other variables as well. This way, if you decide at
any point for instance to switch "un" from endogenous to exogenous, you will not have to modify the
spreadsheet as predicted values will already be specified. Of course, if you are certain that you will
only ever use "OIL" as an exogenous, you may just delete the other columns. For similar reasons,
the forecast window in the example is very large in terms of dates. This permits to change freely the
start or end date for the forecasts without having to update the table.

While the specification of predicted exogenous may look like a constraint, it can also constitute
a powerful tool for scenario analysis. First, note that if your forecasts overlap (at least partly) with
your dataset, you may just use actual values for your predicted exogenous. This is the case in the
above example: since actual values are available for the period 2014q1-2015q3, they are used as
predictions. You may then compare the results obtained when using actual values with the ones
you would obtain by using an alternative scenario. For instance, assume you run a forecast exercise
over the period 2014q1-2015q1, with "OIL" as only exogenous. You may first obtain forecast using
the actual values, and then compare the results with a scenario where "OIL" would have instead
decreased to 94 over the same period. In this sense, predicted exogenous represent a useful tool for
conditional forecasting.

In general, if you do not have actual values to use for your predictions, the following strategies
are possible: you can specify your own values, which is then again a form of scenario analysis; or
you can replicate the last known value, which represents an agnostic approach; or you can obtain
forecasts for each exogenous considered on its own and use those forecasts values for your predictions.
The last option can be implemented easily: simply use the OLS VAR option of BEAR to estimate
a VAR model for each exogenous independently (which then reduces to estimating individual AR
models) and produce forecasts for these models.

Grid search (Bayesian VAR)

If you want to run a Bayesian VAR model, you have the possibility to optimise your hyperparameters
by using a grid search. To do so, you need to select the option in the Bayesian VAR interface, and
then to specify the values of your grid on Excel. To do this, open the Excel file "data.xlsx", and

30
Chapter 4 Setting your applications on Excel

select the green worksheet "grid". It looks like this:

Figure 4.4: Excel sheet: grid search

The grid search works as follows. For each hyperparameter, the code first defines the grid by cre-
ating a range of values, starting from the minimum value and then incrementing sequentially this
value by the step size until the maximum value is reached. Then it estimates the model for every
possible combination of values, and for each model calculates the marginal likelihood. The optimal
hyperparameter combination is then determined as the one which maximises this value.

What you have to do is thus set the minimum value, maximum value and step size for each pa-
rameter in the grid. You can use the default values provided for the grid if you are not sure about
which values you should test. In general larger ranges and smaller step sizes will result in a finer
grid but are more time-consuming to run. Some values of the grid may not be actually used during
the search: if your model uses the normal-Wishart prior, the cross-variable weighting λ2 does not

31
Chapter 4 Setting your applications on Excel

enter into the estimation process and hence this part of the grid will be ignored. Similarly, λ6 and
λ7 are related to the sum-of-coefficients and dummy initial observation applications, so these parts
of the grid will be ignored if these application are not selected. Note that you do not need to clear
the contents of the cells that will not be used as the code will simply skip them.

4
! Warning Grid search can be very time-consuming!

4
! Warning The code is designed to read the table as it is found in your Excel sheet. Do not
delete nor move any row or columns in the sheet (though you may clear the side text if you wish).
Doing so would prevent the code to run properly.

Block exogeneity (Bayesian VAR, mean-adjusted BVAR and stochastic volatility BVAR)

If you run a Bayesian VAR model or mean-adjusted BVAR model, you can implement block exo-
geneity to create partial exogeneity within your set of endogenous variables. To do so, you need to
indicate in an Excel table which variable of your endogenous set should have no impact on which
other. Open the Excel file "data.xlsx", and select the green worksheet "grid". It looks like this:

32
Chapter 4 Setting your applications on Excel

Figure 4.5: Excel sheet: block exogeneity

The first row and the first column of the tables contain the labels for the variables in your dataset.
To implement the fact that variable j will have no effect on variable i, enter a 1 in row i, column j
of the table. In the above example, there is a 1 in row 1, column 2 of the table which indicates that
variable 2 (DOM_CPI, or domestic CPI) will have no effect on variable 1 (DOM_GDP or domestic
GDP). Similarly, the 1 value in row 2, column 3 indicates that variable 3 (STN for short term nominal
interest rate) will have no effect on variable 2 (DOM_CPI for domestic CPI).

4
! Warning This is the opposite way to previous versions, but is consistent with the rest of BEAR!

In this example, the table contains all the variables of the example dataset. This includes "OIL"
which will be typically used as an exogenous variable, even though block exogeneity is only con-
cerned with endogenous variables. This is because BEAR allows you to switch "OIL" to endogenous
at any point, so including it into the table avoids to update the table later on. In general, you can
build your table with just as many variables as you want from your dataset. Variables that are
irrelevant for the application of block exogeneity for your model will simply be ignored.

Sign restrictions (Bayesian VAR, mean-adjusted BVAR and stochastic volatility BVAR)

The BEAR toolbox allows you to implement the structural identification scheme by sign and zero
restrictions proposed by Arias et al. (2014). The methodology has been extended to also allow for
magnitude restrictions. For more details on the methodology, please refer to the technical guide.

33
Chapter 4 Setting your applications on Excel

Setting your restrictions is done by the way of two Excel tables. Open the Excel file "data.xlsx", and
select the green worksheets "sign res values" and "sign res periods". The tables look like this:

Figure 4.6: Excel sheet: sign restrictions

The first sheet ("sign res values") is dedicated to the restrictions. The rows correspond to your
variables, while the columns correspond to the associated structural shocks. So for instance the " -
" entry in row 1 (DOM_GDP), column 2 (DOM_CPI) of the table corresponds to a restriction on
the impulse response functions of DOM_GDP to the structural shock associated to DOM_CPI.

There are three possible types of restrictions: - sign restrictions: restricts the impulse response
functions to be positive or negative. For a positive restriction, enter a "+" in the corresponding
entry, for a negative restriction enter a "-" in the corresponding entry. An example can be found in
row 1, column 1 of the table. - zero restrictions: restricts the impulse response functions to take a
value of zero (no response). Enter a "0" in the corresponding entry. An example can be found in
row 2, column 1 of the table. - magnitude restrictions: restricts the impulse response functions to be

34
Chapter 4 Setting your applications on Excel

Figure 4.7: Excel sheet: restriction periods

35
Chapter 4 Setting your applications on Excel

comprised between a given range of values. Enter the range as two numbers separated by a space,
such as "1 2". An example can be found in row 1, column 2. Note that your range cannot be made
of a repeated number, for instance "1 1" will lead the code to fail.

For technical reasons there exists a limitation on the number of zero restrictions you may imple-
ment on each variable. For a model with n variables, there should be a most (n − j) zero restrictions
associated with shock j. That is, there should be at most (n − j) zero entries in column j of the table,
if the table only contains the variables of your model (and not the other variables of your dataset).
For this reason, it is recommended that you include only the variables of your model for sign restric-
tion tables, even though you may include other variables of the dataset if you manage correctly your
zero restrictions. In the above example, the model only contains two variables (so n=2), and there
is one zero restriction in column j = 1 of the table. As n − j = 1, this sign restriction setting will be
properly identified.

If your sign restrictions don’t satisfy this requirement, there may still be solutions to solve your
problem. Unlike Choleski identification schemes where the order of the variables matters, the or-
der is irrelevant for sign restriction identification. For instance, you may have a model with a zero
sign restriction on the last column while this column can contain at most n − j = 0 restrictions.
In this case it suffices however to switch the ordering of the variables to obtain a well identified setting.

The second sheet is used to indicate the periods at which the restrictions apply. Periods have
to be specified for each restriction created in the first sheet in the corresponding table entry of the
second sheet. The periods are defined as a range written as two number separated by a space, the first
number being the initial period of application of the restriction, the second being the final period of
applications, for instance "1 3". Note that the first period of the impulse response functions (impact)
is defined as 0. Hence for example a quarterly model, the periods for a restriction that applies over
the first four quarters will have to be written as "0 3" (implying a restriction over periods 0, 1, 2 and
3). To specify a restriction that applies to a single period, simply repeat the value. For instance, "0
0" denotes a restriction that applies only at impact. Of course different restrictions may be defined
over different periods, as should be clear from the example table.

There is an additional element in this sheet: row 3 of the sheet allows you to create your labels
for the structural shocks you are identifying. If you enter names for your structural shocks, these
names will be used in any plot involving the shocks, for instance the impulse response functions:

If for some of the shocks no name is entered, say for instance here the second shock, then the label

36
Chapter 4 Setting your applications on Excel

Figure 4.8: Shock labels on applications

37
Chapter 4 Setting your applications on Excel

on the plot will simply be "shock 2".

4
! Warning In general, you should avoid implementing too many restrictions, or restrictions that

are too much at odds with your unrestricted results. Doing so will typically result in a very low rate
of acceptance of the draws for the algorithm, leading either in extremely long estimation time or
to complete failure of the algorithm. You may also question the economic relevance of restrictions
associated with an extremely low acceptance rate.

4
! Warning Sign, magnitude and zero restrictions have to be defined carefully by the user. It is
indeed possible that the setting you implement is economically irrelevant: if several different shocks
end up having the same effect on the variables of your model, it is not possible to disentangle them
and your setting is not correctly identified. The program will yet run irrespectively of your scheme
and will not issue any warning. It is thus your responsibility to define your restrictions properly.

4
! Warning The code is designed to work with the sheets as they are formatted. While the ta-
bles should be modified to suit your model, the iterations and label options found in the first four
rows of the two sheets should not be deleted or displaced. Doing so would result in the code to fail.

Conditional forecasts (Bayesian VAR, mean-adjusted BVAR and stochastic volatility BVAR)

Conditional forecasts constitute a great tool to study scenario analysis. This methodology makes
it possible to answer questions like: "what will happen to the Euro area GDP growth rate if the
short term interest rate is set at the 0% lower bound for the next eight quarters?", or "what will
happen to the unemployment rate in the euro area if GDP growth stabilizes at a modest 1% over
the next four quarters?". The approach is powerful and flexible, but is a bit more advanced than the
previous applications, and requires some care, for otherwise meaningless results may be obtained, or
the technique may fail altogether.

The BEAR toolbox allows you to use two main conditional forecast methodologies, each of them
allowing for two declinations. The presentation starts with standard methodology, based on shocks.

Standard methodology (all shocks)

If you opt for the standard methodology (all shocks), all what you have to do is to fill an Excel
spreadsheet specifying the path for your variables. Open the Excel file "data.xlsx", and select the
green worksheet "conditions". The table looks like this:
The above example is once again based on the euro area model comprising GDP, CPI and the short

38
Chapter 4 Setting your applications on Excel

Figure 4.9: Excel sheet: conditions

39
Chapter 4 Setting your applications on Excel

term interest rate. Let us assume thus that those three variables enter into the model, that the sam-
ple period covers the full dataset (1971q1-2014q4), while the forecasts cover the period 2014q1-2016q4.

To make things clearer, let us state some definitions. A condition is simply a value that a vari-
able is imposed to take at a given period by the user (hence the name conditional forecasts). For
instance in this example the conditions over the forecast periods are that GDP is set to the actual
realizations for the three periods 2014q1 till 2014q4, then should stay at 9.692% until 2015q4; CPI on
the other hand is left unrestricted. The short term interest rate, STN, is set to 0.5% from 2015q1 till
2016q4. This represents a total of 16 conditions. In general, to create a condition, simply type the
condition value for the corresponding variable at the desired period. Variables to which no conditions
apply will simply remain blank.

As you can see, at any period there can be several simultaneous conditions. There can actually
be any number of conditions for any given period, ranging from no condition at all to one condition
for each variable. The only constraint is that there should not be a condition on each variable at
each forecast period. This would cause the code to fail.

You may also notice that the number of periods included into the sheet is larger than the fore-
cast window. This is not a problem as the code only selects periods which enter your forecast
periods. As for unconditional forecasts, there is no issue either in starting your forecast prior to the
end of the sample. The same logic holds for the number of variables comprised in your sheets: you
may well include into this sheet all the variables of your dataset, and then run a conditional forecast
exercise for a model which only comprises a subset of them. Here again, the code would select only
the relevant variables. For instance, the above table could be used for a model only comprising
"DOM_GDP" and "DOM_CPI" as endogenous variables.

Note finally that you cannot use the conditional forecast methodology to implement conditions on
your exogenous variables. To do so, you may however use the predicted exogenous feature of the
toolbox (see section 4.3 for details).

4
! Warning The "all shocks" methodology should not be interpreted as a "neutral" or "agnostic"
view on conditional forecasts. The fact that you are including all the shocks to generate the forecasts
does not mean that it is left to the model to determine what will be the respective contributions
of each shock in the forecast. On the contrary, using the all shocks methodology implies that you
are certain that every shocks will effectively contribute to generate the conditions, which represents
a very strong and informative assumption. Blindly using this methodology may lead to irrelevant

40
Chapter 4 Setting your applications on Excel

results. Always verify that it reasonable to assume that all the shocks are generating your condi-
tions, and always verify that your results make sense. In most cases, it may be preferable to use the
shock-specific methodology.

Standard methodology (shock-specific)

While the "all shocks" approach proves simple and appealing, it is often too restrictive. One may
indeed want to run conditional forecast exercises where only a subset of shocks generate the specified
conditions. For instance, to run a conditional forecast exercise where the monetary authorities raise
the interest rate to 3%, one may typically want this condition to be generated only by monetary
policy shocks, and not by real GDP or inflation shocks. In this case, the "shock-specific" approach
should be adopted.

While the BEAR toolbox intends to make this approach as easy as possible to use, it remains
more sophisticated than the "all shocks" approach and will probably require some extra effort to be
properly used. To implement the shock-specific methodology, you will need three Excel worksheets:
the green worksheet "conditions" that was already used for the all shocks methodology, and the ad-
ditional "shocks" and "blocks" sheets. The "conditions" sheet is shown again for convenience.

The other two sheets look like 4.11.


The first step to use the shock-specific methodology consists in specifying your conditions by the
way of the "conditions" sheet. This is done similarly to the "all shocks" methodology, and is hence
not developed further (please refer to subsection 4.7.1 in case your need more details).

The second step consists in specifying the shocks generating the different conditions. To do so,
simply enter in the table of the "shocks" sheet a list of shocks for each corresponding condition. If
several shocks are used to generate a condition, use a space to separate each shock in the list. To
make this point more concrete, consider the "shocks" sheet for the forecast periods 2014q1-2016q4,
and consider first the variable DOM_GDP. The above example is designed so that the conditions
on DOM_GDP are generated by the first shock over 2014q1-2014q4, then jointly by shocks 1 and
3 for 2015q1-2015q2, then again by shock 1 only for 2015q3-2015q4. Considering now the variable
STN, its conditions are generated by shocks 1 and 3 jointly for 2015q1-2015q4, then by shock 3
for 2016q1-2016q4. As you can see, a condition can indifferently be generated by a single shock or
by several shocks, possibly even all the shocks in your model. Also, the conditions applying to a
variable need not to be generated by the same shocks for different periods, as is hopefully clear from
the example. Finally, if at a given period conditions apply to several variables, those conditions can
be generated either by the same shocks (as for 2015q1-2015q2), or by mutually exclusive shocks.

41
Chapter 4 Setting your applications on Excel

Figure 4.10: Excel sheet: conditions

42
Chapter 4 Setting your applications on Excel

Figure 4.11: Excel sheet: shocks

43
Chapter 4 Setting your applications on Excel

Figure 4.12: Excel sheet: blocks

44
Chapter 4 Setting your applications on Excel

The final worksheet that you will have to fill is the "blocks" sheet. To understand the implica-
tions of this sheet, it is useful to state first some definitions. For a given period, a block of variable is
a set of variables on which a condition is defined, and for which the conditions are generated by the
same shocks. For a given period, a shock is said to be constructive for a block if is used to generate
the conditions of the variables of this block. A shock which is not constructive for any block is said
to be non-constructive.

To make this more concrete, consider again the above example, period by period. The forecasts
start in 2014q1. For this period, there is only one condition set on the variable DOM_GDP, and it is
generated by shock 1. Because DOM_GDP is the only variable with a condition on it, it constitutes
the only block for this period and is defined as block 1. The shock used for the condition (shock 1)
is thus a constructive shock for block 1. Shock 2 and 3 don’t generate any condition and are thus
non-constructive shocks for this period. The same holds for 2014q2 through to 2014q4.

In 2015q1, there are now two conditions: one on DOM_GDP, and one on STN. Note that these
two conditions are generated by the same shocks: both are generated by shocks 1 and 3, they thus
constitute a single block which is block 1. Because shocks 1 and 3 are used to generate the conditions,
they are constructive shocks for block 1. Shock 2 is not used to generate any condition at this period
and is thus non-constructive. The same holds for 2015q2.

In 2015q3, there are again two conditions: one on DOM_GDP, and one on STN. Now however
they are generated by different shocks: the condition on DOM_GDP is generated by shock 1, while
the condition on STN is generated by shocks 1 and 3. DOM_GDP and STN thus constitute different
blocks. DOM_GDP is here defined as block 1 and STN as block 2, but, as will become clear shortly,
the order could have been inverted. Shock 1 is thus constructive for block 1, and shocks 2 and 3
are constructive for block 2. There is no non-constrictive shock for this period. The same holds for
2016q2.

In 2016q3, there is only one condition on STN: it constitutes the only block for the period (block 1),
and the constructive shock for this block is shock 2. Shocks 1 and 3 are thus non-constructive. The
same holds for 2016q4.

You can see that the "blocks" sheet contains the information that was established over the example.
For a given period and each variable with a condition on it, simply type the number of the block to
which it belongs in the corresponding cell. It is important to understand that the definition of the

45
Chapter 4 Setting your applications on Excel

different blocks for a given period is left to the user: it is up to you to decide which block will be
block 1, block 2, and so on. For instance in the above example, considering period 2016q1, it would
have been possible to define STN as block 1 and DOM_GDP as block 2.

You may wonder what can be the possible consequences of choosing a given ordering for the blocks
rather than another. The answer is related to the functioning of the algorithm drawing the shocks for
the conditional forecasts. The algorithm works as follows: for each forecast period, the algorithm first
draws the non-constructive shocks from their unrestricted distribution; then it draws the constructive
shocks for block 1, conditional on the non-constructive shocks; then it draws the constructive shocks
for block 2, conditional on the non-constructive shocks and the constructive shocks for block 1, and
so on. The ordering of the different blocks hence matters as it determines conditional on which other
shocks the shocks of a given block will have to be drawn. This may affect the final results. For
this reason, it is recommended that you define the ordering of your blocks by economic importance
of the variables constituting them: variables that in your opinion dominate the economic activity
should come first in the block ordering, variables of second importance should enter the ordering last.

4
! Warning It should be emphasized that the definition of blocks is a period-by-period exercise,
so do not blindly replicate a block number for a given variable over several forecast periods, or you
may well trigger an error.

4
! Warning Ideally, the shock-specific application would work smoothly for any set of conditions,

shocks and blocks. It turns out that this is not always the case. The above example would work,
but not every setting will. This is related to technical aspects of the estimation involving the struc-
tural identification scheme and its impacts on the different blocks of the model. For very detailed
information, you are highly encouraged to read the technical guide along with the appendix. For
more basic information about what will cause a conditional forecast setting to succeed or fail, a few
guidelines are now provided, without justification. Necessary conditions If these conditions are not
met, conditional forecasts identification will always fail. These conditions however do not guarantee
that the scheme will work, but only that it will not work if they are not satisfied.
• a block should have at least as many shocks as variables.
example: a block with rgdp and inf for which the condition is generated by DOM_GDP shock
only will fail. The same block with DOM_GDP and STN as constructive shocks satisfies the
condition.

• different blocks should be generated by different shocks.


example: block 1 made of DOM_GDP with DOM_GDP as constructive shock, and block
2 made of STN and DOM_CPI with DOM_GDP and STN as constructive shock will fail.

46
Chapter 4 Setting your applications on Excel

The same setting with block 2 having STN and DOM_CPI as constructive shocks satisfies the
conditions.

• if the identification scheme is Choleski or triangular factorisation, the conditions for a given
block should be generated only by shocks of their own variables, or by shocks of variables
preceding them in the variable ordering.
example: assume the ordering of the variables is: DOM_GDP, DOM_CPI and STN, plus other
additional variables in the model coming later on the ordering. The structural identification is
Choleski. Assume that block 1 is made of DOM_CPI and STN (variables 2 and 3). If their
constructive shocks are shocks 5 and 6, the setting will fail. If the constructive shocks are 3
and 4, it will fail as well: no shock at all should be posterior. If the constructive shocks are 2
and 3, the setting will work, and so will it if the constructive shocks are 1 and 2, or 1 and 3.

Sufficient conditions If these conditions hold, the setting will always produce well identified condi-
tional forecasts. If you are uncertain of what you are doing, it is recommended that you follow these
conditions.

• the structural identification scheme is Choleski or triangular factorisation. There is only one
block, for which the conditions are generated by their own shocks.
Example: there is only one block, which is made of DOM_GDP and DOM_CPI, and the
constructive shocks are 1 and 3.

• the structural identification scheme is sign restrictions, and there is only one block.
Example: the only block is made of DOM_CPI and STN.

• the structural identification scheme is Choleski or triangular factorisation. There are several
blocks, but for all blocks, the constructive shocks are that of the variables included in the block.
The block are defined from left to right with respect to the variable ordering.
Example: the structural identification scheme is Choleski. There are two blocks. One is made
of DOM_GDP and the constructive shock is 1, the other block is made of DOM_CPI and
STN and the constructive shocks are 2 and 3. Then if DOM_GDP constitutes block 1 and
DOM_CPI and STN constitute block 2, conditional forecasts are always identified.

Tilting methodology (median)

An alternative to the standard methodology for conditional forecasts is the so-called tilting method-
ology. Unlike the standard methodology, the tilting approach does not rely on structural shocks to
generate the condition and is thus agnostic in terms of economic theory. This represents a consid-
erable asset if you have no preconceived idea about the origin of the condition. Another advantage

47
Chapter 4 Setting your applications on Excel

of the tilting methodology over the standard approach is that it is a "soft" forecast methodology:
while the conditions with the standard methodology always hold exactly, the tilting methodology
allows for some variability around your conditions. Even better, if you use the "interval" methodol-
ogy, you can specify yourself the variability around the conditions. Tight bands can thus be used
to reflect a high level of confidence around the conditions, while loose bands reflect larger uncertainty.

The idea of the tilting methodology is that a conditional forecast could be interpreted as a nor-
mal forecast to which new information (the conditions) would have been integrated. The tilting
procedure thus consists in starting from the posterior distribution of the unconditional forecast, then
in modifying this distribution to satisfy the conditions while keeping it as close as possible to the
original distribution. For this reason, the tilting methodology requires the unconditional forecast
application and will thus be deactivated if unconditional forecasts are not selected.

The BEAR toolbox implements the tilting application by defining quantiles of the posterior dis-
tribution. In the basic form of the application, the only quantile that you will define is the median of
the posterior distribution, that is, the values for your conditions. To do so, you only need to specify
your conditions values in the green Excel worksheet "conditions". The procedure is similar to that of
the standard methodology (all shocks) and is not developed further: please refer to subsection 4.7.1
for details. No other sheet is required.

The tilting methodology is appealing in many aspects, but it also has its own limitations, which
are mainly related to the technical aspects of the procedure implemented to compute the conditional
forecasts.

The first limitation has to do with the support of the forecast distribution. As mentioned previ-
ously, the tilting procedure starts from the posterior distribution of the unconditional forecasts, and
then modifies this distribution to match the conditions. While the procedure can reshape the distri-
bution, it cannot change its support, that is, the range of possible values covered by the distribution.
For this reason, you cannot implement as conditions values which do not appear in the support
of the unconditional distribution. Roughly speaking, it means that your conditions must be "close
enough" to the unconditional values for the algorithm to work. They must in any case be comprised
in the support, and for a safer procedure be actually fairly close to the point estimate. To make
this point more concrete, let us consider the usual example model with DOM_GDP, DOM_CPI and
STN as variables. The following plot shows the forecasts obtained for STN over the forecast period
2015q1-2016q4 with a Minnesota prior:

48
Chapter 4 Setting your applications on Excel

Figure 4.13: Tilting example

The top panel represents the unconditional forecasts, while the lower panel represents the condi-
tional forecasts obtained from the tilting methodology. Look first at the top panel, and consider the
first forecast period 2015q1: the point estimate is around 0.0, the lower bound of the 95% credibility
interval is somewhere around -5, and the upper bound of about 5. Because the size of the credibility
interval is 95%, it is reasonable to assume that values outside the interval are essentially extreme
values that we may ignore. In order to use the tilting methodology to obtain conditional forecast for
this period, the specified condition should be comprised between -5 and 5, and ideally closer to the
point estimate value of 0.0. In the example Excel file the condition for this period is set at 0.5, which
constitutes a suitable candidate. As can been seen from the lower panel, the tilting methodology
successfully implemented the condition.

For the subsequent forecast periods, the unconditional forecasts become pretty much stable with
point estimates at about 0.3. Because the support is getting a bit larger, you can choose conditions
which are located a bit further away from the point estimate. In general, if you plan to use the
tilting methodology, your methodology should thus go as follows: estimate first your model, select
the unconditional forecasts but not (yet) the conditional forecasts. Use the plots of the unconditional
forecasts to establish roughly what the support of the unconditional forecast distribution is, for each
variables and each period of interest. Establish then a set of conditions which are compatible with
these values. Eventually estimate the conditional forecast with the tilting methodology.

49
Chapter 4 Setting your applications on Excel

Beyond this first limitation, there exists second limitation related to the number of conditions that
the tilting methodology is able to handle. To obtain the conditional forecasts, the algorithm imple-
ments a numerical optimisation procedure, and this optimisation step will typically fail if there are
too many conditions. Concretely, this will result in the code producing conditional forecasts where
the conditions do not actually hold. In general, a dozen restrictions is pretty much the maximum
that the methodology can handle. In the above example there are a total of 12 restrictions over the
whole forecast periods and all the endogenous variables. As the lower panel shows, the code managed
to produce successful conditional forecasts for STN (the conditional forecasts for inf are not displayed
but were also correctly identified). This is probably the maximum number of conditions that the
methodology would support.

A final technical remark applies, which is not a limitation of the procedure but rather a method-
ological precision: in order to obtain accurate results, the tilting procedure typically requires more
iterations than the standard methodology. While for the standard methodology 1000 post-burn iter-
ations are usually sufficient, tilting would rather requires around 5000 post-burn iterations. With a
lower number of iterations, your results may look imprecise. This implies that the tilting methodology
will be significantly more time-consuming than the standard methodology.

Tilting methodology (intervals)

In its advanced form, the tilting methodology allows you to define not only the median (point esti-
mate) of the conditional forecasts, but also the upper and lower bounds of the credibility intervals
around the median value. This way, the methodology can be used to reflect the degree of confidence
you have for your conditions: loose bands around the conditions reflect low confidence, tight bands
reflect higher confidence.

To use the intervals methodology, you will need to use two Excel sheets. The first is the "condi-
tions" sheet. On this sheet, you have to enter your conditions: the procedure is once again similar to
the standard methodology (all shocks) and is not developed further: please refer to subsection 4.7.1
for details. The second sheet is the green sheet "intervals". It looks like 4.14
The correspondence with the "conditions" sheet is straightforward: to each condition in the "con-
ditions" sheet corresponds an interval in the "intervals" sheet. Intervals have to be specified as two
numbers separated by a space, the first number representing the lower bound, the second number
representing the upper bound. The median specified in "conditions" has to be comprised these two
values. On the example sheet similar conditions are associated with similar intervals, but this is not
mandatory.

50
Chapter 4 Setting your applications on Excel

Figure 4.14: Excel sheet: intervals

51
Chapter 4 Setting your applications on Excel

The technical limitations applying to the median case also apply to the intervals methodology. First,
the values specified for the bounds of the intervals should not be too far away from the bounds of
the unconditional forecasts (in any direction). Second, the total number of restrictions should still
be restricted to a dozen. In the intervals setting, each element (median, lower bound and upper
bound) counts as one condition. Therefore each triplet median/lower bound/upper bound creates 3
restrictions, meaning that 4-5 triplets of restrictions is the maximum you can afford for the code to
work properly. In the above example for instance, with the forecast dates set to 2015q1-2016q4, the
Excel spreadsheets imply 36 conditions. This tends to be too many for the code to succeed and the
algorithm would fail. To run the exercise successfully, one possibility would be either to leave the
sheet as it is but reduce the forecast window (for instance set it to 2015q1-2015q3 to retain only 12
conditions), or to keep the forecast windows as it is but clear conditions from the sheet until only a
dozen or so remains. For instance, if one modifies the "conditions" and "intervals" sheets as follows:

Then the number of restrictions becomes 12 over the 2015q1-2016q4 period, and the exercise can be
successfully run, producing the following results for STN:

Predicted exogenous (panel BVAR)

If you want to produce forecasts for a panel BVAR model and if your model includes any exogenous
variable(s) other than the constant, you will need to provide predicted values for these variables over
your forecast windows. To do so, open the Excel file "data.xlsx", and select the orange worksheet
"pan pred exo". The table looks like this:

52
Chapter 4 Setting your applications on Excel

Figure 4.15: Excel sheet: modified conditions and intervals

53
Chapter 4 Setting your applications on Excel

Figure 4.16: conditional forecast with tilting (median and intervals)

Figure 4.17: Excel sheet/ predicted exogenous (panel)

The procedure is similar to that of the standard BVAR model, and is hence not developed further:
please refer to section 4.3 for details. Note nevertheless that in the above sheet, the only variable

54
Chapter 4 Setting your applications on Excel

which is present is "TREND": this is because unlike a standard BVAR model, a panel VAR requires
you to plan in advance which variable will be endogenous and which variable will be exogenous (you
may refer to section 2.4 for details). Hence the sheet here only includes the single planned exogenous
variable, and omits the endogenous variables. Note that including the endogenous variables would
be harmless: the code would only select the relevant exogenous variables. It is however good practice
to restrict your sheet to the set of planned exogenous in order to avoid confusion.

Conditional forecasts (panel BVAR)

The BEAR toolbox allows you to use conditional forecasts with all Bayesian panel VAR models, but
this excludes the OLS mean-group estimator model. Note that the panel framework only allows you
to use the standard methodology, either "all shocks" or "shock-specific". The procedure to follow
depends on your choice of methodology.

Standard methodology (all shocks)

If you choose the "all shocks" methodology, you will only have to specify your conditions on Excel.
To do so, open the Excel file "data.xlsx", and select the orange worksheet "pan conditions". It looks
like this:

The principle is the same as for a traditional Bayesian VAR model. The rows contain the dates:
the number of periods you are including can be larger than your forecast window but must at least
include it fully. The columns correspond to the endogenous variables of your models. There is a slight
adaption compared to the standard Bayesian VAR model: because a panel models replicates the same
endogenous variables over different units, you have to specify to which unit relates to each occurrence
of your endogenous. For this reason, the label of each column has to be specified as: "unit name"
then "_" (without space before or after) and finally "endogenous name". For instance to specify the
endogenous variable DOM_GDP for the unit US, the label must be entered as "US_DOM_GDP".
Any other format will not be recognised by the code and return an error. You may as usual fill the
table with more endogenous variables and units than used in your model, the code is designed to
identify and select only the relevant components.

To implement a condition, simply enter a condition value for the corresponding date, unit and
variables. Cells left blank imply no condition. Note that there exists a difference of interpretation
of the table depending on the type of panel model you are estimating. If you are using the Bayesian
pooled estimator, or the random effect models (Zellner and Hong or hierarchical), you end up with
one VAR model applied separately to every unit. This means that the conditions you are specifying

55
Chapter 4 Setting your applications on Excel

Figure 4.18: Excel sheet: conditions (panel)

56
Chapter 4 Setting your applications on Excel

will be considered separately from one unit to another, so that the conditions for one unit will have
no impact on the conditional forecasts of the other units. If for some units you don’t specify any
conditions, the code will simply ignore this unit for the conditional forecast exercise. On the other
hand, if you use a factor model (static or dynamic), you will end up with a single large VAR in which
all units are interacting. This means that the conditions you specify for any unit will affect all the
other units, even if no condition is specified on them. While this difference has no implications in the
way the conditions are set on Excel, you should be aware of it as it will significantly affect your results.

To make this point more concrete, consider an example applying to the above spreadsheet: a panel
BVAR involving three units: US, EA and UK. Each unit involves the three endogenous variables
DOM_GDP, DOM_CPI and STN. Let us assume first that you estimate a random effect model
(Zellner and Hong). With this methodology, a separate VAR is estimated for each unit. This means
that the estimation process will result in three independent VAR models for US, EA and UK, so
that the conditional forecasts setting has to be considered for the three units separately. For the
unit US, there are conditions on DOM_GDP and DOM_CPI. These conditions will have an impact
on the other variable of US which is the variable STN. However, they will not have any effect on
the other two units EA and UK. The case is similar for the conditions on EA. As for the unit US,
it does not have any condition: the code will hence skip it in the conditional forecast exercise. Let
us now assume that a static factor model is estimated. With this methodology, a single VAR model
is estimated comprising all the variables of all the units. In the above example, one obtains a large
VAR model with 9 variables (the three endogenous variables DOM_GDP, DOM_CPI and STN for
the three units US, EA and UK). The units cannot be considered separately anymore: the conditions
on DOM_GDP for US for instance will now affect all the other variables in the VAR, even those of
the unit EA on which no conditions are defined.

Standard methodology (shock-specific)

The panel BVAR framework also lets use the shock-specific methodology for your conditional fore-
casts. The methodology is similar to that of the standard Bayesian VAR: you need to specify the
conditions, shocks and blocks for your conditional forecast exercise. To do so, three Excel worksheets
are used: the "pan conditions" orange worksheet, already used for the "all shocks" methodology, the
"pan shocks" orange sheet, used to input your shocks, and the "pan blocks" orange sheet, used to
define your blocks. The definition of conditions, shocks and blocks is similar to that of the standard
BVAR and is not developed further: please refer to subsection 4.7.1 and subsection 4.7.2 for details.

A point should be emphasized: the way you fill the "pan shocks" and "pan blocks" sheets will differ,
depending on whether your choice of model results in separate VAR models (Bayesian pooled esti-

57
Chapter 4 Setting your applications on Excel

mator, random effect models) or in a single large VAR model where all the units interract(static or
dynamic factor model). Hence, unlike the "all shocks" methodology for which the distinction only
applied in terms of interpretation, here it will results in differences in the writing of your spreadsheets.

Assume first that you want to estimate a Bayesian pooled estimator, or any of the random ef-
fect models (Zellner and Hong or hierarchical). Consider again the case of a panel BVAR with the
three units US, EA and UK, and for each unit the three endogenous DOM_GDP, DOM_CPI and
STN. There is no difference with the "all shocks" methodology in the way you specify your conditions,
using the spreadsheet "pan conditions". Please refer to subsection 4.9.1 for details. To specify your
shocks, you need to use the worksheet "pan shocks". It looks like this:

58
Chapter 4 Setting your applications on Excel

Figure 4.19: Excel sheet: shocks (panel)

The principle behind the specification of your sheet is the following: because the random effect model
produces separate VAR models for each unit, you have to consider an independent model and hence
an independent conditional forecast exercise for each of your units. In the considered example there
are 3 units (US, EA, and UK) and 3 variables (DOM_GDP, DOM_CPI and STN) considered sep-
arately for each unit. This implies that each unit is characterised by 3 structural shocks applying
only to themsleves. In the above sheet for instance the conditions on US_DOM_CPI are generated
by shock 2: this actually means shock 2 of its own unit, that is, the unit US. The conditions on
UK_DOM_CPI are also generated by shock 2: this has also to be interpreted as shock 2 of its own
unit, which thus means shock 2 of unit UK. Hence, also all the units are gathered in a single sheet,
you really have to fill the sheet as if you were specifying separated VAR models.

Let us now assume you want to estimate any of the factor models (static or dynamic). With such a

59
Chapter 4 Setting your applications on Excel

model you are now obtaining a single VAR model where all the units are interacting. Rather than
considering your units separately, you need to consider them jointly. In the above example with US,
EA and UK as units and DOM_GDP, DOM_CPI and STN as variables, you obtain a large VAR
with 9 variables: DOM_GDP, DOM_CPI and STN for US, DOM_GDP, DOM_CPI and STN for
EA, and DOM_GDP, DOM_CPI and STN for UK. This implies 9 corresponding structural shocks.
The above table is then not valid anymore. Consider for instance the conditions on UK_DOM_GDP.
The above table specified them as being generated by "shock 1", which actually designates the struc-
tural shock associated to the first variable (DOM_GDP) of UK, which in the new model is actually
shock 7. To be consistent with the new model, the table should be rewritten as follows:

Figure 4.20: modified Excel shock sheet for factor model

Note that it is not mandatory for the conditions of a given unit to be generated by their own shocks.
In the above example, it could be possible to specify the conditions on UK_DOM_GDP to be gen-
erated by the shocks on EA_DOM_GDP, for instance. In this case, the shock to specify would be

60
Chapter 4 Setting your applications on Excel

4 and not 7.

The same logic applies to blocks. The "pan blocks" worksheet looks like this:

Figure 4.21: Excel sheet: blocks (panel)

As it is, the sheet is suitable for the Bayesian pooled estimator, or any of the random effect models
(Zellner and Hong or hierarchical). It considers the units separately, assuming one VAR per unit. If
you consider for instance the period 2015q4, the condition on US_DOM_GDP constitutes block 1,
while the one associated with US_DOM_CPI constitutes block 2. The two blocks are considered
from the point of view of a VAR estimated only for US. For the same period, the condition associated
with EA_DOM_GDP and EA_DOM_CPI also represent respectively blocks 1 and 2, but from the
point of view of a VAR estimated for EA on its own.

This table would not be appropriate for a factor model (static or dynamic). For such models a

61
Chapter 4 Setting your applications on Excel

single VAR is estimated for all the units, so that the blocks have to be considered jointly for the
whole model. To be correct, the above table should be modified as follows:

62
Chapter 4 Setting your applications on Excel

Figure 4.22: modified Excel block sheet for factor model

The table may look complicated, but if you remember that the identification of blocks is a period-by-
period exercise and hence proceed to the labelling of blocks row after row, you will see that it is easy
to translate Figure 4.21 into this one. Consider for instance the period 2015q3. If you consider the
model as whole, with the conditions defined by Figure 4.18 and the shocks defined as in Figure 4.19,
then there three conditions for this period: one on US_DOM_GDP, one on UK_DOM_GDP, one on
UK_DOM_CPI, respectively generated by shocks 1, 7 and 9. As all the conditions are generated by
different shocks, they constitute different blocks. The condition on US_DOM_GDP thus constitutes
block 1, that on UK_DOM_GDP constitutes block 2, and the one on UK_DOM_CPI constitutes
block 3. Note that you may have defined the ordering of the blocks differently if you wished. The
same reasoning could be repeated for each period of the sheet, and one would obtain Figure 4.22.

63
Chapter 4 Setting your applications on Excel



64
CHAPTER 5
Interpreting your results
Once you run BEAR, it will produce 3 different outputs:

• a summary of your estimation results: the results will appear on the Matlab screen, but they
will also be saved as a text file "results_name.txt".

• a set of plots generated by Matlab for your model.

• an Excel file "results_name.xlsx" storing the numerical values of the results for all your appli-
cations (provided this option was selected).

The files "results_name.txt" and "results_name.xlsx" are stored in the "results" folder which is typi-
cally under the project folder (that is, in folder specified by your data path). The naming of the files
"results_name" is specified in the first panel,or in bear_settings.m. If rolling window estimation is
selected than the last period of the window is appended to the name and each iteration is stored.

4
! Warning The files "results_name.txt" and "results_name.xlsx" will be overwritten each time
you run a new estimation. If you want to preserve your current results, you should rename the two
files to avoid their replacements.

The different outputs are now introduced. The presentation is done for the Bayesian VAR model,
but the other models produce similar outputs, with only slight variations.

Matlab output

The first set of results is provided on the Matlab window, with a copy created on the text file "re-
sults_name.txt". These results provide a summary of your estimation, and can be divided into 5
parts. The first part recapitulates your estimation settings, and hence allows you to replicate the
estimation later on with exactly the same configuration:

The second part provides an estimate of your model coefficients β, equation by equation:

65
Chapter 5 Interpreting your results

Figure 5.1: First part of Matlab output

Figure 5.2: Second part of Matlab output

66
Chapter 5 Interpreting your results

For each equation and each coefficient, the toolbox provides the point estimates (the median value),
along with the standard deviation of the coefficient, the lower bound and the upper bound. For
each equation, certain in-sample fit measures are also provided: the sum of squared residuals, the
R-squared and the adjusted R-squared.

The third part of the output provides results for the model considered as a whole:

Figure 5.3: Third part of Matlab output

Two elements are reported: the first is the log 10 of the marginal likelihood: this is an essential value
for the selection of competing models. Note that for some models the marginal likelihood will not be
computed, for instance if the model relies on improper prior distributions (as for the normal-diffuse
prior). The second element is a stationarity check: it consists in reporting the roots of the charac-
teristic polynomial of the median model (that is, the model obtained by using the point estimate
of each coefficient). While it is a useful indication, it should be interpreted with caution: Bayesian
models rely on the whole posterior distribution, not just on the median model. Hence even if your
median model is stationary, it may still be the case that many draws from the posterior will still be
explosive, possibly resulting in non-stationary results for your applications.

The fourth part of the output is related to the residuals and shocks:

It first reports the posterior point estimates for the residual variance-covariance matrix Σ. Then, if
a structural identification scheme was selected, it also reports the posterior estimates for the struc-

67
Chapter 5 Interpreting your results

Figure 5.4: Fourth part of Matlab output

tural identification matrix D, and for the variance-covariance matrix of the structural disturbances Γ.

The final part of the output provides the forecast evaluation criteria. If forecasts or forecast evalua-
tion were deactivated, this part will of course not appear:

Figure 5.5: Fifth part of Matlab output

The BEAR toolbox provides 7 forecast evaluation criteria: the root mean squared error (RMSE),
the mean absolute error (MAE), the mean absolute percentage error (MAPE), the Theil’s U coeffi-
cient, the continuous ranked probability score (CRPS), and two different versions of the log score.
Please refer to the technical guide for the definitions of the different criteria. In addition if a rolling
regression is undertaken then Forecast Evaluation Tests in the Presence of Instabilities will also be
undertaken - please see separate guide.

68
Chapter 5 Interpreting your results

Matlab charts

The BEAR toolbox produces a series of charts illustrating your results. Those plots include both
in-sample and application results. Any application that was de-activated will of course be missing
in the plots. Assuming all the applications were selected, the set of lots produced by BEAR are the
following:

69
Chapter 5 Interpreting your results

Actual VS fitted (obtained from the median model):

Figure 5.6: Actual VS fitted

Residuals (obtained from the median model):

Figure 5.7: Residuals

70
Chapter 5 Interpreting your results

Steady-state:

Figure 5.8: Steady-state

Impulse response functions:

Figure 5.9: Impulse response functions

71
Chapter 5 Interpreting your results

Structural shocks:

Figure 5.10: Structural shocks

Unconditional forecasts:

Figure 5.11: Unconditional forecasts

72
Chapter 5 Interpreting your results

Forecast error variance decomposition:

Figure 5.12: Forecast error variance decomposition

Historical decomposition:

73
Chapter 5 Interpreting your results

Figure 5.13: Historical decomposition

74
Chapter 5 Interpreting your results

Conditional forecast:

Figure 5.14: Conditional forecast

Excel record

The final set of outputs produced by the BEAR toolbox is stored in the Excel file "results_name.xlsx".
If you open this file once the estimation is over, it looks like this:

75
Chapter 5 Interpreting your results

Figure 5.15: First page of results_name.xlsx file

There are 3 different parts in this file. The first sheet "estimation info" (the one displayed in the
figure) constitutes the first part. It exhaustively recapitulates the settings of your model. Hence, if
you plan to replicate your estimation, you should be able to recover all the relevant information in
this sheet. This sheet is comparable to the first part of the text output "results.txt", except that it
is more complete.

The second part is dedicated to the recording of the information that you had to input by the
way of Excel tables. It starts with the "pred exo" sheet, and ends up with the "cf intervals" sheet.
Indeed, for many applications (predicted exogenous, grid search, block exogeneity, sign restrictions,
conditional forecasts and the specification of prior values for the mean-adjusted model), your es-
timation information had to be written in dedicated tables in the "data.xlsx" spreadsheet. If this
information is not saved somewhere in the output file, you might be unable to replicate your esti-
mation later on if you modified your data file in the meantime. For this reason any table involved
in the estimation process will be replicated in the "results.xlsx" file. For instance if you estimated

76
Chapter 5 Interpreting your results

conditional forecasts, the sheet "cf conditions" will replicate your condition sheet:

Figure 5.16: Record of conditions in results_name.xlsx

The final part of the file is constituted of the remaining worksheets. These sheets record the numerical
values for all your applications. Indeed, even though Matlab produces charts for your applications,
you may want to know the exact numerical values for your results, and possibly modify them, create
your own plots, and so on. Therefore, for each application, you will find a record of your results in
a corresponding Excel sheet. For instance if you selected the impulse response function application,
your results will be saved in the sheet "IRF":

77
Chapter 5 Interpreting your results

Figure 5.17: Record of impulse response functions in results_name.xlsx

78
CHAPTER 6
Appendix: description of the example datasets
yearly data: a model of small and large open economies (Luxembourg and France), comprising real
GDP and inflation data. The series are "frgdp" (French GDP), "frinf" (French inflation), "luxgdp"
(Luxembourg GDP) and "luxinf" (Luxembourg inflation).

quarterly data: a model of the US. The series are: "DOM_GDP" (level of real GDP for the US),
"DOM_CPI" (CPI inflation for the US), STN (US interest rate), and "Oil", the oil price in US dollars.

monthly data: a model of inflation dynamics for Japan. The series are "inf" (Japanese inflation),
"gdp" (growth rate of Japanese real GDP), "trade" (growth rate of trade balance), "u" (Japanese
unemployment rate) and "ex" (exchange rate with the US dollar).

weekly data: a model of monetary policy for China. The series are "shibor" (Shanghai interbank
rate),"exus" (exchange rate with the dollar), "exeur" (exchange rate with the euro), "vix" (financial
volatility index), and "oil" (brent spot price).

daily data: a model of daily exchange rate for the yen. The series are: "dollar" (yen-dollar ex-
change rate), "euro" (yen-euro exchange rate), "rmb" (yen-yuan exchange rate), "rupiah" (yen-Indian
rupiah exchange rate), and "baht" (yen-baht exchange rate).

undated data: the data set is just that of quarterly data, turned here into an undated set.

panel data: the set represents a model of fluctuation for three countries of the US, Euro area and
UK with data respectively recorded in the sheets US, EA, and US. Each sheet contains four series:
"DOM_GDP" (growth rate of real GDP), "DOM_CPI" (CPI inflation), "STN" (interest rate), and
"Oil" (Oil price). The first three variables are used as endogenous variables and are thus country-
specific. The final one is used as an exogenous and is thus common to all countries.

79
Frequently asked questions
Note there is a separate document with Frequently asked questions for more technical questions.
My interfaces are not displayed correctly. In particular, the text size is wrong and bits
seem to be missing.

This is a common issue which is not related to Matlab or the toolbox. Many computers (espe-
cially laptops) apply specific display settings. These settings typically magnify or reduce the case
size while leaving other elements unchanged. While these display settings work fine with the Win-
dows environment, they may result in bad display of the Matlab interfaces. To fix the problem, you
need to modify your display settings. The specific options to change can vary from one computer to
another, but typically you should take a look at your control panel.

My historical decomposition components don’t sum to actual. Similarly, my forecast


error variance decomposition components don’t add up to 1. What is wrong there?

Basically nothing is wrong. To understand this you need to keep in mind that Bayesian estima-
tion always results in a full posterior distribution, and not in a single point estimate. If you estimate
a historical decomposition in a traditional (frequentist) framework, the point estimate that you obtain
will by construction sum up to your actual value. But in a Bayesian framework, every component of
your historical decomposition will be characterised by a full posterior distribution. Depending on the
specific value you pick for each component from its posterior distribution, you will obtain different
summation results, which will (most likely) not be equal to your actual value anyway. The point
estimate that is adopted in BEAR is the median of each posterior distribution. Such an estimate
should typically produce summations close to your actual value. However if the posterior is strongly
skewed or has a large variance, you may obtain summations which depart significantly from your
actual values. Common practice for historical decomposition then consists in summing the median
contributions for all your shocks, hence creating a "total shock contribution" component. Then defin-
ing an "unconditional forecast, absent shock" component as the difference between actual and total
shock component, one obtains again an exact identification.

The same logic applies to forecast error variance decomposition: the fact that you are dealing with a

80
Chapter 6 Appendix: description of the example datasets

full distribution rather than a single point estimate explains why your summation may differ from 1.
There is however no all-ready solution to deal with the case. You may deal with the relative weight
of your respective components (i.e. mentioning for instance that a given component weights twice as
much as some other component) rather than with the absolute contribution of each component. Or
you may use the absolute contribution of each component anyway, simply ignoring the discrepancy
with the theoretical unit total. The former approach is used for the forecast error variance decom-
position charts in Matlab, whereas the original decomposition is provided in the excel spreadsheet.

I have a VAR model with three variables. I use block exogeneity on variable 2 so
that it has no effect on variable 1. Yet the impulse response function of variable 1 to
shock 2 is not equal to zero. How is that possible?

To understand this you need to consider precisely what block exogeneity implies. Block exogeneity
effectively neutralises the response of a given variable (say 1) to past values of some other variables
(say 2). In this sense block exogeneity works perfectly. But when it comes to impulse response
functions, the transmission channel becomes more complex. Consider the specified VAR model (3
variables, block exogeneity on variable 2 with respect to variable 1), and the case of a shock on
variable 2. At impact, block exogeneity indeed implies that the shock on variable 2 has no effect on
variable 1. However, as block exogeneity is not applied to variable 3, the shock on variable 2 will have
an effect on variable 3. In subsequent periods, variable 1 will respond to past values of variable 3,
which are non-zero. This will result in variable 1 producing non-zero responses to shocks in variable
2, not directly as this is neutralised by block exogeneity, but indirectly through the channel created
by variable 3.

The conclusion is straightforward: the problem here comes from the fact that variable 3 responds to
variable 2. If you want to shut down any kind of spillover stemming from variable 2, you need not
only to make it block exogenous to variable 1, but to variable 3 as well. In general if you want to
make a variable or a block of variables exogenous, you need to insulate the block completely by mak-
ing it exogenous to all the other variables of the model. In this sense, the name "block exogeneity"
makes full sense as it reflects the idea of organising your variables into separate blocks. For instance
if your VAR comprises some large economy variables (say for the US) and some other small economy
variables (say for Cuba), and you implement block exogeneity to reflect the fact the Cuba should not
affect the US, then the Cuban variables should be set as block exogenous to all the US variables. In
this way, you effectively define a full block of Cuban variables which are exogenous to your block of
US variables.

81
Chapter 6 Appendix: description of the example datasets

How do I discriminate among competing models? How can I decide which specifi-
cation is best (number of lags, choice of the prior, hyperparameter values and so on)
for my model?

The Bayesian field offers you a great evaluation criterion: the marginal likelihood. In theory, it
should be sufficient to discriminate among models. And indeed, the grid search used to optimise the
value of the hyperparameters relies on the marginal likelihood. In practice however, the marginal
likelihood suffers from two main limitations. First, it is only available for a limited number of
models. Many models don’t have an associated marginal likelihood value, either because they use
improper prior distributions, or because they are too complex to yield convenient formulas. Second,
the marginal likelihood tends to favour certain specifications in a regular basis: for instance it will
typically favour a normal-Wishart prior over a Minnesota prior, or a model with more lags over a
model with fewer lags. In this respect, you may want to consider the results with some care.

Fortunately, BEAR provides you with additional evaluation criteria: in-sample criteria (sums of
squared residuals, R-squared and adjusted R-squared), and forecast evaluation criteria (RMSE, MAE,
MAPE, Theil’s U, CRPS and log scores). In the end, your decision should be based on all these cri-
teria jointly. How much weight you attribute to each of them ultimately depends on your objective.
If your objective is to optimise the quality of your forecasts, then clearly forecast evaluation criteria
should be your sole consideration. If you want to run more qualitative study, you may consider more
seriously the marginal likelihood and in-sample criteria.

The values for the R-squared and adjusted R-squared coefficients that I obtain are
not comprised between 0 and 1. I even obtain negative values. Is there a problem?

No, there is no problem. There are several possible definitions for these criteria, and the ones
that we use can produce values not comprised between zero and 1. This does not change anything
to the interpretation however: the higher the value, the better the in-sample fit.

82
Bibliography
Arias, J. E., Rubio-Ramirez, J. F., and Waggoner, D. F. (2014). Inference Based on SVARs Iden-
tified with Sign and Zero Restrictions: Theory and Applications. Dynare Working Papers 30,
CEPREMAP.

Banbura, M., Giannone, D., and Reichlin, L. (2010). Large Bayesian vector auto regressions. Journal
of Applied Econometrics, 25(1):71–92.

Canova, F. and Ciccarelli, M. (2013). Panel vector autoregressive models: a survey. Working Paper
Series 1507, European Central Bank.

Doan, T., Litterman, R. B., and Sims, C. A. (1983). Forecasting and Conditional Projection Using
Realistic Prior Distributions. NBER Working Papers 1202, National Bureau of Economic Research,
Inc.

Giannone, D., Lenza, M., and Primiceri, G. E. (2015). Prior selection for vector autoregressions.
Review of Economics and Statistics, 27(2):436–451.

Giannone, D., Lenza, M., and Primiceri, G. E. (2017). Priors for the long run. Federal Reserve Bank
of New York Staff reports, (832).

Jarocinski, M. (2010). Responses to monetary policy shocks in the east and the west of Europe: a
comparison. Journal of Applied Econometrics, 25(5):833–868.

Kadiyala, K. R. and Karlsson, S. (1997). Numerical Methods for Estimation and Inference in Bayesian
VAR-Models. Journal of Applied Econometrics, 12(2):99–132.

Litterman, R. (1986). Forecasting with Bayesian Vector Autoregressions – Five years of experience
: Robert b. Litterman, Journal of Business and Economic Statistics 4 (1986) 25-38. International
Journal of Forecasting, 2(4):497–498.

Pesaran, H. and Smith, R. (1995). Estimating long-run relationships from dynamic heterogeneous
panels. Journal of Econometrics, 1:79–113.

Robertson, J. C., Tallman, E. W., and Whiteman, C. H. (2005). Forecasting Using Relative Entropy.
Journal of Money, Credit and Banking, 37(3):383–401.

83
Bibliography

Villani, M. (2009). Steady-state priors for vector autoregressions. Journal of Applied Econometrics,
24(4):630–650.

Waggoner, D. F. and Zha, T. (1999). Conditional Forecasts In Dynamic Multivariate Models. The
Review of Economics and Statistics, 81(4):639–651.

Zellner, A. and Hong, C. (1989). Forecasting international growth rates using bayesian shrinkage
and other procedures. Journal of Econometrics, 40(1):183–202.

84

You might also like