Portfolio Moments:
An Introduction to Mean-Variance
          Optimization
            Vincent Milhau
      vincent.milhau@edhec.edu
       Academic year 2024-2025
                                   1 / 30
Objectives
    ▶ Calculate the expected return and the variance of a portfolio,
      which will be used in mean-variance optimization (next
      chapter).
    ▶ Calculate the covariance between two portfolios.
                                                                       2 / 30
Outline
  Reminder On Expectation, Variance and Covariance
  Portfolio Expected Return
  Portfolio Variance
  Covariance Between Two Portfolios
                                                     3 / 30
Outline
  Reminder On Expectation, Variance and Covariance
  Portfolio Expected Return
  Portfolio Variance
  Covariance Between Two Portfolios
                                                     4 / 30
Expectation of a Random Variable
  Definition
  The expectation (mean) of a random variable is the mean of
  outcomes weighted by probabilities.
    ▶ Consider a security with 3 possible returns and the associated
      probabilities:
                              11% Up
                 1/6
                                          The expected return is
                 3/6
                              0% Middle   1 × 11% + 3 × 0% − 2 × 5%
                     2/                                             ≈ 0.17%
                          6                           6
                              −5% Down
    ▶ Mathematical notation for the expectation of a random variable
      𝑟, e.g. expected return:
                                    𝔼[𝑟]
                                                                       5 / 30
Variance of a Random Variable
  Definition
  The variance of a random variable 𝑟 is the expected squared
  difference between 𝑟 and its mean:
                             𝕍[𝑟] = 𝔼 [[𝑟 − 𝔼[𝑟]]2 ]
    ▶ Example:
                          [11% − 𝔼[𝑟]]2    The variance is
             1 /6                                  1 × [11% − 𝔼[𝑟]]2
                                           𝕍[𝑟] =
             3/6                                           6
                          [0% − 𝔼[𝑟]]2             3 × [0% − 𝔼[𝑟]]2
                 2/                              +
                      6                                   6
                                                   2 × [−5% − 𝔼[𝑟]]2
                                                 +                   ≈ 0.28%
                          [−5% − 𝔼[𝑟]]2                   6
    ▶ Variance is a measure of risk.
                                                                               6 / 30
Covariance of Two Random Variables
  Definition
  The covariance between two random variables 𝑟1 and 𝑟2 is
                  ℂov [𝑟1 , 𝑟2 ] = 𝔼 [[𝑟1 − 𝔼[𝑟1 ]] [𝑟2 − 𝔼[𝑟2 ]]]
    ▶ Covariance is a measure of the intensity of the comovement
      between two random variables.
  Properties
    ▶ Covariance is symmetric with respect to the inputs:
                             ℂov [𝑟1 , 𝑟2 ] = ℂov [𝑟2 , 𝑟1 ]
    ▶ The covariance of a random variable with itself equals its
      variance:
                               ℂov[𝑟, 𝑟] = 𝕍[𝑟]
                                                                     7 / 30
Outline
  Reminder On Expectation, Variance and Covariance
  Portfolio Expected Return
  Portfolio Variance
  Covariance Between Two Portfolios
                                                     8 / 30
Portfolio Return
    ▶ In mean-variance optimization, we consider a single
      investment period ranging from time 0 to time 1 with
      buy-and-hold portfolios.
    ▶ The return on a portfolio 𝑝 is given by
                  𝑟0,1,𝑝 = 𝑤0,1 𝑟0,1,1 + 𝑤0,2 𝑟0,1,2 + ⋯ + 𝑤0,𝑁 𝑟0,1,𝑁
    ▶ We drop the time subscripts 0 and 1 for notational simplicity.
      Therefore,
                        𝑟𝑝 = 𝑤1 𝑟1 + 𝑤2 𝑟2 + ⋯ + 𝑤𝑁 𝑟𝑁
                                                                         9 / 30
Portfolio Expected Return
    ▶ Denote the constituents’ expected returns with 𝜇1 , 𝜇2 , ..., 𝜇𝑁 and
      the portfolio’s expected return with 𝜇𝑝 .
    ▶ Introduce the column vector of weights and the column vector
      of constituents’ expected returns:
                                 𝑤1                𝜇1
                            𝐰 = [ ⋯ ],        𝛍 = [⋯]
                                 𝑤𝑁                𝜇𝑁
  Property
  If a portfolio is buy-and-hold over the investment period, its
  expected return is the inner product of the vector of weights and the
  vector of constituents’ expected returns:
                                 𝜇𝑝 = 𝐰 ′ 𝛍
                                                                             10 / 30
Mathematical Proof
    ▶ The expectation operator 𝔼 is linear, so
                    𝔼[𝑟𝑝 ] = 𝔼[𝑤1 𝑟1 ] + 𝔼[𝑤2 𝑟2 ] + ⋯ + 𝔼[𝑤𝑁 𝑟𝑁 ]
    ▶ Moreover, weights are known at period start, so they are
      non-random. Hence,
                    𝔼[𝑟𝑝 ] =𝑤1 𝔼[𝑟1 ] + 𝑤2 𝔼[𝑟2 ] + ⋯ + 𝑤𝑁 𝔼[𝑟𝑁 ]
                          =𝑤1 𝜇1 + 𝑤2 𝜇2 + ⋯ + 𝑤𝑁 𝜇𝑁
      which is the inner product of 𝐰 and 𝛍.
                                                                     11 / 30
A 3-Asset Example
    ▶ Assume the following annual expected returns:
        ▶ 10-year bond, 3.5%;
        ▶ Cash, 0.8%;
        ▶ Stock, 10.4%.
                                Bond
                                         30 %
    ▶ Consider the following
      portfolio:                                    50 %       Stock
                                          20 %
                                  Cash
    ▶ Exercise: Calculate the expected return on that portfolio in the
      workbook Portfolio_moments.xlsx. (Think of the function
      SUMPRODUCT.)
                                                                         12 / 30
Outline
  Reminder On Expectation, Variance and Covariance
  Portfolio Expected Return
  Portfolio Variance
  Covariance Between Two Portfolios
                                                     13 / 30
Portfolio Variance and Constituents’ Covariances
    ▶ Reminder: the return on a buy-and-hold portfolio is the
      weighted sum of constituents’ returns:
                           𝑟𝑝 = 𝑤1 𝑟1 + 𝑤2 𝑟2 + ⋯ + 𝑤𝑁 𝑟𝑁
    ▶ The portfolio variance depends not only on the constituents’
      variances, but also on their covariances (interactions).
    ▶ Standard notation for the portfolio variance: 𝜎𝑝2 , i.e.,
                                    𝜎𝑝2 = 𝕍 [𝑟𝑝 ]
                                                                     14 / 30
The 2-Asset Case
    ▶ The variance of a 2-asset portfolio is
                               2                              2
        𝜎𝑝2 = 𝑤12 ×          𝜎⏟1            +𝑤22 ×          𝜎⏟2
                      variance of asset 1            variance of asset 2
                                                     + 2𝑤1 𝑤2 ×               𝜎12
                                                                              ⏟
                                                                   covariance of assets 1 and 2
    ▶ A negative covariance reduces the portfolio variance.
    ▶ A positive covariance increases the portfolio variance.
                                                                                                  15 / 30
Portfolio Variance Calculation for 𝑁 = 2
    ▶ We have
      𝕍[𝑤1 𝑟1 + 𝑤2 𝑟2 ] = ℂov[𝑤1 𝑟1 + 𝑤2 𝑟2 ,
                            𝑤1 𝑟1 + 𝑤2 𝑟2 ]     (variance equals self covariance)
                       = 𝑤1 𝑤1 ℂov[𝑟1 , 𝑟1 ]
                            + 𝑤1 𝑤2 ℂov[𝑟1 , 𝑟2 ]
                            + 𝑤2 𝑤1 ℂov[𝑟2 , 𝑟1 ] (covariance is linear in both arguments)
                            + 𝑤2 𝑤2 ℂov[𝑟2 , 𝑟2 ]
                       = 𝑤12 𝜎12 + 𝑤22 𝜎22
                            + 𝑤1 𝑤2 𝜎12 + 𝑤2 𝑤1 𝜎21        (weights are non-random)
    ▶ Finally, because 𝜎12 = 𝜎21 , we can group terms and obtain
                           𝜎𝑝2 = 𝑤12 𝜎12 + 𝑤22 𝜎22 + 2𝑤1 𝑤2 𝜎12
                                                                                      16 / 30
The 3-Asset Case
    ▶ The variance of a 3-asset portfolio contains 3 variance terms and
      3 covariance terms:
        𝜎𝑝2 = 𝑤12 𝜎12 + 𝑤22 𝜎22 + 𝑤32 𝜎32
                                            + 2𝑤1 𝑤2 𝜎12 + 2𝑤1 𝑤3 𝜎13 + 2𝑤2 𝑤3 𝜎23
    ▶ The number of terms grows quickly as the number of
      constituents increases.
    ▶ A more compact expression for the variance is obtained by
      introducing the covariance matrix of the constituents.
                                                                                     17 / 30
Covariance Matrix
  Definition
  The covariance matrix of a set of assets is the matrix of the pairwise
  covariances between returns.
    ▶ Standard notation: 𝚺.
    ▶ Standard notation for the covariance between the returns on
      assets 𝑖 and 𝑗: 𝜎𝑖𝑗 .
    ▶ Covariance matrix of 𝑁 = 3 assets:
                                  𝜎11      𝜎12   𝜎13
                              ⎡
                              ⎢                        ⎤
                                                       ⎥
                      𝚺=      ⎢
                              ⎢
                              ⎢
                                  𝜎21      𝜎22   𝜎23   ⎥
                                                       ⎥
                                                       ⎥
                                  𝜎31      𝜎32   𝜎33
                              ⎣                        ⎦
    ▶ Diagonal elements are variances.
                                                                           18 / 30
Portfolio Variance Formula
  Property
  The variance of a portfolio invested in assets with covariance matrix
  𝚺 with the percentage weights 𝐰 is
                                𝜎𝑝2 = 𝐰 ′ 𝚺𝐰
    ▶ 𝚺𝐰 is a vector, equal to the matrix product of the matrix 𝚺 and
      the vector 𝐰.
    ▶ The variance is the inner product of the vectors 𝐰 and 𝚺𝐰.
    ▶ Useful Excel functions:
        ▶ MMULT: matrix product;
        ▶ SUMPRODUCT: inner product.
                                                                          19 / 30
Proof of Variance Formula
    ▶ The 𝑖th element of 𝚺𝐰 is
                                            𝑁
                                 [𝚺𝐰]𝑖 = ∑ 𝜎𝑖𝑗 𝑤𝑗
                                            𝑗=1
    ▶ Therefore, the inner product of 𝐰 and 𝚺𝐰 is
                                      𝑁
                           𝐰 ′ 𝚺𝐰 = ∑ 𝑤𝑖 [𝚺𝐰]𝑖
                                      𝑖=1
                                      𝑁           𝑁
                                   = ∑ 𝑤𝑖 ∑ 𝜎𝑖𝑗 𝑤𝑗
                                      𝑖=1         𝑗=1
                                      𝑁      𝑁
                                   = ∑ ∑ 𝑤𝑖 𝜎𝑖𝑗 𝑤𝑗
                                      𝑖=1 𝑗=1
                                                        20 / 30
Proof of Variance Formula (Con’t)
    ▶ The portfolio return can be written as
                                              𝑁
                                  𝑟𝑝 = 𝐰 ′ 𝐫 = ∑ 𝑤𝑖 𝑟𝑖
                                              𝑖=1
    ▶ Therefore, the portfolio variance is
                     𝑁
        𝕍 [𝑟𝑝 ] = 𝕍 [∑ 𝑤𝑖 𝑟𝑖 ]
                    𝑖=1
                          𝑁      𝑁
              = ℂov [∑ 𝑤𝑖 𝑟𝑖 , ∑ 𝑤𝑖 𝑟𝑖 ]     (variance equals self covariance)
                          𝑖=1    𝑖=1
                          𝑁      𝑁
              = ℂov [∑ 𝑤𝑖 𝑟𝑖 , ∑ 𝑤𝑗 𝑟𝑗 ]     (change summation index from 𝑖 to 𝑗)
                          𝑖=1    𝑖=1
                                                                                 (1)
                                                                                       21 / 30
Proof of Variance Formula (Con’t)
    ▶ Continuation of calculation:
                       𝑁   𝑁
             𝕍 [𝑟𝑝 ] = ∑ ∑ ℂov [𝑤𝑖 𝑟𝑖 , 𝑤𝑗 𝑟𝑗 ]    (covariance is linear in   (2)
                      𝑖=1 𝑗=1
                                                       both arguments)
                       𝑁   𝑁
                   = ∑ ∑ 𝑤𝑖 𝑤𝑗 ℂov [𝑟𝑖 , 𝑟𝑗 ]      (weights are non-random)
                      𝑖=1 𝑗=1
    ▶ Rewrite the covariance between assets 𝑖 and 𝑗 as 𝜎𝑖𝑗 . Then, the
      portfolio variance is
                                         𝑁   𝑁
                                𝕍 [𝑟𝑝 ] = ∑ ∑ 𝑤𝑖 𝑤𝑗 𝜎𝑖𝑗
                                         𝑖=1 𝑗=1
                           ′
    ▶ It is the same as 𝐰 𝚺𝐰, hence the portfolio variance is
                                    𝕍 [𝑟𝑝 ] = 𝐰 ′ 𝚺𝐰
                                                                                    22 / 30
A 3-Asset Example
    ▶ Consider 3 assets with the following covariance matrix:
                     Bond              Cash             Stock
                  0.003721       0.00108885           0.0005673 Bond
            𝐑 = [0.00108885       0.000441                 0   ] Cash
                  0.0005673           0                0.034596 Stock
    ▶ The corresponding volatilities (square roots of variances) are
        ▶ 10-year bond, 6.1%;
        ▶ Cash, 2.1%;
        ▶ Stock, 18.6%.         Bond
                                              30 %
    ▶ Portfolio composition:                               50 %    Stock
                                               20 %
                                  Cash
                                                                           23 / 30
Variance Calculation in Excel
    ▶ Calculate the portfolio variance and the volatility (square root
      of variance) in the workbook Portfolio_moments.xlsx.
    ▶ Use function MMULT to calculate the first matrix product, 𝚺𝐰.
    ▶ Use SUMPRODUCT to calculate the inner product, 𝐰′ 𝚺𝐰.
    ▶ If you have an “old” version of Excel, you may need to enter an
      array formula to calculate matrix products (see next slide); else
      you can use regular formulas.
                                                                          24 / 30
Array Formulas in Excel
    ▶ Array formulas are only needed for “old” versions of Excel
      (released before Sep. 2018).
    ▶ Some Excel functions return a matrix:
        ▶ MMULT: matrix product;
        ▶ TRANSPOSE: transposition;
        ▶ MINVERSE: matrix inverse.
    ▶ To display the complete matrix, you need to:
        ▶ Highlight the entire range of cells before typing the formula;
        ▶ Press Shift + Enter after typing the formula.
                                                                           25 / 30
Outline
  Reminder On Expectation, Variance and Covariance
  Portfolio Expected Return
  Portfolio Variance
  Covariance Between Two Portfolios
                                                     26 / 30
Covariance Formula
    ▶ Consider two portfolios with the weight vectors 𝐰1 and 𝐰2 and
      the returns 𝑟𝑝,1 and 𝑟𝑝,2 .
    ▶ We have the following result:
  Property
  Consider 𝑁 assets with covariance matrix 𝚺 and 2 portfolios invested
  in these assets with the weight vectors 𝐰1 and 𝐰2 . The covariance
  between the two portfolio returns is
                          ℂov [𝑟𝑝,1 , 𝑟𝑝,2 ] = 𝐰1′ 𝚺𝐰2
    ▶ Consider a portfolio 𝐰 and fix an asset 𝑖, let 𝐰2 = 𝐰 and let 𝐰1
      represent a portfolio 100% invested in asset 𝑖. Then, the
      covariance between asset 𝑖 and the portfolio 𝐰 is the 𝑖th
      element of the vector 𝚺𝐰.
        ▶ In other words, 𝚺𝐰 is the vector of covariances between the
          portfolio 𝐰 and the constituents.
                                                                         27 / 30
Proof for 𝑁 = 2
    ▶ Consider 2 assets with returns 𝑟𝐴 and 𝑟𝐵 , and 2 portfolios
      invested in these assets with the percentage weight vectors
                                   𝑤                         𝑤𝐴,2
                             𝐰1 = [ 𝐴,1 ] ,         𝐰2 = [        ]
                                   𝑤𝐵,1                      𝑤𝐵,2
    ▶ Portfolio returns:
                                   𝑟𝑝,1 = 𝑤𝐴,1 𝑟𝐴 + 𝑤𝐵,1 𝑟𝐵
                                   𝑟𝑝,2 = 𝑤𝐴,2 𝑟𝐴 + 𝑤𝐵,2 𝑟𝐵
    ▶ By using the bilinearity of covariance, we have that the
      covariance between the two portfolios is
        ℂov [𝑟𝑝,1 , 𝑟𝑝,2 ] = 𝑤𝐴,1 𝑤𝐴,2 ℂov [𝑟𝐴 , 𝑟𝐴 ] + 𝑤𝐴,1 𝑤𝐵,2 ℂov [𝑟𝐴 , 𝑟𝐵 ]
                                  + 𝑤𝐵,1 𝑤𝐴,2 ℂov [𝑟𝐵 , 𝑟𝐴 ] + 𝑤𝐵,1 𝑤𝐵,2 ℂov [𝑟𝐵 , 𝑟𝐵 ]
                                                                                          28 / 30
Proof for 𝑁 = 2 (Con’t)
    ▶ Rewrite with the usual notation 𝜎𝑖𝑗 for the covariance between 𝑖
      and 𝑗:
        ℂov [𝑟𝑝,1 , 𝑟𝑝,2 ] = 𝑤𝐴,1 𝑤𝐴,2 𝜎𝐴𝐴 + 𝑤𝐴,1 𝑤𝐵,2 𝜎𝐴𝐵
                                                  + 𝑤𝐵,1 𝑤𝐴,2 𝜎𝐵𝐴 + 𝑤𝐵,1 𝑤𝐵,2 𝜎𝐵𝐵
    ▶ The covariance matrix of the two assets is
                                         𝜎       𝜎𝐴𝐵
                                    𝚺 = [ 𝐴𝐴         ]
                                         𝜎𝐵𝐴     𝜎𝐵𝐵
    ▶ Therefore,
                                     𝜎 𝑤 + 𝜎𝐴𝐵 𝑤𝐵,2
                              𝚺𝐰2 = [ 𝐴𝐴 𝐴,2             ]
                                     𝜎𝐵𝐴 𝑤𝐴,2 + 𝜎𝐵𝐵 𝑤𝐵,2
    ▶ Therefore,
        𝐰1′ 𝚺𝐰2 = 𝑤𝐴,1 𝜎𝐴𝐴 𝑤𝐴,2 + 𝑤𝐴,1 𝜎𝐴𝐵 𝑤𝐵,2
                                                  + 𝑤𝐵,1 𝜎𝐵𝐴 𝑤𝐴,2 + 𝑤𝐵,2 𝜎𝐵𝐵 𝑤𝐵,2
                                                                                    29 / 30
Implementation in Excel
    ▶ Do the calculation in the workbook Portfolio_moments.xlsx.
    ▶ We consider 2 portfolios invested in bonds, cash and stocks.
                                                                     30 / 30