šŸ’¼ Diving Into Portfolio Management: Understanding Portfolio Variance

Recently, I began a new challenge: investing in stocks. One of the first questions I thought about was—regardless of individual returns—how could I best create an optimal investment set of assets?

This led me into the world of portfolio management.

After reading about Markowitz’s theory of optimal portfolios, I learned that constructing an ideal portfolio relies on just two components:

  1. Expected return (mean)
  2. Variance or volatility of the portfolio

Based on this framework, each combination of possible portfolios occupies a unique space in the risk–return plane, forming what we call the efficient frontier. (We’ll skip over the theoretical backdrop for now.)


āš ļø The Key Problem

Given we know the volatility and return of all stocks, how do we efficiently find:

  1. The variance of a given portfolio
  2. The expected return of a given portfolio

I’ll come back to the second part in another blog.
Today, I’m focusing on:

šŸ“Š How Do We Calculate the Variance of a Portfolio?

Let’s break it down in practical, mathematical terms.

Single Index model

A key problem when calculating the variacne of a portfolio, \(\sigma_p^2 = \sum_{i=1}^{n} \sum_{j=1}^{n} w_i w_j \sigma_i \sigma_j \rho_{ij}\)

🧠 Why Covariance Matrices Explode with Portfolio Size

When analyzing a portfolio, one key ingredient is the covariance matrix—the foundation for calculating portfolio variance, optimal weights, and risk. But as the number of assets grows, so does the matrix… fast.

What Is a Covariance Matrix?

It’s a table showing how each asset moves in relation to the others. If you’re analyzing n stocks, you need an n Ɨ n matrix to account for every pairwise relationship—including each asset’s own variance.

āš–ļø Scaling Example

  • With 3 stocks, the matrix size is
    ( 3 \times 3 = 9 ) components
  • With 100 stocks, the matrix balloons to
    ( 100 \times 100 = 10{,}000 ) components 😬

That’s 10,000 entries just for one statistical matrix!

###šŸ’” Are All Components Unique?

Nope. Since the covariance matrix is symmetric, only the upper (or lower) triangle and diagonal contain unique data. The number of distinct elements is:

\[\frac{n(n + 1)}{2}\]

So for 100 stocks:

\[\frac{100 \times 101}{2} = 5{,}050\]

Still huge—just not as bad as 10,000!

šŸ“ˆ Why It Matters

As portfolios scale into dozens or hundreds of assets, computing and inverting the covariance matrix becomes more intensive.

How the Single Model Index simplifies this process?

We since we don’t want to do all these calculation, we can simplify this process by compared each stock in our portfolio to a given market index. We ā€˜assume’ that all stocks move with a a given market index. That is the return of any given stocks and made of, (1) Our Chosen market index , known as systmetic risk and (2) firm specific risk including company perforamcen, knownn as our unsystematic risk.This relation ship can be show through

\begin{equation} R_i = = \text{unsystematic risk + systematic risk} = \alpha_i + \varepsilon_i + \beta_i R_m \end{equation}

Now, $\alpha$ is the portion of our stock’s return not explained by the market; $\varepsilon_i$ is our ā€˜variation’ or error term that is specific to the firm. These are unpredictable and uncorrelated with market movements — think scandals, product launches, or failures. Importantly, our $\beta$ represents the expected change in our stock’s return, $R_i$, given a change in the market index, $R_m$.

As you would note, the Single-Index Model assumes a linear regression — that is, our stock return is linearly related to the market return. This is a strong assumption, but a useful starting point. Of course, we can later assume a non-linear relationship between $R_i$ and $R_m$, which leads us into models like GARCH, polynomial regression, and others.

Lets get into a problem

Monthly return data are presented below for each of three stocks and the S&P index (corrected for dividends) for a 12-month period. Calculate the following quantities:

  1. alpha for each stock

  2. beta for each stock

  3. the standard deviation of the residuals from each regression

  4. the correlation coefficient between each security and the market

  5. the average return on the market

  6. the variance of the market

Exploratory Data Analysis

Time Series Plot

timeseries-of-stock

By Visual Inspections we can note with S&P as our benchmark

  • there a period of correlation for all three stocks A,B,C followed by some period.

  • From a visual inspection the highest correlated stock is A.

  • Seasonality:
    • 1-2 : decline

    • 5 - 6 : all stock prices declined

    • 10 - 12 : all stock prices declined

  • Stock C is extremelt volitile compare to other stocks

Single Index Model Implementation

Step 1 : Creating a linear regression to find our $\beta$, $a_i$

Given in a Single Index Model we assume the relation between a given stocks is based on the market index. Suppose we have a S&P500 as our market index. Now we can find out create a linear regression $ R_i = a_i + \beta_i R_m + \epsilon $. Graphing these result,

beta regression

Now given we can estimate the return of reach individual stock given by

\[\mathbb{E}[R_i] = \alpha_i + \beta_i \mathbb{E}[R_m]\]

Using our data, we can calculate our expected market return $ \mathbb{E}[R_m] = 3.005 $. From this for each stock A,B,C we can calculate our Expected return for each stock

\[\begin{aligned} \mathbb{E} \begin{bmatrix} R_a \\ R_b \\ R_c \end{bmatrix} &= \begin{bmatrix} a_a \\ a_b \\ a_c \end{bmatrix} + \begin{bmatrix} \beta_a \\ \beta_b \\ \beta_c \end{bmatrix} \cdot \mathbb{E}[R_m] \\ &= \begin{bmatrix} -0.61 \\ 3.25 \\ -0.13 \end{bmatrix} + \begin{bmatrix} 1.18 \\ 0.98 \\ 2.4 \end{bmatrix} \cdot 3.005 \\ &= \begin{bmatrix} 2.9359 \\ 6.1949 \\ 7.082 \end{bmatrix}. \end{aligned}\]