Macroeconomic Random Forest

_images/MaRF_logo.svg

R   python   MRF   Maintained?  

Macro Random Forest (MRF) offers the power of a Random Forest with the interpretability of a linear regression.

Created by Ryan Lucas this code base is the open-source implementation of “The Macroeconomy as a Random Forest” by Philippe Goulet Coulombe (UQAM). MRF is a time series modification of the canonical Random Forest Machine Learning algorithm. It uses a Random Forest to flexibly model time-varying parameters in a linear macro equation. This means that, unlike most Machine Learning methods, MRF is directly interpretable via its main output – Generalized Time Varying Parameters (GTVPs).

The model has shown forecasting gains over numerous alternatives and across many time series datasets. It is well suited to macroeconomic forecasting, but there are also many possible extensions to quantitative finance or any field of science with time series data. The full paper corresponding to the implementation can be found here: https://arxiv.org/abs/2006.12724

Installation

Python

To install the package and its dependencies in Python, you can simply do:

pip install MacroRandomForest

To download some sample notebooks, you can use:

git clone https://github.com/RyanLucas3/MacroRandomForest

Now you’re ready to get started! Head over to Usage to find out how to implement MRF.

R

To install the package in R, simply run the following commands:

install.packages('devtools')
library(devtools)
install_github("philgoucou/macrorf");
library(MacroRF)

Note

This documentation contains detailed information about the implementation of the Python version, with slightly less detail for R.

Still, the implementation is simple and the same guidelines for hyperparameter selection will apply to both versions. Head over to Usage for more details.

Indices and tables