applying market basket analysis to the stock market

I’ve started learning market basket analysis and decided to test drive my knowledge against the stock market:

I own a (proprietary) database of predicted stock causality relationships. An export to tabular form looks something like this:

I won’t tell you what the “causality” is, as that is the proprietary part, and the example data shown above is completely fictional.

But what is important to the market basket analysis is that I wanted to see if specific pairs of industries are likely to coincide with high causality. So I ran the “apriori” algorithm in R’s “arules” library.

Most of the results related a single industry to causality, and I’m only interested in industry pairs. So I trimmed the results:

Here we see that causality is “slightly enriched” (speaking like a biologist) for certain industry pairs. It makes sense that movement in bank share prices causes movement in EDP service share prices. It also makes sense that a movement in one Pharma company’s price would impact movement of another Pharma company’s. I also suppose that bank success drives capital-intensive industrial machinery growth.

However the first of these, Pharma impacting business services, doesn’t make sense to me. But if the relationship is real, as the analysis indicates, I can exploit it in my stock trading. This illustrates the power of market basket analysis—illuminating unexpected correlations to profit from.

Post Author: badassdatascience

Leave a Reply

Your email address will not be published.