Factor Model Covariance

The Factor Model Covariance is the covariance that a time series factor model implies: every return is a combination of a few factor returns plus a residual that is unrelated to the other assets (Fama and French, 1993; Connor, 1995). A model with K factors needs far fewer numbers than the N (N + 1) / 2 of the sample covariance, so it is estimated more precisely when there are many assets.

The formula for the Factor Model Covariance starts from the regression of the return \(r_{i , t}\) of every asset on the factor returns \(f_{k , t}\), with intercept \(a_{i}\), loadings \(B_{i , k}\) and residual \(e_{i , t}\):

\[r_{i,t} = a_{i} + \sum_{k=1}^{K} B_{i,k} \cdot f_{k,t} + e_{i,t}\]

The covariance combines the loadings B with the covariance matrix \(\text{Sigma}_{f}\) of the factors and the diagonal matrix D of the residual variances, all with ddof=1:

\[\Sigma = B \cdot \Sigma_{f} \cdot B' + D\]

Two assets co-move only through their shared factor exposures, so the estimate is as good as the factors: a co-movement the factors miss, such as that of an industry, is left out.

Its parameters can be set, and it can be shown as a correlation matrix. The covariance matrix holds the variance of every asset and the covariance of every pair, the risk input of the mean-variance analysis of Markowitz (1952). With N assets it holds N (N + 1) / 2 numbers to estimate, and when N is not small compared to the number of periods T, the sample estimate is noisy and ill-conditioned: its smallest eigenvalues come out too small, and an optimizer that inverts it puts large weights on the combinations of assets that only look safe in the sample. The estimators differ in how they deal with this: by shrinking towards a structured target, by cleaning the eigenvalues, by weighting recent periods, by counting only large moves or by resisting outliers. Every estimate is annualized with the number of periods in a year.

Also known as: factor covariance, factor risk model, Fama-French covariance.

In the Finance Toolkit this is get_covariance_estimate with method="factor", the same function as Covariance Estimate.

Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_covariance_estimate:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL", "MSFT", "JNJ", "XOM"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.portfolio.get_covariance_estimate(method="factor")

Which returns:

References

  • Paper Fama, E. F. and French, K. R. (1993). “Common Risk Factors in the Returns on Stocks and Bonds.” Journal of Financial Economics, 33(1), 3-56.
  • Paper Connor, G. (1995). “The Three Types of Factor Models: A Comparison of Their Explanatory Power.” Financial Analysts Journal, 51(3), 42-46.
  • Library Referenced against Riskfolio-Lib’s risk_factors (Factor Model Covariance)
  • Library Referenced against Riskfolio-Lib’s loadings_matrix (Factor Model Covariance, backward selection, every factor kept)
  • Library Shares similar logic as skfolio’s FactorModel (Factor Model Covariance)
Share