After having designated our X and y data for the regression modeling, it ‘s time to apply our Lasso model regression.

(Lasso(alpha=0.01, copy_X=True, fit_intercept=True, max_iter=1000,
normalize=False, positive=False, precompute=False, random_state=None,
selection=’cyclic’, tol=0.0001, warm_start=False),
{‘alpha’: 0.01},
[mean: -0.71097, std: 0.02741, params: {‘alpha’: 1e-08},
mean: -0.71097, std: 0.02741, params: {‘alpha’: 1e-06},
mean: -0.71096, std: 0.02742, params: {‘alpha’: 1e-05},
mean: -0.71094, std: 0.02745, params: {‘alpha’: 5e-05},
mean: -0.71091, std: 0.02749, params: {‘alpha’: 0.0001},
mean: -0.71068, std: 0.02781, params: {‘alpha’: 0.0005},
mean: -0.71041, std: 0.02821, params: {‘alpha’: 0.001},
mean: -0.70822, std: 0.03515, params: {‘alpha’: 0.01},
mean: -0.71203, std: 0.05003, params: {‘alpha’: 0.1}

train MAE 0.695980532838 test MAE 0.7297133845

Lasso Model Coefficients

This is showing the strength of each feature in the Lasso model to describe price returns.
Momentum, as expected from the initial scatterplot data visualizations, is the strongest feature.
Note that zero coefficient values signify the feature has been eliminated during the shrinkage process.


An effectively zero intercept is not unexpected given we have centered and normalized the data.


Prediction Errors

The prediction errors are somewhat bell-shaped, which at least does not disagree with regression model assumptions.

Other Diagnostics – Pearson Correlation

We now examine how each feature is correlated to the response price returns.
The correlation should relatively align with our Lasso Coefficient strength ordering – to some degree.


Above we have a Lasso based price returns model that has indeed achieved some dimensionality reduction.
Are there any surprises?

We would need to study further in the financial literature each feature’s theoretical expected effect on price change, however, we consider some interesting notes below.

Momentum (i.e., P_PRICE_RETURNS_PR: trailing 6 month returns) was anticipated to be a strong predictor from the initial data visual exploration and Pearson Correlation, and this was proven out in the Lasso model. Intuitively, this makes sense though, as it is seems likely that price returns of a sample period’s month would be in the same direction as the price returns aggreagated over that sample period’s previous 6 months.

It was interesting, if not surprising, to see some difference in the relative ordering of Lasso Coefficients and Pearson Correlation of features. We should not ignore this, as it may warrant further analysis which may reveal some new understanding of the data set. One notable difference is for FF_PBK (Price to Book Value), where the Lasso has it with relatively high coefficient strength, the Pearson Correlation revealed a weaker relative connection to price returns, although both indicated a positive direction.
Price to Earnings (FF_PE) was relatively weak in both Lasso Coefficient and Pearson Correlation, but this may not be unexpected given our data set consisted of stock issued by already well established DJIA companies.

Next Steps

An even more parsimonious model, desirable for its ability to generalize new data, could be pursued next starting with the top N, say 4, features as sorted above based on coefficient strength.

We also need to evaluate how “good” the model is. This requires a benchmark or other model to compare to. We want to avoid data mining specifically for this historical feature data set, though, as this may encourage overfitting in our model, so if it is clear these features are not working well enough we may need to consider other features, as there are many, and even possibly indicator variables to encode stock issuer industry or sector, for example. It could also be that we need to include overall market trends in the model in the form of market index based features, or adjusted returns, or some other mechanism.

Finally we would want to next attempt to model future month price returns, as opposed to, current period returns. This could be based on our current model, at least to begin with.

<< Part 5