Linear Algebra for Finance

Principal Component Analysis for Finance

In today’s era of advanced financial analytics, quantitative concepts that have been around for quite some time are finding their applications in the domain of Finance. In recent times the explosion of data courtesy of the big data revolution is impacting almost all industries and financial industry is no exception to this. Sophisticated mathematical techniques are making rapid inroads into various areas of finance especially financial analytics.

One such concept that has been borrowed from linear algebra which is a branch of mathematics is the concept of Principal Component Analysis (hereinafter also referred to as ‘PCA’). PCA has found application in many areas of finance including yield analysis, risk management etc. In this post we will discuss how PCA can be used for the purpose of risk measurement of a portfolio.

For any financial institution be it a bank, insurance company, NBFI etc., interest rate is a key risk factor which must be managed. Market quotes interest rates for various tenors ranging from overnight rates up to say 30 years, thus there are more than 15 tenor points for which market interest rate quotes are available. Financial firms have ready systems for fetching this market data for further usage. Now this data on a daily basis and further considered over a long period of time is huge in volume. It would be inefficient to use all of the available data for further analysis, the reason being not all of the available data will be used for the purpose of managing risk i.e. not all tenor points contribute significantly to the risk measurement of the portfolio. Thus, if we can have a mathematical model to process the incoming data and select only those interest rate tenor points which contribute to the risk of the company’s portfolio, it would make the model highly efficient for usage thereby enhancing overall system performance. By doing this we would have a fast calculator for measuring the risk of a bond portfolio. We chose a bond portfolio because plain vanilla bonds have one source of risk factor i.e. interest rate only, assuming we ignore the default risk for now.

PCA as a concept is useful for measuring risk arising from a set of correlated market variables. Interest rates that are quoted in the market have correlation to each other. Thus, an interest rate for tenor 1Y is not independent of interest rate for tenor say 3Y. There is always some degree of correlation between all the tenor points with each other. To achieve this objective, the PCA model computes a set of variables that are called as Principal components (PCs). PCA is a model which involves transforming a set of observations (i.e. interest rate time series in our case) into a set of uncorrelated variables called as the PCs. This transformation behaves in way such that the first PC explains the largest possible variance, and this accounts for majority of the variability in the data. Each succeeding component in turn explains the highest possible variance while at the same time following the condition of orthogonality to each of the preceding PCs. Orthogonality is a property in linear algebra which is used to test if two vectors are perpendicular to one other i.e. the two vectors are uncorrelated with one another.

Orthogonal Vectors. The essence of a PCA model (image source: internet)

Resulting PCs computed by the model are uncorrelated to each other, thereby allowing them to be used independently with respect to each other. Individual PCs are calculated using the concept of Eigen values again a concept of linear algebra. PCs represent directions of the data that explain the maximum amount of variance, i.e. the vectors that capture most of the information that is embedded in the data. The relationship between the variance and information is that, the larger the variance carried by the vector, the larger the dispersion of the data points along it, and larger the dispersion along the vector, the more information it contains.

PCA algorithm performs dimensionality reduction on the data set. Dimensionality reduction implies, we attempt to capture the essence of a multivariate dataset into fewer number of variables that would explain the required result.

So subsequent to generation of individual PCs, only those PCs are selected that explain the maximum variation thereby capturing the essence of the analysis. Machine learning algorithms implementing the concept of Principal Component Analysis (PCA) can be used to this end. A PCA algorithm accepts all of the incoming interest data as an input, and it processes the data so that as an output we get a certain set of interest rate tenor points which contribute to around say 97% to 98% of the risk of our interest rate sensitive portfolio. This is technically termed as dimensionality reduction as mentioned earlier. This substantially reduces the load on the system resources, since now, the system will use only those tenor points as have been chosen by the PCA algorithm. This enables freeing up of valuable system resources which now can be used for other productive purposes. PCA can be implemented in Python.

Below given is the algorithm for implementation of PCA model for risk measurement, we will discuss the Python code for the same in a later post

PCA algorithm involves the following steps:

1. Standardization:

This step involves standardizing the input variables so that they may be used in the PCA analysis. Accuracy of PCA algorithm is a function of the accuracy of inputs. So, in the very first step of the algorithm, we perform a standardization which results in all variables getting transformed to a same scale. This builds the foundation of the PCA analysis.

2. Covariance matrix:

This step involves computation of a covariance matrix which gives the relationship between the input variables. A covariance matrix is a symmetric matrix. With the diagonal elements giving the correlation, and the off-diagonal elements giving the covariance between variables. Depending on the sign of the covariance, the algorithm understands whether there is a direct or an inverse relation between variables. This step is important with respect to dimensionality reduction, as highly correlated variables may convey redundant information so the algorithm may appropriately handle these during the analysis.

3. Eigen algebra:

Eigen values and Eigen vectors are calculated from the covariance matrix computed in the step above. Eigenvectors of the covariance matrix are the direction of the axes where there is most variance i.e. most information. These are the PCs. Eigen values are the coefficients attached to the eigen vectors; they explain the amount of variance carried by each of the PCs. By ranking the eigen vectors in the order of their eigen values, we get the PCs in order of their significance. Next, we choose only the top 2 or top 3 PCs. The reason being, that its these top 2 or top 3 PCs that explain most of the variance in the data. Generally, top 3 PCs explain more than 97% of the variance in the data. Out of the top 3 PCs the first PC is attributed to account for parallel shifts in the rates, second PC is attributed to account for steepening of the curve, third PC is attributed to account for bowing of the interest rate curve. We also compute the standard deviations of the same called as factor loadings. These factor loadings will be used for further steps

4. Interest Rate sensitivity data:

The bond portfolio’s interest rate sensitivity is computed using a separate model. This sensitivity is the PV01. PV01 is calculated by a separate model for each of the tenor points. Thus we have a column matrix of PV01 for respective tenor points

5. Risk Measurement of the portfolio:

This step is implemented in two sub-steps:

a. In the first step, the respective PC (computed above) is multiplied by the PV01 for that tenor (pv01 computed in step 4 above). This will give the computation result for exposure to respective PC factors namely first, second and third PC factor.

b. In this step standard deviation of the portfolio is computed as below:

σ (portfolio) = √ (w1² * σ1² + w2² * σ2² + w3² * σ3²)

with w1, w2 and w3 computed in step ‘a’ above.

σ1, σ2, σ3 is the standard deviation of the factor loadings arrived at using step 3 above.

It is worthwhile to note that there is no correlation term involved in the formula of σ (portfolio). The reason being that the PCs are independent of each other and thus correlation between them is 0.

c. Next assume we are calculating the 99% 1-day VaR of the portfolio, then the portfolio VaR is given by formula σ (portfolio) * 2.33.

This is the risk measurement of the portfolio using PCA methodology. There are multiple other models that are used for risk measurement of the portfolio. PCA model provides one more viable alternative for calculation of portfolio risk. In a later post we will discuss the implementation of PCA algorithm for risk measurement by developing a model using Python programming.

Founder: FinQuest Institute; www.finquestinstitute.com