Search
CoursesStock researchPaper tradingNews
HomeAbout
Learn › University level › RS 205 › Module 7

Module 7 · Correlation Advanced

Calculate covariance and correlation and avoid the main errors in interpreting them.

RS 205 Statistics for Investors · By · ~6 min read, ~1.5 hr with practice · Not started

By the end of this module you'll be able to

  • Calculate covariance and correlation and avoid the main errors in interpreting them.

Covariance

The average product of two variables' deviations from their means. A positive value means they tend to move together. Its size depends on the units, so it is hard to read on its own.

Correlation

Covariance divided by the product of the two standard deviations. It always lies between minus 1 and +1 and has no units.

Worked example

Five paired observations.

X Y X deviation Y deviation Product
1 2 -2 -1 2
2 1 -1 -2 2
3 4 0 +1 0
4 3 +1 0 0
5 5 +2 +2 4

Both means are 3. The sum of products is 8, so the sample covariance is 8 / 4 = 2. Both sample variances are 2.5. Correlation = 2 / (square root of 2.5 x square root of 2.5) = 2 / 2.5 = 0.80.

What correlation measures

Only the strength of a straight-line relationship. Two variables can be strongly related in a curved way and show zero correlation. A single outlier can create or destroy a correlation. Always look at a scatter plot.

Correlation and explained variance

In a two-variable relationship, the share of one variable's variance explained by the other is the correlation squared. A correlation of 0.6 explains 36%; a correlation of 0.3 explains only 9%.

Is it significant?

t = r x square root of (n minus 2) / square root of (1 minus r^2). A correlation of 0.30 from 38 observations gives t = 0.30 x 6 / 0.954 = 1.89, just short of significance at the 5% level. Small-sample correlations are unreliable.

Correlation is not causation

Three other explanations must be ruled out:

Two series that both trend upward over time will be highly correlated in levels even if unrelated. Correlate changes or returns, not levels (Module 9).

Correlations change

They are estimates over a window and drift with the regime. Compute rolling correlations (for example over 36 months) to see the variation. Correlations between risky assets tend to rise sharply in crises, which is when diversification is most needed. The stock-bond correlation has been negative for long stretches and positive in others, including 2022.

Rank correlation

Spearman's correlation uses the ranks of the data instead of the values. It is less sensitive to outliers and captures any consistently rising or falling relationship.

The correlation matrix

A table of the correlations between every pair of assets in a portfolio. Together with the volatilities, it gives everything needed to compute portfolio risk (RS 302, Module 3).

More worked examples

Worked example 2: Pearson and Spearman disagree

X is 1, 2, 3, 4, 5 and Y is 1, 4, 9, 16, 100. Every increase in X brings an increase in Y, so the ranks match perfectly and Spearman's correlation is 1.0. Pearson's correlation is lower, about 0.8, because the relationship is far from a straight line and the last point dominates. When data are skewed or have outliers, compute both.

Correlation and beta

Beta = correlation x (stock volatility / market volatility). A stock with a correlation of 0.8 with the market, volatility of 30% and market volatility of 20% has a beta of 0.8 x 1.5 = 1.2. Two stocks with the same beta can have very different correlations: a volatile stock with a low correlation and a quiet stock with a high one.

Sample size and significance

The t-statistic for a correlation grows with the square root of the sample. A correlation of 0.30 from 38 observations gives t = 1.89, not significant; the same correlation from 102 observations gives t = 0.30 x 10 / 0.954 = 3.14, highly significant. With large samples, tiny correlations can be significant and still useless (Module 6 on economic significance).

Negative correlation is valuable

An asset with a correlation of -0.2 to the rest of a portfolio reduces risk even if its own volatility is high, because it tends to rise when the portfolio falls. This is why investors pay a premium, through lower expected returns, for assets that perform well in crises, such as long government bonds in a deflationary recession.

Worked example 3: correlation that appears only in a crisis

Over a calm decade, two credit funds show a monthly correlation of 0.2. In the three months of a credit crisis, both fall sharply and the correlation over those months is 0.9. A full-period figure of 0.3 hides this. Compute correlations separately for down markets, or look at how often both assets lost money in the same month.

Practical checklist

Use returns, not prices; check the scatter plot; compute rolling and down-market correlations; compare Pearson with Spearman; and ask whether there is an economic reason for the relationship.

Put it into practice

Your mission

Compute the correlation of monthly returns between your stock and the index over the full ten years, then as a rolling 36-month series, and chart it. Then compute the correlation between the two price levels and explain why it is misleadingly high.

Download a price history to work with →

Educational content only; not investment, tax or legal advice. Companies, tickers and figures are illustrative examples, not recommendations. Rules, rates and limits change, so check current details with the regulator, exchange or tax authority before relying on them. Worked examples are not forecasts. Written by Elizabeta Dimoska. RiskStock is not a registered dealer or adviser.