# Mean Variance Optimization
## Situation
Mean Variance Optimization (MVO) will construct an optimal portfolio to maximize a variance adjusted mean return (i.e. Sharpe Ratio). It does this by taking in the expected return of each asset, $\mu$, and the covariance of asset returns, $\Sigma$. We do not know the true $\mu$ and $\Sigma$ at trade time, so we must pass in our best estimates: $\hat{\mu}$ and $\hat{\Sigma}$. The quality of the resulting portfolio's is only as good as the quality of the estimated inputs. We must be able to improve the quality of the estimated inputs.
## Problem
For the purpose of this write up, we will focus $\mu$: How can we improve our estimate $\hat{\mu}$? In order to improve our estimate, we must first be able to measure if an improvement was made. So we can narrow our question a bit further:
> Given two estimates of $\mu$, $\hat{\mu}_1$ and $\hat{\mu}_2$, how can we measure if $\hat{\mu}_2$ is an improvement over $\hat{\mu}_1$?
How might we go about this?
One approach is to just run the optimization with both inputs and then compare the financial performance (FP). If $\hat{\mu}_2$ lead to better FP than $\hat{\mu}_1$, we could declare $\hat{\mu}_2$ an improvement. But there are clear problems with this approach. First, this is very susceptible to backtest hacking. Second, say $\hat{\mu}_2$ doesn't lead to an FP improvement over $\hat{\mu}_1$—what should our next step be? If our only evaluation tool is a backtest, our level of analysis is so coarse that we have no clear next step other than to toss the approach that created $\hat{\mu}_2$ aside and try something else. We need evaluation procedures that can tell us *where* to make improvements, or *why* genuine improvements aren't being acted upon by the optimizer.
So evaluating $\hat{\mu}$ by backtesting isn't an option. We can see that this is inherently a cross validation (CV) problem. We need CV functions that can measure the quality of $\hat{\mu}_2$ compared to $\hat{\mu}_1$. These CV functions should satisfy two properties:
1. Correlate with financial performance: if $\hat{\mu}_2$ has better CV than $\hat{\mu}_1$, it should also have better FP. And
2. Deepen our understanding by answering questions like: Where should we focus our efforts when trying to improve $\hat{\mu}$? Why didn't a genuine improvement get utilized?
To answer achieve these two properties, no single CV function will suffice. We will need a suite of functions that answer different questions about our estimates. This suite will need to be complementary—different functions will fill in each others "gaps".
To build this suite, there is no way around building up a deeper understanding of what the optimizer is doing. How is it using the inputs we pass it?
## Goal
The goal of this writeup is to help build a crisp mental model of what the optimizer is *seeing* . We will do this mainly by thinking *geometrically*. This will allow us to design CV functions that evaluate our inputs based on the context they will be used in.
# Spaces
We start with **asset space**, $\mathbb{A} = \mathbb{R}^n$, with basis vectors $a_1, \dots, a_n$ being *assets*. Suppose we have a vector $v$ in this space. The $i$-th coordinate of $v$ tells us "how much along asset $i