I'm new to quant finance, and as I'm not a mathematician, I am using python to try an understand it.

There are a number of blogs on the internet which explain mean variance optimisation, but no-one extends these examples to the fama french factors and optimising it under that model of the world.

This is what I am trying to understand.

Mean Variance Optimisation:

I know that in matrix notation, the following is true for mean-variance:

mu = w * r.T
sigma = np.sqrt(w * C * w.T)

w = matrix of weights
r = matrix of returns
C = variance covariance matrix of r

You then try to maximise return, or minimise variance by adjusting weights in an optimisation function.

Under the factor view of the world, r = B * f + s where:

r = matrix of returns
B = matrix of factor exposures
f = matrix of factor returns and 
s = matrix idiosyncratic returns

Under this scenario, returns would be again

mu = r * w.T

However, the sigma doesn't seem to take into account the fact there is more than one factor at play describing risk. How do you extend mean-variance to account for additional factors?

Would it be something like finding a sigma for each factor and its covariance to the return and then combining them?

sigma = np.sqrt(factor1_weight * Covariance(return,factor1) * factor1_weight) * np.sqrt(factor2_weight * Covariance(return,factor2) * factor2_weight) ??

Any help would be appreciated, and perhaps an explanation as well.

Thanks so much!


2 Answers 2


It seems like you can model covariance as a factor model. I found it in Quantative Equity Portfolio management.

CoVar = (weights * B * V * B.T * weights.T) + (weights * D * weights.T) 

Where: R = Returns Matrix, B = Asset Exposure to Factors, V = Factor Covariance, Matrix D = specific variance diagonal matrix.


You're kind of mixing models.

Mean-variance optimization based in MPT suggests there's a trade-off between risk and return with a collection of asset correlations that provides the best 'risk-adjusted' return.

The Fama-French model is an extension of APT that asserts security return is an artifact of security sensitivity to three (or five) factors. Namely, we can determine a security's return given its historical sensitivity to various equity factors +/- some epsilon.

The returns included in MV are typically simply an input, as vol or the covariance matrix, which is used to output an 'optimal' set of weights per the objective function.

You could conceivably calculate your security returns using whatever FF model you like using the form you described, and then subsequently calculate a covariance matrix explicitly using the resulting security returns. You could then use those returns and covariance matrix within your MV routine.

That said, depending on how you're planning to use this, this is kind of a noise on noise exercise though. It goes without saying your resulting weights are dependent now on TWO models, neither of which is particularly robust as far as actual trading is concerned. For instance, FF5 is better than a lot of things for predicting security returns, but you're likely to see wild deviations from actual daily or monthly return streams. And using MV for portfolio construction decisions is highly dependent on quality of inputs, one of which, the covariance matrix, is also highly sensitive to inputs (eg, returns).


  • $\begingroup$ Hi chris,thanks so so much clarifying. Would you be able to help with the notation though if I wanted to minimise the systematic risk and maximise the idiosyncratic risk under the apt then? I guess there’s a difference between a factor model is historical based on how the factor returns contribute to asset returns. Ie you’d have a variance Covariance between asset and factor? But forward looking you have estimated returns and then wanted to neutralise the systematic risks to be left with just the systematic... I guess that’s what I’m trying to understand how to do at a minimum. $\endgroup$ Commented Apr 22, 2019 at 8:03
  • $\begingroup$ @firstworldchild, that doesn't make any sense. please correct typos/wording to clarify. $\endgroup$
    – Chris
    Commented Apr 22, 2019 at 9:42
  • 1
    $\begingroup$ sorry! If APT is saying that return is a function of factors + an error term; is it correct to say you could also use APT to explain the variance of return? ie the variance in Factor Returns would explain the variance of the security return? and therefore are able to max return and min risk? I understand that under APT If i wanted to minimise the variance (risk) I'd need to be more specific, ie, minimise the common risks (ie factor variance) and you're left with the specific risk (idiosyncratic variance). That's where my q came from - or am i still missing the point? $\endgroup$ Commented Apr 22, 2019 at 10:03
  • $\begingroup$ not really...you could create a covariance matrix of factor returns, but that wouldn't be used within the MV optimization because it says nothing about individual security variance. recall, each security will have unique loadings on each of the factors, which unless you have them a priori somehow, need to be fit to the historical factor returns to create estimates for them. $\endgroup$
    – Chris
    Commented Apr 22, 2019 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.