/deepvars

Vector Autoregression augmented with deep learning.

Primary LanguageTeXMIT LicenseMIT

Lifecycle: experimental

NOTE ℹ️: This is the repository for the companion package to our paper Altmeyer, Agusti, and Vidal-Quadras Costa (2021). We presented our paper at the NeurIPS 2021 MLECON workshop. For the specific code used for the paper and additional resources please see this repository.

Disclaimer

Since we worked on this project in 2021, Patrick has continued to work on the deepvar package in his spare time. Among other things, he has found a bug in the original code, which has produced erroneous results for the test set in Table 1 of the paper that introduced the the approach (see here). We are also not convinced that the empirical results presented in the paper are robust, after looking at replicating the findings for another dataset. Nonethess, we believe that the proposed methodological framework is interesting and this package should help facilitate future researchers interested in exploring the applicability of deep learning to macroeconomic data. Since Patrick is caught up in his PhD for now, this project is officially idle. Do feel free to salvage what you can though.

deepvars

The deepvars package provides a framework for Deep Vector Autoregression in R. The methodology is based on (Altmeyer, Agusti, and Vidal-Quadras Costa 2021), a working paper initially prepared as part of the Masters Degree in Data Science at Barcelona School of Economics. For a summary of the first version of the working paper see here.

Installation

Prerequisites

As one of its dependencies the deepvars uses tensorflow, which is an R interface to the popular TensorFlow library. We have tried to automate the TensorFlow configuration as explained here.

install.packages("tensorflow")
tensorflow::install_tensorflow()

For uncertainty quantification we use tensorflow_probability for Bayesian inference.

install.packages("tfprobability")
tfprobability::install_tfprobability()

Should you run into issues you may have to manually install the TensorFlow dependencies. Detailed instructions to this end can be found here.

Install

You can either clone this repository and install from source or simply run the below in R:

devtools::install_github("pat-alt/deepvars", build_vignettes=TRUE)
library(deepvars)

Getting started

Full documentation of the package is still a work-in-progress. In the meantime, detailed guidance on different topics and estimation methods covered by deepvars, can be found in the vignettes. Simply type the following command once you have completed the steps above:

utils::browseVignettes('deepvars')

Disclaimer

Date: 2 December, 2021.

This package was developed in tandem with the initial research for my masters thesis. Documentation is incomplete and it should at this point not be regarded as a fully-fledged, tested and production-ready piece of software, so please bear this in mind. That being said, I’m quite confident about the basic functionality of training and predicting from a Deep VAR as well as various plotting methods that can be used for visualizing the results. I encourage you to try it out yourself and should you encounter any problem, please just open an issue.