Python implementation of the midasml approach - providing estimation and prediction methods for high-dimensional mixed-frequency time-series data
- Marcus Egelund-Müller - Mem03
- Jonas Striaukas - jstriaukas
- Kris Stern - krisstern
The midasmlpy package implements estimation and prediction methods for high-dimensional mixed-frequency (MIDAS) time-series and panel data in regression models. The regularized MIDAS models are estimated using orthogonal (e.g. Legendre) polynomials and the sparse-group LASSO estimator. For more information on the midasmlpy approach there are references in the footnotes123.
The package is equipped with the fast implementation of the sparse-group LASSO estimator by means of proximal block coordinate descent. High-dimensional mixed frequency time-series data can also be easily manipulated with functions provided in the package.
These can be found at the midasmlpy/src directory.
Compiled .so
files can be found at midasmlpy/compiled directory.
Please note that we have taken the .f90
source code for sparse-group LASSO from the repo of the R package sparsegl
on hosted GitHub at https://github.com/dajmcdon/sparsegl.
We have taken their source code in accordance with their GPL-2.0 license as is without any modification as of November 2nd, 2023 UTC.
Run:
gfortran -c fortran_file.f90
Run:
python -m numpy.f2py -c fortran_file.f90 -m fortran_file
Note: Be sure the python
executable above matches the one in your environment.
- A Julia implementation of the midasml method is available here.
- A MATLAB implementation of the midasml method is available here.
- An R implementation of the midasml method is available here.
To install the midasmlpy package, download the files and at the directory of files run:
pip install .
To install the midasmlpy package for development, do the following instead in “editable” mode:
pip install -e .
To run the tests, run:
pytest --pyargs src
In case you are running the code on a different platform, you can compile the Fortran code sglfitF.f90 by using f2py which is part of numpy. There is a guide in midasmlpy/src/sparseglf90/README.md
Footnotes
-
Babii, A., Ghysels, E., & Striaukas, J. Machine learning time series regressions with an application to nowcasting, (2022) Journal of Business & Economic Statistics, Volume 40, Issue 3, 1094-1106. https://doi.org/10.1080/07350015.2021.1899933. ↩
-
Babii, A., Ghysels, E., & Striaukas, J. High-dimensional Granger causality tests with an application to VIX and news, (2022) Journal of Financial Econometrics, nbac023. https://doi.org/10.1093/jjfinec/nbac023. ↩
-
Babii, A., R. Ball, Ghysels, E., & Striaukas, J. Machine learning panel data regressions with heavy-tailed dependent data: Theory and application, (2022) Journal of Econometrics. https://doi.org/10.1016/j.jeconom.2022.07.001. ↩