Skip to content

Expected return and variance of an equally weighted portfolio

Course exercise 32 · Part I

Problem

Five stocks have expected returns \(\mu\) and a given variance-covariance matrix \(\Sigma\). Build the equally weighted portfolio and compute its expected return and variance.

Method

With \(n\) stocks the equally weighted portfolio puts \(x_i = 1/n\) in each. Then:

\[ \mathbb{E}[R_p] = \mu\, x, \qquad \sigma^2_p = x^\top \Sigma\, x \]

Code

clear all, clc

% Expected return and risk (variance) of an equally weighted portfolio.

% Input data
% 1. Vector of expected returns (mu) for the 5 stocks
mu = [0.05, 0.10, 0.15, 0.08, 0.11];

% 2. 5x5 variance-covariance matrix (Sigma)
Sigma = [  0.10,   0.00,  -0.05,   0.30,  -0.70;
           0.00,   0.20,   0.15,  -0.10,   0.00;
          -0.05,   0.15,   0.50,   0.20,  -0.15;
           0.30,  -0.10,   0.20,   0.30,   0.25;
          -0.70,   0.00,  -0.15,   0.25,   0.40 ];

% number of stocks (n) from the length of mu
n = length(mu);

    % Point 1
        % equally weighted portfolio: the same share invested in each stock
        x = ones(n, 1) / n
        % portfolio weights: 20% in each of the 5 stocks

    % Point 2
        % expected return = weighted average of the stocks' expected returns
        Exp_Ret = mu * x

    % Point 3
        % portfolio variance in matrix form
        Variance = x' * Sigma * x

    % Point 4
        % save the results to a text file in the current folder
        % save('Portfolio_Exp_Return_Variance.txt', 'x', 'Exp_Ret', 'Variance', '-ascii');
import numpy as np

# Expected return and risk (variance) of an equally weighted portfolio.

# 1. Vector of expected returns (mu) for the 5 stocks
mu = np.array([0.05, 0.10, 0.15, 0.08, 0.11])

# 2. 5x5 variance-covariance matrix (Sigma)
Sigma = np.array([[ 0.10,  0.00, -0.05,  0.30, -0.70],
                  [ 0.00,  0.20,  0.15, -0.10,  0.00],
                  [-0.05,  0.15,  0.50,  0.20, -0.15],
                  [ 0.30, -0.10,  0.20,  0.30,  0.25],
                  [-0.70,  0.00, -0.15,  0.25,  0.40]])

n = len(mu)                             # MATLAB: length(mu)

# %% Point 1
# equally weighted portfolio: 20% in each of the 5 stocks
x = np.ones(n) / n
print("x =", x)

# %% Point 2
# expected return = weighted average of the expected returns
Exp_Ret = mu @ x                        # MATLAB: mu * x
print("Exp_Ret =", Exp_Ret)

# %% Point 3
# portfolio variance in matrix form
Variance = x @ Sigma @ x                # MATLAB: x' * Sigma * x   (for 1-D vectors no transpose is needed)
print("Variance =", Variance)

Results

Value
Weights 20% each
Expected return 9.80%
Variance 0.0520 (volatility 22.8%)

The covariance matrix in the exercise is not a valid one

A covariance matrix must be positive semi-definite. This one has a negative eigenvalue (−0.67): the covariance between stocks 1 and 5 is −0.70, while their variances (0.10 and 0.40) allow at most \(\sqrt{0.10 \cdot 0.40} = 0.20\) in absolute value, an implied correlation of −3.5. The equally weighted portfolio still gets a positive variance, but other weight vectors would get a negative one. The code is correct; the input data are not.

Takeaways

  • Expected return is linear in the weights; variance is quadratic, which is where diversification comes from.
  • Before trusting a portfolio variance, check that \(\Sigma\) is positive semi-definite (eig(Sigma) must have no negative values).