Minimum Variance Porfolio
Overview
The minimum variance portfolio is the portfolio that
achieves the minimum variance, or smallest risk among possible
portfolios. It ignores the expected returns of the assets. If any of the assets has
zero variance, then the minimum variance portfolio will have zero variance.
Derivation
For this derivation, we set the portfolio weights as a column vector {% w %},
where {% w[i] %} is the ith asset in the portfolio. Then we take {% \textbf{i} %}
is a column vector of 1's.
(see
qian)
Then we wish to minimize the variance of the portfolio, which is calculated as
{% Minimize \; \frac{1}{2} \textbf{w}^T \Sigma \textbf{w} %}
{% subject \; to \; \textbf{w}^T \textbf{i} = 1 %}
(that is, the sum of the weights should equal 1)
Because this is a constrained optimization, it can be solved using
the
Lagrange Multipliers technique.
First we specify the Lagrangian.
{% Lagrangian \; L = \frac{1}{2} \textbf{x}^T \sigma \textbf{w} - \lambda (\textbf{w}^T \textbf{i} - 1) %}
Taking derivatives yields
{% \Sigma \textbf{w} = \lambda \textbf{i} = 0 %}
{% \textbf{w} = \lambda \Sigma^{-1} \textbf{i} %}
{% \lambda = 1 / (\textbf{i}^T \Sigma ^{-1} \textbf{i} ) %}
{% \textbf{w}_{min} = \frac{ \Sigma ^{-1} \textbf{i} }{ \textbf{i}^T \Sigma ^{-1} \textbf{i}} %}
Implementation
The following code using the
linear-algebra.mjs
library to compute the minimum variance portofolio solution.
let la = await import('/lib/linear-algebra/v1.0.0/linear-algebra.mjs');
let sigma = [[0.2,0.05],[0.05, 0.12]];
let i = [[1],[1]]
let sigmaInverse = la.inverse(sigma);
let denom = la.multiply(la.transpose(i), la.multiply(sigmaInverse, i));
let numerator = la.multiply(sigmaInverse, i);
let wMin = la.multiply(1/denom[0][0], numerator);
Try it!