How to predict returns with linear regression
In this section, we will use linear regression with and without shrinkage to predict returns and generate trading signals.
First, we need to create the model inputs and outputs. To this end, we'll create features along the lines we discussed in Chapter 4, Financial Feature Engineering – How to Research Alpha Factors, as well as forward returns for various time horizons, which we will use as outcomes for the models.
Then, we will apply the linear regression models discussed in the previous section to illustrate their usage with statsmodels
and sklearn and evaluate their predictive performance. In the next chapter, we will use the results to develop a trading strategy and demonstrate the end-to-end process of backtesting a strategy driven by a machine learning model.