Search⌘ K
AI Features

Section 3: Correlation in Stocks

Explore how to measure and interpret correlations between stocks of different companies using closing prices and daily returns. Learn to preprocess stock data, calculate correlation scores, and visualize relationships with heatmaps to better understand stock behavior and its implications for investment risk.

The stock behavior of companies dealing in similar services is usually related, and this relation can be measured using correlation.

Correlation

Correlation is a statistical technique that determines how strongly two variables are related to each other and how a change in one would affect the other. It can also be defined as a measure of dependence between two or more quantities.

The two types of correlation, in terms of stock behavior, can be described as follows:

  • Positive correlation: The stock value of one company goes up, and in correlation with it, the stock values of other companies also go up.

  • Negative correlation: The stock value of one company goes up, and in correlation with it, the stock values of other companies go down.

Correlation score

For positive correlation, this score is between 0 and 1, and for negative correlation, this score is between ...