Lesson 463 asked why several stocks you bought fall all at once, and Lesson 286 and Lesson 436 covered how to add up the risks of assets that move together. This lesson turns the same question into statistics. Given the returns of 30 assets, how many independent risks are there really?
Principal component analysis is a calculation that finds, from the largest down, the directions in which many returns move together. It is easy to use, and its traps are just as clear. With a short sample, convincing principal components appear even in noise with no relationship at all, and the directions of the second and third principal components change from sample to sample. This lab sets synthetic assets built from three common factors next to pure-noise assets and measures how large these effects are.
No real index or factor data are used. Every number is an example computed from synthetic data and says nothing about the factor structure of any market.
1. Experiment design: 30 assets built from three factors
The data are synthetic data made with fixed seeds. The monthly return (%) of each of 30 assets is the sum of the movements of three factors, each multiplied by that asset's own exposure (beta), plus an individual noise term. The factors have standard deviations of 4%, 2% and 1.5%, and the individual noise is 6%. Every asset has an exposure of about 1 to the first factor. For the second factor, the first 15 assets have exposures of about +1 and the last 15 about −1. The exposures to the third factor are random by asset.
The pure-noise data used for comparison are returns with the same volatility for each asset and no relationship between assets. The exposures were set once with seed 20263501, and the returns were made repeatedly with the 50 seeds 20263502 to 20263551, set before the lesson was written. The sample lengths are 36, 120 and 600 periods (3, 10 and 50 years if monthly), and the numbers in the text are medians of the 50 seeds.
The calculation is a hypothetical example for teaching. It finds the principal components of the correlation matrix of returns and regresses the return of an assumed account on the factor returns. It is not a trading rule.
2. What principal components tell you
A principal component of the correlation matrix is a set of weights that mixes the 30 assets, and its eigenvalue is the size of the variance that moves in that direction. The eigenvalues of a correlation matrix add up to the number of assets, 30, so eigenvalue ÷ 30 is read as the share of variance that the principal component explains. If the assets were independent, no direction would be special, and every principal component would get an equal share of 1 ÷ 30 = about 3.3%.
In the true structure of these settings, the first principal component explains 29.1%, the second 10.0% and the third 4.9%, and the three together explain 43.9%. The first principal component is the direction in which all assets move the same way, so it is often called the market factor, but that name was not given by the calculation.
Seen through an account, the number of risks is clearer still. With equal weights on the 30 assets, 93.0% of the account's variance comes from the three factors. The account's monthly volatility is 4.13%, lower than the median of 7.56% for one asset, but almost all of the volatility that remains is factor risk. Thirty stocks are not 30 independent risks; they are a few large risks with small individual risks attached.
3. A large first principal component appears even in pure noise
Doing the same calculation on samples changes the numbers. The table below shows the share of variance explained by each principal component (medians of 50 seeds).
| Sample length | Factor data, first | Factor data, second | Factor data, third | Pure noise, first |
|---|---|---|---|---|
| 36 periods | 29.7% | 11.4% | 7.1% | 10.7% |
| 120 periods | 29.3% | 10.5% | 5.7% | 6.9% |
| 600 periods | 29.0% | 10.1% | 5.0% | 4.8% |

Even for 30 unrelated assets, the first principal component explained 10.7% of the variance in the 36-period sample. That is three times the true value of 3.3%. If three years of monthly returns gave the result "a hidden factor linking the assets explains a tenth of the variance," that size alone cannot tell it apart from noise.
The factor data's third principal component, at 7.1%, is smaller even than the pure-noise first principal component of the same length, at 10.7%. Even when a true factor exists, if it is weak it looks smaller than noise in a short sample. As the sample grows, the share of noise shrinks and the shares of the factor data move toward their true values.
4. How many to keep: comparing with the ceiling that noise creates
Marchenko and Pastur (1967) showed a distribution under which, for N independent assets observed T times, with N and T both large, the eigenvalues of the sample correlation matrix lie roughly below (1 + √(N ÷ T))². Laloux and others (1999), "Noise Dressing of Financial Correlation Matrices," applied this ceiling to correlation matrices of financial returns and reported that most eigenvalues below the ceiling cannot be told apart from noise.
At the sample lengths of this lesson, the ceiling is 3.66 for 36 periods (12.2% of variance), 2.25 for 120 periods (7.5%) and 1.50 for 600 periods (5.0%). The median number of eigenvalues above the ceiling was 1 for 36 periods, 2 for 120 periods and 3 for 600 periods, and even at 600 periods only 54% of seeds had all three above it. There are three true factors, but the shorter the sample, the more the weak factors were buried below the noise, starting with the weakest.
In the pure-noise data, the median number of eigenvalues above the ceiling was 0, but with short samples one eigenvalue sometimes exceeded the ceiling, depending on the seed. The ceiling is an approximation for large samples, so do not declare a single eigenvalue near the boundary to be a factor or noise.
5. The direction and name of the second and third principal components
We measured how closely each principal component's direction resembles the direction of the true structure, using the cosine similarity of the two sets of weights (1 means the same direction, 0 unrelated). The sign is set arbitrarily in each calculation, so the absolute value was used.
The first principal component pointed in almost the same direction even at 36 periods, at 0.98. The second was 0.88 and the third 0.58, and at 36 periods the similarity of the third principal component fell below 0.5 in 40% of seeds. At 600 periods the third was also 0.97.
So be careful about giving names such as "value factor" or "interest-rate sensitivity" to the second and third principal components of a short sample. If you name one because a few weights look large, in the next sample the order may change or the sign may flip, and the same name may point to something else. Principal components are statistical factors without names.
6. Reading an account's factor exposure with regression
The assumed account holds the first 10 assets with equal weights. Its true exposures to the three factors are 0.98, 0.79 and 0.45, and 83.5% of the account's variance comes from the factors. Regressing the account's return on the returns of the three factors estimates the exposures. In practice the factor returns have to come from public data or from series you build yourself, but here the synthetic factors are used as they are.
| Sample length | First exposure | Second exposure | Third exposure |
|---|---|---|---|
| 36 periods | 0.99 (0.86 to 1.09) | 0.77 (0.51 to 1.07) | 0.38 (−0.12 to 0.76) |
| 120 periods | 0.96 (0.91 to 1.05) | 0.78 (0.58 to 0.93) | 0.42 (0.23 to 0.58) |
| 600 periods | 0.97 (0.95 to 1.00) | 0.78 (0.72 to 0.85) | 0.44 (0.37 to 0.52) |
The parentheses give the 5th to 95th percentile of the 50 seeds. At 36 periods, the range of the third exposure crosses 0 into negative values, so with three years of data it is hard to say even whether that exposure exists. The standard errors are also 0.08 for the first, 0.16 for the second and 0.22 for the third (36-period medians); the weaker the factor, the more the exposure estimate swings.
The record for this lesson is a risk-structure box. Write the number of assets and of observations, the share explained by each principal component with the ceiling that noise creates at that length, and the number of principal components above the ceiling. If you named a component, write the basis for the name and its stability in other samples, and add the account's factor exposures with their standard errors.
Try it yourself
- From the table in section 3, read the first principal component's share for the pure-noise data at 36 and 120 periods, and compare it with the true value of 1 ÷ 30 for independent assets.
- Assumptions: 30 assets observed for 60 monthly periods. What is the eigenvalue ceiling created by noise, (1 + √(N ÷ T))², and what percentage of the variance does it correspond to?
- Assumptions: an account holds 50% each in assets A and B. A has exposures of 1.2 to the first factor and 0.5 to the second; B has 0.8 and −0.3. What are the account's two exposures?
- From the table in section 6, read the range of the third exposure at 36 periods, and write what you should record along with this result.
Answers
First, 10.7% at 36 periods and 6.9% at 120 periods. These are about three times and two times the true value of 1 ÷ 30 = about 3.3%. The whole difference is noise from the short sample, and it shrinks as the sample grows.
Second, √(30 ÷ 60) = about 0.707, so (1 + 0.707)² = about 2.91. Then 2.91 ÷ 30 = about 9.7%. At this length, a principal component that does not exceed 9.7% of the variance is hard to tell apart from noise.
Third, the first exposure is 0.5 × 1.2 + 0.5 × 0.8 = 1.0 and the second is 0.5 × 0.5 + 0.5 × (−0.3) = 0.1. An account's exposure is the sum of the asset exposures weighted by the holdings.
Fourth, the range is −0.12 to 0.76. Instead of a single estimate (median 0.38), record its standard error or interval, state the 36 observations and the size of the factor, and note that "with this sample the exposure cannot be told apart from 0."
Data: synthetic data made with fixed seeds. The exposures were set once with seed 20263501 (first factor 1 + 0.3 × standard normal, second factor ±1 + 0.3 × standard normal, third factor standard normal). The returns were made with seeds 20263502 to 20263551 (50 seeds, set before the lesson was written). The factors have monthly standard deviations of 4%, 2% and 1.5%, the individual noise is 6%, and the pure-noise data are independent returns with the same volatility.
Related lessons
- Lesson 436. The math of diversification: correlation and portfolio volatility
- Lesson 469. Monitoring metrics: actual weights, effective exposure, correlation and drawdown
- Lesson 371. How do growth, value, quality and momentum strategies differ?
- Lesson 463. You bought several stocks, so why do they fall all at once?
- Lesson 286. Combined risk and liquidity of stocks that move together
