Updated 21 Jul 2022
|❗ We just added some major changes into the main functionality of BEAR to improve its usability. To access the previous version of the code use the legacyCode branch|
The BEAR toolbox
Table of Contents
- Installing BEAR
- Getting started
- Distribute BEAR
The Bayesian Estimation, Analysis and Regression toolbox (BEAR) is a comprehensive (Bayesian Panel) VAR toolbox for forecasting and policy analysis.
BEAR is a MATLAB based toolbox which is easy for non-technical users to understand, augment and adapt. In particular, BEAR includes a user-friendly graphical interface which allows the tool to be used by country desk economists.
Furthermore, BEAR is well documented, both within the code as well as including a detailed theoretical and user’s guide. BEAR includes state-of-the art applications such as FAVARs, stochastic volatility, time-varying parameters, mixed-frequency, sign and magnitude restrictions, conditional forecasts, Bayesian forecast evaluation measures, Bayesian Panel VAR using different prior distributions (for example hierarchical priors).
BEAR is specifically developed for transparently supplying a tool for state-of-the-art research and is planned to be further developed to always be at the frontier of economic research.
Use of BEAR implies acceptance of the End User Licence Agreement (EULA) for the Use of the Software “the Bayesian Estimation, Analysis and Regression (BEAR) toolbox”.
Structure of the repository
This repository is organized as follows. All BEAR files that need to be installed by the end-users are located inside the
tbx in four separate directories:
appcontains all the files related to the user interface
bearhas all the core MATLAB functions and classes
replicationscontains a set of Excel and settings files to replicate previous results from the literature
examplescontains a set of functions to create settings objects for each VAR type
doccontains a set of PDFs with some of the BEAR documentation
The rest of the folders contain development files related to the development of BEAR which will not be copied in non-development environments. This folders are structured as follows:
testscontains a set of MATLAB unit tests which are automatically run within GitHub actions every time any change is pushed to the master branch.
resourcescontains the metadata of the MATLAB project
releasecontains the definition files that allow the user compiling BEAR into a standalone application
imagescontains all the images used within the README files of the repository
This section is aimed to those users indending to run BEAR, but not interested in working or ammending the code.
From MATLAB or MATLAB Online
To install the toolbox directly from MATLAB, please go to HOME > Add Ons, search for BEAR and install the toolbox. Alternatively, follow the steps below to install it from GitHub.
If there was a need to modify the BEAR code, it is recommended not to modify the installed version. Instead, the best approach is to clone the repository and open the project. To open the project, you can double click on
bear.prj in the main folder or rnu the command:
Opening the MATLAB project will shadow the installed version of BEAR as long as the project is open, once the project is shut down, the installed version will again be default version. To check which verison of BEAR is currently running, you can run:
>> which BEARmain
For non-MATLAB users
Under releases, you will find an executable with the compiled application that you can install in any Windows based computer. To run the installer, just download the .EXE file and run it.
Alternatively, if you wanted to run the full version of BEAR, you can get a trial version of MATLAB here.
Creating a settings object
To create a settings object you can use the function
>> s = BEARsettings(<VARtype>, 'ExcelFile','data.xlsx')
This will return a settings object with different properties depending on the selected VARtype.
Running BEAR from the command line
To run BEAR, please use:
s is a BEAR settings object created with the
Running BEAR interactively
From MATLAB run the command below to open the main BEAR interface.
If you want to see an example on how to run BEAR, you can run any of the following files directly:
s = bear_settings_BVAR s = bear_settings_PANEL s = bear_settings_SV s = bear_settings_TVP s = bear_settings_MF
change your inputs accordingly and then run
BEARmain(s). Alternatively, if you wanted to build your own settings files, you use any of these as a template running for example:
copyfile(fullfile(bearroot(), 'examples', 'bear_settings_BVAR.m'), pwd) edit('bear_settings_BVAR')
For a full BEAR documentation please visit our doc page.
With other MATLAB users
Any MATLAB user can download the latest version of BEAR from the GitHub repository. However, if you wanted to create your own custom distribution you can package it as a MATLAB toolbox as follows:
- Open the
tbx.prjand edit the main fields such as author, version, and description.
- Either click on package or run:
projectFile = 'tbx.prj'; matlab.addons.toolbox.packageToolbox(projectFile)
With non-MATLAB users
If you wanted to share BEAR with someone who is not a MATLAB user, there are several routes you can take:
- You can use MATLAB Compiler to share the APP as a standalone program. For this, please open the Application Compiler from the toolstrip:
- Select as MAIN FILE the appropriate BEAR app from your set of files. For example,
- Under Files required for your application to run add the following in addition to the automatically detected ones:
- Click on Package.
- You will get a subfolder with the files that you can use to redistribute the application
For external language integration
If you wanted to share specific functionality with users of other languages, you can take a look at Compiler SDK. The process is analgous to the previous one but selecting a different target.
Use of BEAR implies acceptance of the End User Licence Agreement (EULA) for the Use of the Software “the Bayesian Estimation, Analysis and Regression (BEAR) toolbox”. License
Alistair Dieppe and Bjorn van Roye (2021). BEAR toolbox (https://github.com/european-central-bank/BEAR-toolbox)
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
See release notes for this release on GitHub: https://github.com/european-central-bank/BEAR-toolbox/releases/tag/v5.1.4
See release notes for this release on GitHub: https://github.com/european-central-bank/BEAR-toolbox/releases/tag/v5.1.3
See release notes for this release on GitHub: https://github.com/european-central-bank/BEAR-toolbox/releases/tag/v5.1.1
See release notes for this release on GitHub: https://github.com/european-central-bank/BEAR-toolbox/releases/tag/v5.1.0