Statistical Methods with Quantamental Indicators

A number of powerful and popular libraries, such as scikit-learn, PyTorch and PyMC, are available in Python to make statistical modelling efforts easy and accessible. The following notebooks describe techniques to create machine learning solutions with macro quantamental indicators, using these libraries together with the macrosynergy package.

Point-in-time indicators of macroeconomic trends and states are strong candidates for trading signals. Conceptual risk parity, i.e. an equally weighted average of normalized scores, is a simple and often successful approach to condense these into a single signal, but there is scope for optimization. Statistical learning offers methods for sequential model selection, as well as associated hyperparameters, for signal generation, thus supporting realistic backtests and automated operation of strategies.

This post and its associated Jupyter Notebook demonstrate sequential signal optimization with the scikit-learn package and some specialized extensions. In particular, the post applies statistical learning to sequential optimization of three important tasks: feature selection, return prediction, and market regime classification.

Regression is one method for combining macro indicators into a single trading signal. Specifically, statistical learning based on regression can optimize both model parameters and hyperparameters sequentially and produce signals based on whichever model has predicted returns best up to a point in time. This method learns from growing datasets and produces valid point-in-time signals for backtesting. However, whether regression delivers good signals depends on managing the bias-variance trade-off. 

This post and its associated Jupyter Notebook provides guidance on pre-selecting the right regression models and hyperparameter grids based on theory and empirical evidence. It considers the advantages and disadvantages of various regression methods, including non-negative least squares, elastic net, weighted least squares, least absolute deviations, and nearest neighbors.

Regression-based statistical learning helps build trading signals from multiple candidate constituents. The method optimizes models and hyperparameters sequentially and produces point-in-time signals for backtesting and live trading.

This post applies regression-based learning to macro trading factors for developed market FX trading, using an improved cross-validation method for expanding panel data. Sequentially optimized models consider nine theoretically valid macro trend indicators to predict FX forward returns. The learning process has delivered significant predictors of returns and consistent positive PnL generation for over 20 years. The most important macro-FX signals, in the long run, have been relative labor market trends, manufacturing business sentiment changes, relative inflation expectations, and terms of trade dynamics.

Statistics Packages with Quantamental Indicators

Data analysis with macro quantamental indicators can be performed in both Python and R using standard data science libraries. The following notebooks contain entry-level analysis examples focusing on standard time series and panel analysis.

The notebook illustrates how to use the popular data visualization library Seaborn with quantamental data. In particular,  it shows how to use the package to display historical distributions, panels of timelines, bivariate relations, and various types of heatmaps.

The Statsmodels library provides models and tools for statistical analysis. The notebook illustrates how to use it for various types of simple regression and time series analysis of quantamental data.

The notebook illustrates various types of quantamental panel analysis in Python. In particular, it shows the application of pooled regression, fixed-effects regression, random-effects regression, linear mixed-effects models, and seemingly unrelated regressions.

The notebook illustrates various types of quantamental panel analysis in R. In particular, it shows the application of pooled models, fixed effects models, and linear mixed-effects models.

This notebook gives a step-by-step strategy research example using quantamental data and the Macrosynergy package. It shows how to check data, how to construct panels with plausible trading factors, and how to value the predictive power and economic value of such factors.