
Mean variance analysis is a powerful tool for investors to make informed decisions about their portfolios. It helps to identify the best investment opportunities by analyzing the potential returns and risks associated with each investment.
The goal of mean variance analysis is to maximize returns while minimizing risk, which is a key principle of portfolio management. This is achieved by calculating the expected return and standard deviation of each investment.
Investors use mean variance analysis to compare the performance of different investments and make informed decisions about which ones to include in their portfolios. By doing so, they can create a diversified portfolio that balances risk and potential returns.
A well-diversified portfolio can help to reduce risk and increase potential returns, but it requires careful planning and analysis.
You might enjoy: Variance (accounting)
What is Mean Variance Analysis?
Mean variance analysis is a powerful tool for evaluating investment portfolios. It calculates the average return and risk of a portfolio, helping investors make informed decisions.

The average return, or mean, is calculated by adding up the returns of each investment and dividing by the number of investments. This gives a snapshot of the portfolio's overall performance.
A portfolio with a higher mean return is generally considered more attractive, but it also comes with higher risk. This is where variance comes in, measuring the dispersion of returns around the mean.
Variance is calculated by taking the difference between each return and the mean, squaring it, and then averaging these squared differences. This gives a measure of the portfolio's risk, with higher variance indicating greater uncertainty.
By analyzing the mean and variance of a portfolio, investors can get a clearer picture of its potential returns and risks.
Readers also liked: S&p 500 Total Return Index Ticker
Key Concepts
Mean-variance analysis is a tool used by investors to weigh investment decisions. It helps determine the biggest reward at a given level of risk or the least risk at a given level of return.

The variance shows how spread out the returns of a specific security are on a daily or weekly basis. This is a key component of mean-variance analysis, and it's used to understand the level of risk associated with an investment.
If two different securities have the same expected return, but one has lower variance, the one with lower variance is preferred. This is because lower variance means less risk, and investors tend to prefer investments with lower risk.
The expected return is a probability expressing the estimated return of the investment in the security. It's a crucial component of mean-variance analysis, and it helps investors make informed decisions about their investments.
Investors are risk-averse, meaning they prefer investments with lower risk and higher expected returns. This is a fundamental assumption of modern portfolio theory, and it's used to guide investment decisions.
Here are the two main components of mean-variance analysis:
- Variance: a number that represents how varied or spread out the numbers are in a set
- Expected return: a probability expressing the estimated return of the investment in the security
The goal of mean-variance analysis is to differentiate investments, which reduces the risk of catastrophic loss in the event of rapidly changing market conditions.
Calculating Expected Return

The expected return is the estimated return a security is expected to produce, based on historical data, and it's not 100% guaranteed.
If two securities offer the same expected rate of return, but one comes with a lower variance, most investors prefer that security.
To calculate the expected rate of return, you need to know the weight of each stock in your portfolio. The weight of a stock is its value divided by the total value of the portfolio.
For example, if you have a portfolio with a total value of $500,000, and Stock A is worth $200,000, its weight is 40%. This means 40% of your portfolio is invested in Stock A.
Stock A has an expected return of 5%, so you can calculate the expected return from this stock as 40% x 5%.
Similarly, if you have another stock, Stock B, worth $300,000, its weight is 60%. This means 60% of your portfolio is invested in Stock B, which has an expected return of 7%.
Check this out: Total Return Swaps
Investing Strategies

Investors focus on creating a portfolio that optimizes the expected return according to a specific level of risk, as they are risk-averse.
The goal of every investor is to create a portfolio of stocks that offer the highest long-term returns without getting into high levels of risk.
A portfolio can be comprised of various types of securities, such as stocks, bonds, mutual funds, which when combined, come with varying levels of risk.
Diversifying the investment portfolio is a key solution for minimizing risk, as ideally, a loss in one security is compensated by a gain in another security.
Investing Strategies
Investing Strategies is all about creating a portfolio that offers the highest long-term returns without taking on too much risk.
Investors are risk-averse, which means they focus on creating a portfolio that optimizes the expected return according to a specific level of risk.
A portfolio can be made up of stocks, bonds, mutual funds, and more, each with its own level of risk.

Ideally, if one security decreases in value, the loss is compensated by a gain in another security.
Diversifying your portfolio is a key strategy for minimizing risk, and it's considered a better move than investing in only one type of security.
Mean-variance analysis can help you create a portfolio that balances risk and return.
Risk-Free Asset and Capital Allocation Line
The risk-free asset is a hypothetical asset that pays a risk-free rate, and in practice, short-term government securities like US treasury bills are used as a risk-free asset because they pay a fixed rate of interest and have exceptionally low default risk.
These risk-free assets have zero variance in returns if held to maturity, making them a great addition to a portfolio. They are also uncorrelated with any other asset, which means their return is not affected by the return of other assets in the portfolio.
The risk-free asset can be combined with other assets to create a more efficient portfolio, and this is represented by the capital allocation line (CAL). The CAL is a half-line that shows the new efficient frontier when a risk-free asset is introduced.
Take a look at this: What Does with a Line under It Mean?

The CAL is tangent to the hyperbola at the pure risky portfolio with the highest Sharpe ratio, and its vertical intercept represents a portfolio with 100% of holdings in the risk-free asset. This means that if you hold only the risk-free asset, you'll get a fixed return with no risk.
The one mutual fund theorem states that all points on the linear efficient locus can be achieved by a combination of holdings of the risk-free asset and the tangency portfolio. This means that you can create a portfolio with any desired level of risk and return by mixing the risk-free asset with the tangency portfolio.
Additional reading: Separated Means
Portfolio Optimization
Portfolio Optimization is a crucial step in mean variance analysis, as it helps investors make informed decisions about their investments. The goal is to find the optimal allocation of assets that maximizes returns while minimizing risk.
To achieve this, we can use the EfficientFrontier class from PyPortfolioOpt, which optimizes allocation weights according to a given goal. In Example 2, we see that the max_sharpe method is used to maximize the Sharpe ratio, resulting in a portfolio with 70.83% of its value allocated into Apple stocks and 29.17% allocated into Tesla stocks.

The optimized portfolio can then be evaluated using metrics such as the Sharpe ratio, Sortino ratio, and maximum drawdown, as shown in Example 3. This allows investors to compare the performance of the optimized portfolio to a benchmark portfolio and make adjustments as needed.
The two mutual fund theorem, discussed in Example 4, states that any portfolio on the efficient frontier can be generated by holding a combination of any two given portfolios on the frontier. This means that investors can achieve any desired efficient portfolio even if all that is accessible is a pair of efficient mutual funds.
Discover more: Dogs of the Dow Mutual Fund
Portfolio Optimization
Portfolio optimization is a crucial step in creating a well-diversified investment portfolio. It involves finding the optimal mix of assets that maximizes returns while minimizing risk.
To optimize a portfolio, we need to consider the expected returns and risk of each asset. This can be done using historical data, such as closing prices, to calculate the expected returns and covariance matrix of the assets.
Recommended read: Expected Shortfall Formula

One popular method for portfolio optimization is the Efficient Frontier, which is a graphical representation of the optimal portfolio. It's like a map that shows the best possible portfolio for a given level of risk.
The Efficient Frontier can be used to find the optimal allocation weights for a portfolio. For example, using the max_sharpe method, we can find the optimal allocation weights that maximize the Sharpe ratio.
Here's an example of how this can be done using the PyPortfolioOpt library:
In this example, the optimal portfolio is made up of 70.83% Apple stocks and 29.17% Tesla stocks. By diversifying across these two assets, we can reduce the overall risk of the portfolio while maintaining a high expected return.
Portfolio optimization can be a complex task, but by using the right tools and techniques, we can create a well-diversified portfolio that meets our investment goals.
Efficient Frontier Without Risk-Free Asset
The Efficient Frontier Without Risk-Free Asset is a crucial concept in portfolio optimization. It's a way to visualize the trade-off between risk and return for different investment portfolios.

By applying the mean-variance model to a portfolio with four stocks, we can create an optimized portfolio that outperforms a portfolio with a 25% allocation to each stock. The optimized portfolio achieved a higher cumulative return of 4,830.76%.
The Sharpe ratio and Sortino ratio also show that the optimized portfolio has higher risk-adjusted returns than the original portfolio. This means it has a more favorable risk-return relationship, which is essential for investors.
The maximum drawdown of the optimized portfolio is lower than that of the original portfolio. This is a significant advantage, as it indicates that the optimized portfolio is less likely to experience significant losses.
Annual volatility is slightly lower for the optimized portfolio, and its kurtosis is closer to 3, meaning a lower tail-risk. This is a testament to the effectiveness of the mean-variance model in creating a more stable portfolio.
The Daily Value-at-Risk is also lower for the optimized portfolio, although the difference isn't dramatic. However, the expected daily, monthly, and yearly returns are much higher for the optimized portfolio.
The optimized portfolio also recovers from drawdowns much quicker than the original portfolio. This is reflected in the Recovery Factor, which is a key metric in evaluating portfolio performance.
Readers also liked: Variance Swap
Optimizing Portfolio
To optimize a portfolio, we need to load historic data for each asset using a library like yfinance. This data should cover a sufficient time period, such as from July 1st, 2010 to February 11th, 2023.
We then extract the "Adj Close" column from each stock, which contains the closing price adjusted by dividends and stock splits. This is a better representation of price changes over a longer period of time.
Next, we concatenate these separate dataframes together to form a new dataframe containing the adjusted closing prices for each stock during the time period.
To work with the PyPortfolioOpt library, we need to import the necessary imports. This includes the expected_returns module to compute the expected returns for each asset.
The expected returns can be obtained by getting the mean historical return of each stock. We can also obtain the covariance matrix S by applying the sample_cov method from the risk_models module to the dataframe.
Intriguing read: Expected Shortfall
With the estimated expected returns and the covariance matrix, we can find the optimal allocation weights for the stocks. We use the EfficientFrontier class from PyPortfolioOpt to optimize the allocation weights according to our goal.
The max_sharpe method is used for the maximization of the Sharpe ratio, which is a common goal in portfolio optimization. The Sharpe ratio measures the excess return of a portfolio over the risk-free rate, relative to its volatility.
The optimal allocation weights can be used to construct a new portfolio with a higher Sharpe ratio than the original portfolio. This is achieved by allocating a higher percentage of the portfolio to the assets with higher expected returns and lower volatility.
In the two mutual fund theorem, we can achieve any desired efficient portfolio by holding a combination of any two given portfolios on the efficient frontier. This is a key result of the mean-variance optimization framework.
The PyPortfolioOpt library simplifies the implementation of the Markowitz Mean-Variance Model to optimize portfolios. We can use this library to find the optimal allocation weights according to many goals and risk tolerance.
The two mutual funds theorem states that any portfolio on the efficient frontier can be generated by holding a combination of any two given portfolios on the frontier. This means that we can achieve any desired efficient portfolio by holding a combination of two given portfolios.
The tangency portfolio exists if and only if the risk-free return is less than the return of the global MVP. The capital market line (CML) becomes parallel to the upper asymptote line of the hyperbola when the risk-free return is greater or equal to the return of the global MVP.
Diversification can reduce portfolio risk by holding combinations of instruments that are not perfectly positively correlated. This allows investors to reduce their exposure to individual asset risk by holding a diversified portfolio of assets.
Technical Aspects
In mean variance analysis, we're dealing with a set of assets, represented as vectors, where each vector has a sum of 1. This is because we're dividing our funds into these assets.
Each portfolio can be thought of as a combination of these assets, with each asset represented by a weight or coefficient, which is why we can sum the weights and get 1. This is a fundamental concept in portfolio optimization.
Geometric Intuition
In the world of finance, the efficient frontier is a crucial concept that helps investors make informed decisions about their portfolios. It can be visualized as a problem in quadratic curves, where each portfolio is represented as a vector of weights for each asset.
Think of a portfolio as a way to divide your funds into different assets, such as stocks, bonds, or commodities. Each asset has its own return and risk, and the portfolio's performance is a combination of these individual assets.
The weights of each asset in the portfolio can be represented as a vector, where the sum of all weights equals 1. This means that if you have a portfolio with three assets, the weights for each asset would add up to 1, such as 0.4 for asset A, 0.3 for asset B, and 0.3 for asset C.
Here's a simple example of how weights can be represented as a vector:
This vector notation makes it easier to work with portfolios and their performance. By using vectors, we can simplify complex calculations and get a better understanding of how different assets contribute to the overall portfolio performance.
For another approach, see: Dogs of the Dow Historical Performance
Non-Invertible Matrix
A non-invertible covariance matrix can be a major issue in finance, and it's actually quite simple to understand.
If the covariance matrix is not invertible, it means there's a problem with the data. Specifically, there exists a nonzero vector v such that v^TR is a random variable with zero variance.
This is often referred to as a "zero variance" issue, and it's not random at all. In fact, it's a sign that one of the assets can be exactly replicated using the other assets at the same price and the same return.
One of the key implications of a non-invertible covariance matrix is that there is no reason to buy a certain asset, and it can be removed from the market. This is because the asset can be replicated using other assets, making it redundant.
However, if the sum of the vector components is not zero, we can scale the vector to make it equal to one. This means we've constructed a risk-free asset with a return equal to the vector's dot product with the covariance matrix.
Additional reading: Non-financial Risk
In this case, we can remove each such asset from the market, constructing one risk-free asset for each one removed. By the no arbitrage assumption, all their return rates are equal.
The existence of a non-invertible covariance matrix also implies that there is free money, which breaks the no arbitrage assumption. This is a major issue in finance, as it suggests that there are opportunities for risk-free profits.
You might enjoy: What Does No Me Diga Mean?
Asset Pricing
Asset pricing is all about finding the right balance between risk and reward. In a perfect market with rational investors, if a security is too expensive relative to others, demand will fall and its price will drop.
This equilibrium is achieved when the risk-to-reward ratio is identical across all securities. In other words, the proportions of each security in a fully-diversified portfolio will be the same as in the overall market.
The tangency portfolio plays a crucial role in this process, as it represents the optimal mix of securities. In market equilibrium, the prices of risky assets will adjust so that the ratios in the tangency portfolio are the same as the ratios in which the risky assets are supplied to the market.
This adjustment is driven by the relationship between price, supply, and demand. As demand falls for an overpriced security, its price will drop, and vice versa. This process continues until all adjustments have ceased, resulting in a state of market equilibrium.
A fresh viewpoint: It Risk Assessment Process
Systematic and Specific Risk
Systematic risk is the risk common to all securities within a market, and it cannot be diversified away.
This type of risk refers to the risk associated with the entire market, not just individual assets. It's also known as portfolio risk or market risk.
Systematic risk is equated with the risk of the market portfolio, which means it's the standard deviation of the market portfolio.
A security's risk is not measured in isolation, but rather by how it affects the market portfolio's risk-expected return characteristics.
The volatility of an asset and its correlation with the market portfolio are historically observed and given.
Systematic risks can be managed through a strategy of using both long and short positions within one portfolio, creating a "market neutral" portfolio.
Market neutral portfolios will be uncorrelated with broader market indices.
Worth a look: Currency Market Analysis
Advanced Topics
In mean variance analysis, the variance is a crucial component that measures the dispersion of returns from the mean return. It's calculated by squaring the differences between individual returns and the mean return, and then averaging those squared differences.

A higher variance indicates that the returns are more spread out, while a lower variance suggests that the returns are more consistent. For example, if a portfolio has a variance of 10, it means that the returns are 10 units away from the mean return on average.
Understanding the trade-off between mean and variance is essential in portfolio optimization, as it helps investors balance risk and return.
Extensions
Extensions of traditional investment theories are crucial for improving their accuracy and applicability.
Post-modern portfolio theory is an extension of Modern Portfolio Theory (MPT) that addresses some of its limitations by adopting non-normally distributed, asymmetric, and fat-tailed measures of risk.
Black–Litterman model optimization is an extension of unconstrained Markowitz optimization that incorporates relative and absolute 'views' on inputs of risk and returns.
This model assumes that expected returns are uncertain, which is a more realistic assumption than traditional models that assume certain returns.
The correlation matrix in this model can differ from the correlation matrix between returns, reflecting the uncertainty of expected returns.
Other Applications

Modern portfolio theory has been applied in various fields beyond finance.
In the 1970s, Michael Conroy used portfolio-theoretic methods to model the labor force in the economy, examining growth and variability in the labor force.
The relationship between economic growth and volatility has been extensively studied.
Studies have shown that a well-diversified self-concept can lead to more stable psychological outcomes, such as mood and self-esteem.
In information retrieval, modern portfolio theory has been used to model the uncertainty and correlation between documents.
Given a query, the aim is to maximize the overall relevance of a ranked list of documents while minimizing the overall uncertainty of the ranked list.
Here's an interesting read: Model Risk Analyst Banking
Critiques
Critiques of traditional optimization methods like Mean-Variance Optimization (MVO) are worth considering. Many investors find that MVO is sensitive to small changes in inputs, making it a less-than-ideal solution.
MVO tends to concentrate asset allocations in a subset of available asset classes, which can be a problem. This concentration can leave portfolios vulnerable to market fluctuations.

Investors often have concerns beyond just the mean and variance of returns. They may worry about inflation, liquidity, or other factors that can impact their investments.
Despite appearances, even diversified portfolios may not be adequately diversified when it comes to risk. This is because sources of risk may not be properly accounted for.
Most portfolios exist to pay for a liability or consumption series, but MVO allocations don't directly address these needs. This can lead to misaligned investment strategies.
MVO is a single-period framework that ignores trading and rebalancing costs, as well as taxes. This can result in portfolios that are not as effective as they could be.
Conclusion
The Mean-Variance Model is a powerful tool for optimizing portfolios, and our results are extremely exciting. We've successfully built a portfolio with higher returns and lower risks than our previous portfolio, which already outperformed the S&P500 index.
The PyPortfolioOpt proved to be an easy and efficient tool for determining the best allocation weights for our securities. This is a game-changer for quants looking to optimize their portfolios.

However, it's worth noting that the Mean-Variance Model isn't the only option for finding optimal allocation weights. In fact, there are other models, such as the Black-Litterman Allocation Model, which is also a popular choice for portfolio optimization.
If you're interested in learning more about portfolio optimization, be sure to check out our next article, where we'll be exploring the Black-Litterman Allocation Model in more detail.
Here are some ways to get involved with our community:
- Get listed on our directory and become a member of our member’s forum: https://forum.latinxinai.org/
- Become a writer for the LatinX in AI Publication by emailing us at [email protected]
- Learn more on our website: http://www.latinxinai.org/
Sources
- https://www.investopedia.com/terms/m/meanvariance-analysis.asp
- https://corporatefinanceinstitute.com/resources/career-map/sell-side/capital-markets/mean-variance-analysis/
- https://en.wikipedia.org/wiki/Modern_portfolio_theory
- https://analystprep.com/study-notes/cfa-level-iii/mean-variance-optimization-an-overview/
- https://medium.com/latinxinai/portfolio-optimization-the-markowitz-mean-variance-model-c07a80056b8a
Featured Images: pexels.com