❗ 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 |
---|
GitHub® Actions |
---|
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”.
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:
app
contains all the files related to the user interfacebear
has all the core MATLAB functions and classesreplications
contains a set of Excel and settings files to replicate previous results from the literatureexamples
contains a set of functions to create settings objects for each VAR typedoc
contains 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:
tests
contains a set of MATLAB unit tests which are automatically run within GitHub actions every time any change is pushed to the master branch.resources
contains the metadata of the MATLAB projectbear.prj
release
contains the definition files that allow the user compiling BEAR into a standalone applicationimages
contains 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.
From GitHub
Download the latest bear.mltbx
file that you will find under the Releases section on the right.
Once this file has been downloaded, you can double click it from MATLAB to install the toolbox.
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:
>> openProject('bear.prj')
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
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.
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.
To run BEAR, please use:
>> BEARmain(s)
where s
is a BEAR settings object created with the BEARsettings
function.
From MATLAB run the command below to open the main BEAR interface.
>> BEARapp
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.
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.prj
and edit the main fields such as author, version, and description. - Either click on package or run:
projectFile = 'tbx.prj';
matlab.addons.toolbox.packageToolbox(projectFile)
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,
tbx\app\BEARapp20a
.
- Under Files required for your application to run add the following in addition to the automatically detected ones:
- tbx\bear\+bear\results.xlsx
- tbx\replications\data_AAU2009.xlsx
- tbx\replications\data_BBE2005.xlsx
- tbx\replications\data_BvV2018.xlsx
- tbx\replications\data_CH2019.xlsx
- tbx\replications\data_WGP2016.xlsx
- tbx\default_bear_data.xlsx
- Click on Package.
- You will get a subfolder with the files that you can use to redistribute the application
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