The main idea in Factor Analysis is to take a set of observed returns and decompose it into a set of explanatory returns. We'll follow Asset Management (Ang 2014, Oxford University Press) Chapter 10 and analyze the returns of Berkshire Hathaway. First, we'll need the returns of Berkshire Hathaway which are contained in data/brka_d_rets.csv. Read it in as follows:
%matplotlib inline
import PortfolioAnalytics as PortfolioAnalytics
import PortfolioLoadData as PortfolioLoadData
import PortfolioRisk as PortfolioRisk
import PortfolioStatistics as PortfolioStatistics
import PortfolioBacktest as PortfolioBacktest
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
%load_ext autoreload
%autoreload 2
# load and transform Berkshire Hathaway A to monthly returns
brka_d = pd.read_csv("data/brka_d_ret.csv", parse_dates=True, index_col=0)
brka_m = brka_d.resample('M').apply(PortfolioStatistics.compound).to_period('M')
# write the resampled time series to disk
brka_m.to_csv("./data/brka_m.csv")
brka_m.head()
Next, we need to load the explanatory variables, which is the Fama-French monthly returns data set. This was part of their original 1993 paper: The Fama and French model has three factors: size of firms, book-to-market values and excess return on the market. In other words, the three factors used are SMB (small minus big), HML (high minus low) and the portfolio's return less the risk free rate of return.
Later on in 2014 came their extended version: the 5-factor Model: The Fama/French 5 factors (2x3) are constructed using the 6 value-weight portfolios formed on size and book-to-market, the 6 value-weight portfolios formed on size and operating profitability, and the 6 value-weight portfolios formed on size and investment. (See the description of the 6 size/book-to-market, size/operating profitability, size/investment portfolios.)
However we will stick to the original 3-factor model. Load that as follows:
fff = PortfolioLoadData.get_fff_returns()
fff.head()
Next, we need to decompose the observed BRKA 1990-May 2012 as in Ang(2014) into the portion that's due to the market and the rest that is not due to the market, using the CAPM as the explanatory model.
i.e.
$$ R_{brka,t} - R_{f,t} = \alpha + \beta(R_{mkt,t} - R_{f,t}) + \epsilon_t $$We can use the stats.api for the linear regression as follows:
brka_excess = brka_m["1990":"2012-05"] - fff.loc["1990":"2012-05", ['RF']].values
mkt_excess = fff.loc["1990":"2012-05",['Mkt-RF']]
exp_var = mkt_excess.copy()
exp_var["Constant"] = 1
lm = sm.OLS(brka_excess, exp_var).fit()
# Single regression market model
lm.summary()
This implies that the CAPM benchmark consists of 46 cents in T-Bills and 54 cents in the market. i.e. each dollar in the Berkshire Hathaway portfolio is equivalent to 46 cents in T-Bills and 54 cents in the market. Relative to this, the Berkshire Hathaway is adding (i.e. has 𝛼 of) 0.61% (per month!) although the degree of statistica significance is not very high. Now, let's add in some additional explanatory variables, namely Value and Size.
exp_var["Value"] = fff.loc["1990":"2012-05",['HML']]
exp_var["Size"] = fff.loc["1990":"2012-05",['SMB']]
exp_var.head()
# Multiple Linear Regression:
lm = sm.OLS(brka_excess, exp_var).fit()
lm.summary()
The alpha has fallen from .61% to about 0.55% per month. The loading on the market has moved up from 0.54 to 0.67, which means that adding these new explanatory factors did change things. If we had added irrelevant variables, the loading on the market would be unaffected.
We can interpret the loadings on Value being positive as saying that Hathaway has a significant Value tilt - which should not be a shock to anyone that follows Buffet. Additionally, the negative tilt on size suggests that Hathaway tends to invest in large companies, not small companies.
In other words, Hathaway appears to be a Large Value investor. Of course, you knew this if you followed the company, but the point here is that numbers reveal it!
The new way to interpret each dollar invested in Hathaway is (the coefficients):
* 67 % in the market, 33 % in Bills,
* 38 % in Value stocks and short 38 % in Growth stocks,
* 50 % in LargeCap stocks and short 50 % in SmallCap stocks.
If you did all this, you would still end up underperforming Hathaway by about 55 basis points per month.