A MATLAB solver for nonlinear, dynamic, stochastic, rational expectations equilibrium models. RECS stands for "Rational Expectations Complementarity Solver". This name emphasizes that RECS has been developed specifically to solve models that include complementarity equations, also known as models with occasionally binding constraints.
Christophe Gouel ([email protected])
Main page is at: www.recs-solver.org.
RECS Toolbox releases are available at https://github.com/christophe-gouel/RECS/releases.
Why is this archive 20 MB? Much of this size is due to an executable for Windows. The executable file includes a complete Python distribution necessary to parse RECS model files.
- MATLAB R2011b or later.
- CompEcon toolbox. RECS depends on the CompEcon toolbox for many programs (especially with respect to interpolation). Please follow CompEcon installation instructions and do not forget to create the mex files if you want your models solved in a reasonable time.
- Path solver for MATLAB. Path is the reference solver for mixed complementarity problems. Its installation is highly recommended if difficult complementarity problems need to be solved.
- MATLAB Optimization Toolbox. The solver fsolve can be used to solve both the equilibrium equations and the rational expectations equilibrium.
- MATLAB Parallel Computing Toolbox. This toolbox allows many RECS programs to be run in parallel to speed-up computation.
- Download the latest RECS archive and unzip
it into a folder, called here
recsfolder
(avoid folder names that include spaces, even for parent folders). - Install the CompEcon toolbox:
- Download the CompEcon toolbox archive;
- Unzip the archive into a folder, called here
compeconfolder
; - Add CompEcon to the MATLAB path:
addpath('compeconfolder/CEtools','compeconfolder/CEdemos')
; - Type
mexall
in MATLAB prompt to create all CompEcon mex files.
- (optional) Install other dependencies.
- Add the RECS folder to the MATLAB path:
addpath('recsfolder')
. - On Windows, you are all set. On other architectures, you will have to install some Python packages. see instructions below.
- You can test your installation by running RECS demonstration files by typing
recsdemos
. You can also access RECS documentation in MATLAB by typingdoc
.
Python 2.7.X and the following packages are required on Linux and Mac, and on Windows when installing from source:
- Python 2.7.X. Python is preinstalled on Linux and Mac, but you should check the version number.
- NumPy.
- PyYaml.
- SymPy, version 0.7.2.
To make the Python programs available to RECS, you have two options:
-
Install them in a virtual Python environment. By default, RECS looks for a folder PythonVirtualEnv inside the Python folder. To do the installation, from RECS folder type in a terminal
cd Python virtualenv PythonVirtualEnv source PythonVirtualEnv/bin/activate pip install numpy PyYAML sympy==0.7.2 deactivate
If your default Python installation is not the version 2.7.X, replace the second command by
virtualenv PythonVirtualEnv -p /usr/bin/python2.7
where
/usr/bin/python2.7
should be replaced by the address of your Python 2.7.X interpreter.Alternatively, if your Python distribution is Anaconda, you can create from RECS folder the virtual environment by
conda create -p ./Python/PythonVirtualEnv python=2.7 numpy PyYAML sympy==0.7.2
-
Install them in your default Python installation (recommended only if you do not use Python otherwise). In this case, just type
pip install numpy PyYAML sympy==0.7.2
If you want to work with the bleeding edge version of RECS, which may be unstable, or if you want to contribute to RECS development, you need to install RECS from source. The installation requires Git.
When installing from source, all platforms (Linux, Mac, and Windows) require Python 2.7.X, along with NumPy, PyYaml, and SymPy version 0.7.2. See above for instructions.
Optionnaly, under Windows, to be able to generate a binary to run to the solver without a Python installation, one can also install PyInstaller and make its folder available in Windows Path.
- Download the latest version of RECS from the git repository by typing in a
command line:
git clone https://github.com/christophe-gouel/RECS.git recs
- From RECS folder (
cd recs
), download recs submodules with two commands:git submodule init
andgit submodule update
. - Install the CompEcon toolbox:
- Download the CompEcon toolbox archive;
- Unzip the archive into a folder, called here
compeconfolder
; - Add CompEcon to the MATLAB path:
addpath('compeconfolder/CEtools','compeconfolder/CEdemos')
; - Type
mexall
in MATLAB prompt to create all CompEcon mex files.
- (optional) Install other dependencies.
- Add the RECS folder to the MATLAB path:
addpath('recsfolder')
. - Finalizes RECS installation from source by running in MATLAB the function
recsInstall
. - You can test your installation by running RECS demonstration files by typing
recsdemos
. You can also access RECS documentation in MATLAB by typingdoc
.
RECS source can be found on the following git repository: https://github.com/christophe-gouel/RECS.git.
Unless stated otherwise, all files in the RECS toolbox are licensed using the Expat license, a permissive free software license. Please see the software license for more information.