Understanding Volatility Performance with PCA

Anthony Maylath
Jul 5, 2020 · 18 min read

Historical profit and loss data (PnL) can be a useful tool to inform decision making. When traders or portfolio mangers analyze PnL data, they typically look for trends that drive the attribution. For instance, if a trader holds long positions in ten stocks, she may find that large losses come from one particular stock. Such performance could be a signal to reduce exposure on the non-performing stock. It’s easy to visualize the analysis as we could simply plot our cumulative PnL with the stock price. Most likely, the large PnL occurred on days when the stock saw sharp declines. We could go a step further by attributing performance by sector among several stocks. For instance, maybe performance over the Technology sector was particularly poor.

In contrast to a portfolio of simple stocks, consider a portfolio of option contracts and assume we are mainly interested in volatility performance. We could proceed in the same way, attempting to identify single contracts or underlying stocks which drove performance. However, this is not the most effective approach as there are strong relationships between the implied volatility of different option contracts on the same underlying stock. If we don’t leverage these relationships, we would have to deal with potentially hundreds of contracts for each underlying stock in our portfolio, significantly complicating the analysis.

In this Medium story, we will show how we can use the Machine Learning technique, PCA (Principal Component Analysis), to aggregate the volatility surface into a few easily interpretable factors which leverage the relationships between option contracts. The PCA factors can be used to attribute portfolio performance to systematic movements in the volatility surface. Such a performance attribution can then be used by portfolio mangers to inform future position allocation and risk management.

What is Implied Volatility?

A trader needs to specify the following three parameters to execute a transaction in an equity option: the strike price of the option, the maturity of the option, and the stock or index underlying the option. For instance, the trader could buy a put option on Apple stock with strike $280 and maturity June 20, 2020. While the trader pays a dollar price for the option, market makers generally quote options by their implied volatility. Implied volatility is the inverse of the Black-Scholes pricing formula with respect to volatility and is typically obtained with numerical methods.

To get a better sense of implied volatility, Figure 1 shows volatility quotes for S&P 500 index options by strike and maturity. For instance, if you want to buy an option with strike 3225.52 and maturity July 2020, you will pay 31 volatility points.

Figure 1: Sample Volatilities for S&P 500 as of 1/31/2020

Moneyness is often used in lieu of strike to standardize volatility quotes. Moneyness is the ratio of strike price and spot price for put options and the ratio of spot price and strike price for call options. For this article, we will simplify and assume moneyness is strike divided by spot, which tends to be market convention. Figure 2a shows the implied volatility plotted against the moneyness for S&P 500 index options with 30 days to maturity. Notice volatilities with lower strikes are higher, indicating traders are willing to pay a premium for out-of-the-money puts. This relationship is known as the volatility skew and occurs as there is large demand for low strike puts to protect traders from market declines.

Figure 2a: Volatility Plotted Against Moneyness

The relationship between implied volatilities and the time to maturity is also important. Figure 2b plots this relationship for at-the-money S&P 500 options. The relationship is known as the Volatility Term Structure. Notice implied volatility slowly increases with larger time to maturity. This upward sloping term structure is the typical configuration for implied volatility and occurs as there is greater uncertainty over longer periods. In periods of large market volatility, such as the Financial Crisis of 2008 or the COVID-19 Crisis of 2020, the short term implied volatility can actually spike above long term levels.

The PCA methods that we present later in the article will leverage the relationships between volatility, moneyness, and time to maturity to arrive at simplified volatility factors.

Figure 2b: The Volatility Term Structure


Say you start trading options on the S&P 500 Index. You decide to trade new contracts every day and hold some positions overnight. Recalling that options are sensitive to movements in volatility, you want to analyze how changes in the implied volatility surface affected your positions over the past year. How can we check this? One basic approach is to simply take the difference between each point on the volatility surface over the past year and compare these differences to your initial positions in each contract. Say you try that and find that volatilities are exactly the same as last year. Does this mean volatility did not impact your trading PnL? No. There are two reasons why.

Assume, you have a portfolio of long options that expire in one year and do not actively trade on those options. Then, you are more sensitive to the changes in volatility earlier in the year than later in the year because of vega decay (options with longer time to maturity are more sensitive to volatility). If volatilities decline in the first half year, but increase back to the original value in the second half, you will lose money. Active trading can also cause PnL. Say you are long options at the beginning while volatilities decline, but flip to short while volatilities recover. Again, you lose money when the year over year volatility change is zero. In both cases, to know your profit and loss from volatility, we need to measure how the daily difference of the volatility surface affect our positions for every day of the year. This is not exactly easy to visualize with simple methods. We need a better method to track volatility.

Aggregating Volatility

Let’s go through a simple example to understand better how we can track the volatility surface. Assume all options on S&P 500 with less than 1 year maturity have the same implied volatility. Likewise, assume all S&P 500 options with more than 1 year remaining have the same volatility. Hence, if the 6 month 2500 strike contract moves up by 10% in a given day, you know the 1 month 3500 strike contract also moves up by 10%. Say you want to apply PCA to find the driving factors in this example. Could you guess what those factors will be? Hint: there are two factors. The first factor would be all options with less than one year remaining and the second factor would be all options with two years remaining. If you want to understand better how the two factors drove performance, you can compute the portion of PnL from each factor.

Equation 1 shows how to compute the PnL from the short term factor in this simple example. You simply subtract yesterday’s portfolio value from the portfolio value with factor 1 at today’s value and factor 2 at yesterday’s value. Do this for both factors over a one year period and add up the totals across dates. If one factor has relatively large PnL, you know that factor drove performance. In our simple example, if we see factor 1 PnL was much larger than factor 2 PnL, we know short term volatility was the driver of our performance.

Equation 1: Factor PnL from Short Term Volatility

Principal Component Analysis

PCA is a method to more easily understand variations in data with many features. The method has been routinely used in the world of finance to better understand the interest rate term structure. The term structure application has become so widespread that there is even a Coursera course covering the topic. However, while the application of PCA on equity volatility has been somewhat active in academia, it tends to be less frequently used by practitioners compared to its application on interest rate term structures. This is perhaps because the term structure is only two dimensional while the volatility surface is three dimensional, complicating the analysis and making results harder to visualize. Recent interesting work on volatility PCA in the literature includes Avellaneda, Healy, Papanicolaou and Papanicolaou (2020) where the first principal factor is related to an open interest weighting of option returns. Dobi (2014) relates the first principal factor of options on single stocks to systemic risk, similar to the CAPM model. In contrast, this Medium article will highlight performance attribution applications of PCA on volatility portfolios. Additionally, we place an emphasis on intuition and visualization to make the approach more easily accessible.

A PCA Refresher

Say we have a historical dataset of 20 different indicators. The principal components of the dataset are then the eigenvectors of the covariance matrix of these indicators while the eigenvalues of the covariance matrix represent the significance of each eigenvector. The eigenvector related to the largest eigenvalue is the first principal component. The eigenvector with the second largest eigenvalue is the second principal component, and so on. The first principal component represents the direction of largest variance in feature space while the second principal component represents the direction of largest variance which is unrelated to the first direction, and so on. Put more simply, the first principal component is the most important factor in the dataset. Typically, the first few principal components explain over 90% of the variation in the data, effectively reducing the number of dimensions in our original data set!

Applying PCA to Volatility

A simple way to apply PCA to the volatility surface is by treating each contract as a input feature. For instance, we could start by arranging the volatility data so that each past date is in the rows and each column represents an option contract. Figure 3 represents how the data should look for SPX index options. Notice each contract represents a moneyness and maturity pair. Maturity is expressed in days. Note that I display the data in Figure 3 in volatility units; however, you should difference and standardize the data before performing further computation.

Figure 3: Volatility Data Cleaned for PCA

After cleaning your data to appear in the shape presented in Figure 3, you can apply PCA. For my application, I used the sklearn package in Python. sklearn has a nice PCA function which you can read about here. The results of the PCA include the factors and the singular values which are represented in an sklearn PCA object by the components_ and singular_values_ variables respectively. The factors represent weightings on the columns seen in Figure 3. If we reshape our data back to three dimensions, then a given factor represents a weighted shock on the volatility surface.

Figure 4 graphs the first 4 PCA factors for S&P 500 implied volatility over most of 2019 and early 2020. Figure 5 plots the relative importance of each of the four factors. The factors in Figure 4 can be interpreted as changes in the volatility surface on a particular day. For instance, factor 1 shifts short term volatilities up while shifting long term volatilities down. For the short term, there is also a smile effect where out-of-the-money vols have more significant moves. Factors 2 and 4 rotate the volatility smile with a large impact on short term contracts. Factor 3 applies a convexity effect with the largest shocks on at-the-money options and smaller impacts for long term vols. Figure 5 reveals that the first two factors explain nearly 90% of the variability in the observed volatility data.

Note that the shapes of the factor surfaces depend on the historical volatility fed into the PCA computation. Figure 4 uses data from 2019–2020; however, data from different periods can lead to different surface shapes. In other time periods, the first factor will often be a flat plane which represents a uniform shift of all volatilities.

Figure 4: First 4 Principal Factors
Figure 5: Relative Importance for the First Four Factors

As an alternative to the factors in Figure 4, we could simply apply a 1 dimensional (1D) PCA to the vol surface while keeping either moneyness or maturity constant. Figure 6 shows the first two 1-dimensional PCA factors with time to maturity held constant at 30 days. Factor 1 clearly shows a rotation effect while factor 2 shows a convexity effect.

While 1D PCA factors might be easier to interpret, they have some serious drawbacks. 1D factors assume either a constant maturity or smile. Hence, we need to perform PCA numerous times on each slice of the data to understand how volatilities move across all contract terms. Interaction between moneyness and maturity will be difficult to observe.

Figure 6: First Two Principal Factors with Time to Maturity Constant at 30 Days

By applying each factor to the daily volatility surface, we plot the daily movements of each of the four factors in Figure 7. Notice factors 1 and 2 are much more dynamic than factors 3 and 4. To understand the interpretation of the projected factors, we look at the surfaces in Figure 4 and compare to the evolution of the factors in Figure 7. For instance, factor 1 tends to decline between days 50 through 200. This would correspond to larger long term volatilities and a sharp decline in short term out-of-the-money vols. Likewise, around day 125, we see a big spike in factor 3 which would correspond to larger at-the-money vols and smaller vols for options with low or high moneyness.

Figure 7: First 4 PCA Factors Projected onto the Vol Surface over 1 Year

Performance Attribution

We now use the PCA factors to identify drivers of performance in an option portfolio. If you have experience with option pricing, you may have in mind several risk factors that affect option values such as the stock price or dividend rate. Here, we will only focus on volatility as it is the most complicated and interesting risk factor to model.

Given exposures over a period of time, we can estimate volatility PnL as the vega scaled by the change in volatility. As a reminder, vega is the PnL gained from a 1 point increase in volatility from a particular contract. It is your sensitivity to volatility. For instance, if volatility increases by 3 points, we estimate PnL at 3*vega. We estimate volatility PnL as the change in volatility scaled by vega exposure. Since the option price is not linear in volatility, this is an approximation to the actual volatility PnL. While the real volatility performance will be slightly different from this approximation, our linear approximation is robust enough to fully demonstrate the PCA attribution.

Generating Vega Positions

For the purpose of the article, I will generate random daily vega exposures from February 2019 through January 2020. The generated vegas will have relatively high exposure to short term out-of-the-money and at-the-money contracts as these options tend to be more liquid. Meanwhile, long term and in-the-money contracts will be engineered to have less exposure in the simulation. The random fluctuations in positions are proportional to the size of the current position so that the exposure in a particular contract tends to follow a relatively stable trajectory. I also place constraints on the size of the exposure. Traders typically do the same in practice to limit risk. For the initial vega, I limit the total exposure across contracts to $1 million. Each simulation results in vega exposures for 153 different S&P 500 index options over 251 trading days.

Computing the PNL

To demonstrate the PCA factor attribution, we will compare the total PnL for each day to the factor PnL. If the PnL from a particular factor is a large percentage of the total PnL, then we can say the factor was a driver of performance.

To obtain the total PnL for one day, take the sum product of vegas and volatility differences across contracts, as seen in Equation 2. Note that the PnL formula only considers positions held overnight from the previous trade date. To simplify the analysis, we do not consider intraday performance.

Equation 2: Formula for Total PNL

To obtain the factor PnL, we need a few more steps. Say the P is a matrix containing the PCA factors in its rows. Also say V is a matrix containing the daily differences in implied volatilities with each row representing a contract and each column representing a trading date. The result of the matrix multiplication, P*V, will yield a matrix with a factor size difference for each trade date. Here, each factor is reduced to one number per day. Figure 7 plots the cumulative amount of these daily factors.

We can use the differences in the daily factors to obtain the PnL attribution. For instance, if we want to know how much PnL factor 1 generated on date t, we could take the factor vector and scale it by the change in factor 1 obtained by P*V. Call the resulting vector F. This represents the shocks to each volatility contract from factor 1. Finally, we take the sum product of F and our weighted vegas to get the factor 1 PnL. The general factor PnL is expressed in Equation 3.

Equation 3: Factor pnl Formula

Simulation Results

To ensure fidelity of the factor PnL explanation we first run a regression with the factor PnLs acting as the explanatory variables and the total PnL the dependent variable. If the regression results are good, it suggests that the factors have good explanatory power. I simulate positions and record volatility PnL for 1,200 days to produce the regression data.

Figure 8 shows the regression results generated with the statsmodel package in Python. Most of the figures look good with a high Adjusted R squared of 0.874 and high statistical significance of the first five factors (represented by x1, x2, x3, x4, and x5). This suggests that there is a strong statistical link between the PCA factors and the daily PnL.

While the regression t-statistics and R squared values look promising, the Jarque-Bera value is large due to significant excess kurtosis of the residuals. This is a violation of the regression assumptions and indicates that errors between our model and the actual value can be significant.

Figure 8: Regression Results

To visualize the income attribution coming from the PCA factors, we use stacked bar charts. Factors with positive PnL will have bars above the x-axis while factors with negative PnL are below. The sum between the positive and negative bars is the total factor PnL for the factors appearing on in the graph.

Figure 9 shows the cumulative PnL results of a simulated options portfolio. This is a good example of volatility PnL that’s well explained by the first four factors as the total PnL line is close to the net height of the bars. In the beginning of the period, the PnL is relatively noisy with the results driven by factor 1 with factors 2 and 3 contributing slightly. Factor 1 drives results for the second half of the period.

Figure 9: Simulated PNL Results

While not obvious in the graph, the simulated positions tend to be long factor 1 which hurts performance as this factor tended to decline over the period (see Figure 7). Keeping in mind the factor surfaces in Figure 4, we know losses in factor 1 indicate we suffered from a steepening in the volatility term structure with large declines over short term out-of-the-money volatilities (a steepening occurs when short term volatilities decrease while long term volatilities increase). Perhaps the performance pattern in Figure 9 may influence a trading team to reduce exposure in short term out-of-the-money options or increase the average maturity of the book.

Figure 10 shows another simulation example where the factor PnL well explains total PnL. The total PnL of the first five factors is plotted with a grey line.

Figure 10: Second Simulation with Offsetting Performance

The results in Figure 10 differ from the results in Figure 9 in a few ways. First, we add factor 5. It turns out factor 5 drives performance in the beginning of the period. In the latter half of the period, we can see offsetting PnL between factor 1 and factors 2 and 3. While factor 1 alone overestimates the total PnL, the offsetting factors bring the net factor estimates close to the total PnL. We can see this in the graph as the grey line tends to track the black line well.

The simulated portfolio in Figure 10 tends to be long factor 1 for most of the period which causes losses similar to what is seen in Figure 9. Different from Figure 9, the Figure 10 simulation takes important positions in factor 2 and factor 3 that mitigate the factor 1 losses. A strategist may use this information to flatten positions on factor 1 while keeping open positions in factors 2 and 3. Due to its status as the largest principal component, smaller factor 1 positions would significantly reduce PnL fluctuations. Meanwhile, maintaining positions over factors 2 and 3 will carry smaller a risk profile. Given the positive performance over the second two factors during the period, it may also make sense to allocate more capital to factors 2 and 3 due to their relative outperformance.

When Things Go Wrong

While results in Figures 9 and 10 are desirable, the excess kurtosis seen in Figure 8 can result in large errors between the total PnL and the factor PnL. Large errors can also occur if the option positions we hold are independent from the principal factors. For instance, if the portfolio is concentrated in at-the-money options with maturity around 6 months, factor 1 won’t explain much PnL because its shock on these contracts is small.

If the PnL from the largest factors does not explain total PnL, we could simply check other PCA factors. After all, if we add enough PCA factors we can perfectly replicate the total PnL. A potential problem with this approach is that each additional factor yields diminishing marginal benefit and often results in too many factors. If we need 20 factors to explain performance, the results may not be easy to interpret.

If adding more PCA factors does not work well, we could try a slightly different methodology. For instance, if our positions don’t vary much across moneyness, we could perform a 1D PCA across maturities, keeping moneyness constant. Alternatively, we could use a method other than PCA to obtain the factors. For instance, Cont and da Fonseca (2002) use Karhunen-Loeve decompositions to obtain factors. The method is similar in principal to PCA, but can produce different results that may better explain total PnL.

Concluding Remarks

When forming a volatility strategy, it is often helpful to know the drivers of past performance. However, given the three dimensional structure of the volatility surface, it’s difficult to visualize drivers of performance by computing the daily PnL over a long period.

To improve performance attribution, we showed a relatively simple method practitioners can use to identify patterns of volatility that drive portfolio performance. The method involves a principal component decomposition to identify the largest factors impacting the volatility surface. Such factors usually have nice geometric shapes as seen in Figure 4 and are often easy to interpret. We can use the most significant factors to shock a portfolio of options, producing factor attribution. The factors that have large PnL can be classified as the drivers of performance and could be used to influence risk management and portfolio allocation.

To achieve the results in this article, I flatten the volatility surface into a vector of contracts and apply standard PCA. More sophisticated methods exists which can produce potentially superior results. Particularly, the work of Cont and da Fonseca (2002) comes to mind. In their paper, the duo uses the Karhunen-Loeve decomposition to find the dominant volatility factors.

The application of PCA to volatility PnL goes beyond the historical performance analysis discussed in this article. The method can also be useful in stress testing. Rather than applying a uniform volatility stress to a portfolio (such as shocking all volatilities by -10%), we can instead shock the largest principal factors observed in the volatility data. When calibrating such a stressed shock, it might be helpful to compute principal components using data from a stressed period to best mimic how volatility will evolve in such an event. For a follow up to this article, it might be interesting to compare the stressed PnL from uniform shocks to the stressed PnL from principal component shocks.


Thanks to Andrew Papanicolaou (New York University) for reviewing this article and providing inspiration with his research on PCA.

Thanks to Balazs Khoor (Guggenheim Partners) and Sandeep Saju (Société Générale) for reviewing this article and providing constructive feedback.


Volatility Data Resourced from https://www.ivolatility.com/

Marco Avellaneda, Brian Healy, Andrew Papanicolaou and George Papanicolaou, “PCA for Implied Volatility Surfaces.” arXiv, January 2020

Doris Dobi, “Modeling Systemic Risk in The Options Market.” New York University, May 2014

Rama Cont and Jose da Fonseca, “Dynamics of implied volatility surfaces.” Quantitative Finance, Volume 2. Institute of Physics Publishing, Feburary, 2002

Karl Polen, “Brinson Attribution.https://karlp-asrs.github.io/Brinson-attribution/brinson-attribution.html

Dimitris Lianoudakis, “Statistical Analysis of Volatility Surfaces.” Concordia University, September, 2012