The correlation coefficient can be used with other technical metrics such as standard deviation.

Canva

What Is the Correlation Coefficient?

The correlation coefficient is a metric that measures the strength and direction of a relationship between two securities or variables, such as a stock and a benchmark index, commodities, bonds, or other types of assets with data series. It can also be used to compare the performance of two different types of asset classes: a foreign currency and gold, the S&P 500 Index and a bond yield, an exchange-traded fund and crude oil, or even cryptocurrency and a benchmark tech stock index. This article focuses on stocks.

Correlation measures the relationship of two stocks based on their returns (percentage gains or losses), not their historical prices, which is similar in how beta is measured. Many investors and analysts use correlation to determine whether one stock is moving in the same direction as another stock or benchmark index. As part of an investment strategy, it can be helpful in confirming the direction of a stock to its benchmark, or conversely whether the stock and benchmark are moving in opposite directions.

How to Calculate the Correlation Coefficient

A simple calculation method is to use what’s known as the Pearson’s correlation coefficient calculator, named after the English mathematician Karl Person.

In this formula, r represents Pearson’s correlation coefficient. Find the covariance of two variables, which will be called x and y. Take that number, and then divide by the product of the standard deviation of x and the standard deviation of y.

r = covariance of two variables x and y / (standard deviation of x) * (standard deviation of y)

Pearson’s Correlation Coefficient Calculator (r) = Covariance of Variables x and y / (Standard Deviation of x) * (Standard Deviation of y)

Still, that may be viewed as the long-hand method of calculating correlation. The most efficient way to calculate correlation is via spreadsheet. Taking 5 days’ worth of data might not be as meaningful as 5 months, so having a sizable series will be key. Some investors and analysts use around 90 or 100 days’ worth of historical prices for sufficient quantitative analysis. A shorter period, though, could be used to compare long-term correlation.

Below is an example of calculating the coefficient correlation between Apple and the S&P 500 Index, a benchmark measure for U.S. stocks.

Step 1: Collect daily data going back 91 days. The correlation target is for 90 days, but the first day serves as the base price for the first percentage change. Calculate daily percent change for Apple and the S&P 500. Note: The formula is shown in the cell as well as in the field area on the top left corner of the spreadsheet. Apple’s closing stock price accounts for adjustments, including splits, dividends, and/or capital gain distributions.

Step 2: Calculate the 90-day correlation of Apple and S&P 500 by using the shorthand command in the spreadsheet. It won’t matter whether Apple is the first or second array, just as long as the data range between the two matches. For comparison on a shorter duration, calculate the 30-day correlation using the last 30 days of data.

Note: Some spreadsheets allow for the comparison of three or more variables via a matrix.

How to Interpret the Correlation Coefficient

The coefficient of the correlation ranges from -1 to 1. A number at -1 or close to -1 indicates that the two stocks have an inverse correlation. In other words, when one goes up, the other goes down and vice versa. At 1 or close to 1, two stocks are moving in the same direction, with 1 meaning that they are moving lockstep with each other. It’s rare to see two stocks with either a perfect coefficient correlation of -1 or 1. A correlation of 0 indicates a neutral position, with no relationship demonstrated in terms of strength and direction.

Graphically, a correlation of greater than 0 would have a positive slope, while a correlation less than 0 would have a negative slope.

A Quick Guide to Correlation Coefficient Values

Let’s say that a stock and a benchmark index have a correlation of 0.75. That means the relationship between the two is strong and both tend to move in the same direction most of the time. Another way to phrase it is that the two move in the same direction 75 percent of the time. Conversely, a -0.75 correlation indicates that the two move in the opposite direction 75 percent of the time.

A correlation of 0.5 suggests that the strength between the two is moderate and they move in the same direction half the time, while 0.25 suggests low correlation but they still move in the same direction some of the time. Negative correlations of -0.5 and -0.25 indicate moderate and low strength, respectively, but suggest the stock and the benchmark tend to move in opposite directions.

Note: In a bear market, if two stocks decline in the same direction, their correlation remains positive.

In the above example, Apple and the S&P 500 have a correlation coefficient of 0.73817, which indicates a strong relationship between the two over the 90 days of data. If the number of days is reduced to the last 30, the correlation is 0.84602, which suggests a stronger relationship than over the 90-day period. During the 30-day period, sentiment in the market turned bearish. As Apple’s stock fell, more than likely so did the S&P 500. Apple had the biggest market capitalization of any U.S. stock at the time, and that means its weighting in the S&P 500 had more influence on the benchmark’s direction than any of its other component stocks.

How to Use the Correlation Coefficient

Some investors use correlation to measure risk in a portfolio. A high correlation between of one stock to the benchmark could mean higher risk, compared to one with no correlation, because the two are closely related and would move in the same direction. A negative correlation could help in diversifying investment on the view that one stock’s losing returns means another’s gain.

Correlation can be used in conjunction with other technical measures and metrics such as relative strength index, moving average, beta and standard deviation.

What Are the Limitations of the Correlation Coefficient?

Since the correlation coefficient is limited to historical data, it would be challenging to use it as a forecasting tool. Correlation is used in quantitative analysis (as opposed to fundamental analysis, which uses information gleaned from a company’s financial statement), and therefore is limited to data series, such as a stock’s price history.

Frequently Asked Questions (FAQ)

The following are answers to some of the most common questions investors ask about the correlation coefficient.

Can the Correlation Coefficient Be Negative?

Yes, the correlation coefficient can be negative but cannot exceed -1. A negative correlation would show as a downward slope on a graph.

Can the Correlation Coefficient Be Greater Than 1?

No, the correlation coefficient must be between -1 and 1.

What Is the Pearson Correlation Coefficient Calculator?

The Pearson correlation coefficient calculator is a metric that divides the covariance of two variables by the product of their standard deviations.