Mean Variance Analysis

Definition · Updated November 1, 2025

Title: Mean–Variance Analysis — What It Is, How It Works, and Practical Steps to Use It

Source: Investopedia (Julie Bang). Additional reference: Harry Markowitz, “Portfolio Selection” (1952).

Introduction

Mean–variance analysis is an investment evaluation framework that compares expected return (the mean) and risk (variance or standard deviation) of investments to make portfolio choices. It is the quantitative core of Modern Portfolio Theory (MPT): given an investor’s preferences, find portfolios that offer the highest expected return for a given level of risk (or the lowest risk for a given return). The analysis emphasizes diversification and the tradeoff between risk and reward.

Key concepts

– Expected return (mean): the probability-weighted average of possible returns (often estimated from historical returns, forecasts, or models).
– Variance and standard deviation: measures of dispersion of returns around the mean. Variance (σ^2) is the square of standard deviation (σ).
– Covariance and correlation: how returns of two assets move together. Covariance = ρij σi σj; correlation ρij is covariance scaled to [−1,1].
– Portfolio return: weighted average of asset returns.
– Portfolio variance: depends on weights, individual variances, and covariances — not just a weighted average of variances.
– Efficient frontier: set of portfolios that minimize variance for each target return (or maximize return for each risk).

Formulas (two assets and general)

– Portfolio expected return (general): Rp = Σ wi · ri
– Two-asset variance:
Var(Rp) = w1^2 σ1^2 + w2^2 σ2^2 + 2 w1 w2 σ1 σ2 ρ12
– General portfolio variance (matrix form):
Var(Rp) = w’ Σ w
where w is the vector of weights and Σ is the covariance matrix.

Worked example (numbers from Investopedia)

Assume:
– Investment A: weight wA = 25% = 0.25, expected return rA = 5% = 0.05, σA = 7% = 0.07
– Investment B: weight wB = 75% = 0.75, expected return rB = 10% = 0.10, σB = 14% = 0.14
– Correlation ρ = 0.65

1) Portfolio expected return:

Rp = 0.25×0.05 + 0.75×0.10 = 0.0125 + 0.075 = 0.0875 = 8.75%

2) Portfolio variance:

Var(Rp) = (0.25^2 × 0.07^2) + (0.75^2 × 0.14^2) + (2 × 0.25 × 0.75 × 0.07 × 0.14 × 0.65)
= 0.00030625 + 0.011025 + 0.00238875 ≈ 0.01372

3) Portfolio standard deviation:

σp = sqrt(0.01372) ≈ 0.1171 = 11.71%

Practical step-by-step guide to performing mean–variance analysis

1. Define objective and constraints

– Decide whether you will minimize variance for a target return, maximize return for a target risk, or maximize a utility function (e.g., Sharpe ratio).
– Set practical constraints: no short-selling (wi ≥ 0), weight sum = 1, position limits, sector or liquidity constraints.

2. Collect and clean data

– Choose a returns history (daily, weekly, monthly). Historical sample size matters—longer histories capture cycles but may include regime changes.
– Handle data issues: missing data, outliers, corporate actions.

3. Estimate inputs

– Expected returns: options include historical average returns, forward-looking analyst estimates, factor models (CAPM, multi-factor), or the Black–Litterman method. Expected returns are the most error-prone input.
– Covariance matrix: compute sample covariance of asset returns. Consider shrinkage estimators (Ledoit-Wolf) or factor-based covariances to reduce estimation error.

4. Formulate the optimization

– Two standard forms:
a) Minimize w’ Σ w subject to w’ μ = R_target and Σ wi = 1
b) Maximize (w’ μ − rf) / sqrt(w’ Σ w) (Sharpe ratio) subject to Σ wi = 1
– Use Lagrangian or quadratic programming; for many assets use numerical solvers.

5. Solve and get the efficient frontier

– Generate portfolios for a range of target returns to trace the efficient frontier. Identify the tangency portfolio (max Sharpe) or the minimum-variance portfolio.

6. Test and stress

– Backtest using out-of-sample periods, cross-validation, or bootstrap resampling to assess sensitivity to input estimates.
– Perform scenario analysis and stress tests (e.g., correlation spikes, large market moves).

7. Implement and monitor

– Translate optimized weights into trades considering transaction costs, taxes, and liquidity.
– Rebalance periodically, and re-estimate inputs on a schedule (monthly/quarterly) or when market conditions change.

Implementation tips and tools

– Excel: Compute means and covariances via AVERAGE and COVARIANCE.S. Use Solver to minimize variance with constraints (sum of weights = 1, target return).
– Python: Use pandas/numpy for data, numpy.cov for covariance, and scipy.optimize or cvxopt for quadratic programming. Libraries: PyPortfolioOpt (practical, high-level).
– R: packages like quadprog, PortfolioAnalytics, or PerformanceAnalytics.
Commercial tools: portfolio management and risk systems with implemented optimization engines.

Limitations and common practical issues

– Input sensitivity: optimized portfolios can be extremely sensitive to small changes in expected returns and covariances.
– Return estimation error: expected returns are difficult to estimate accurately; errors distort the optimum.
– Normality assumption: mean–variance uses variance as a risk measure, which implicitly weights upside and downside equally and is most meaningful for roughly symmetric return distributions.
– Correlation instability: correlations rise in crises, reducing diversification benefits.
– Transaction costs, taxes, and liquidity constraints are often omitted from the mathematical problem and must be incorporated in implementation.

Ways to make mean–variance analysis more robust

– Shrinkage estimators for Σ (Ledoit–Wolf) to reduce covariance estimation noise.
– Use factor models to estimate covariance (fewer parameters).
– Black–Litterman approach to combine market equilibrium returns with investor views.
– Resampling and bootstrapping to assess weight stability and identify robust allocations.
– Regularization: add penalties for extreme weights (L2 regularization) or cap individual holdings.
– Incorporate downside risk measures (CVaR) if variance is not an appropriate risk metric.

Quick Excel Solver setup (example)

– Decision cells: weights w1..wn
– Objective: cell computing portfolio variance = w’ Σ w (set to minimize)
– Constraints: Σ wi = 1; w’ μ = target return (if minimizing variance for a target return); bounds wi ≥ 0 (if no shorting)
– Use Solver (GRG Nonlinear or Quadratic Solvers add-in) to find optimal weights.

Simple Python pseudocode (compute mean and covariance; minimize variance for a target return)

– Compute returns_df (time × assets)
– mu = returns_df.mean()
– Sigma = returns_df.cov()
– Define objective: lambda w: w.T @ Sigma @ w
– Constraints: sum(w) == 1; w.T @ mu == R_target; bounds for w
– Use scipy.optimize.minimize with method=’SLSQP’

When to use mean–variance analysis

– Strategic and tactical asset allocation where inputs can be reasonably estimated.
– Constructing diversified portfolios and exploring tradeoffs between return and risk.
– As a baseline quantitative tool; combine with judgment, stress testing, and other models.

Conclusion

Mean–variance analysis provides a clear, tractable framework to trade off expected return and risk and to quantify the benefits of diversification. It leads to the efficient frontier and supports portfolio optimization, but its outputs are only as good as the input estimates and assumptions. Use robust estimation methods, stress tests, and practical constraints to create implementable portfolios.

References and further reading

– Investopedia: “Mean–Variance Analysis” — Julie Bang (source provided).
– Markowitz, Harry (1952). “Portfolio Selection.” Journal of Finance.
– Ledoit, Olivier, and Wolf, Michael. Papers on covariance shrinkage estimators.
– Black, Fischer, and Robert Litterman (1992). “Global Portfolio Optimization.”

If you’d like, I can:

– Run the example calculation in an Excel sheet or a small Python script and return the file/code.
– Build a small Excel Solver template you can plug your returns into.
– Show how to compute the efficient frontier for 3–10 assets with sample code. Which do you prefer?

Related Terms

Further Reading