Compute a portfolio’s excess returns, regress them on the Fama-French market, size and value factors with statsmodels, and read alpha with conventional and HAC t-statistics.
After this lesson, you can estimate a portfolio’s alpha and factor betas with a regression on the Fama-French factors.
How do I estimate alpha and the factor betas?
A regression of the portfolio’s excess return on the factors gives the alpha as the intercept and the exposures to the factors as the slopes. On twelve made-up months, the alpha is 0.274% a month with a t-statistic of 3.046, and the market beta is 1.068.
Here \(R_t\) is the portfolio’s return in month \(t\), \(R_{f,t}\) the risk-free rate, Mkt-RF the market’s excess return, SMB the return of small stocks minus big stocks and HML the return of high book-to-market stocks minus low ones. All returns are in percent.
The factors are already excess returns or differences between returns, so only the portfolio’s return needs the risk-free rate subtracted. As in the lesson on fitting with sm.OLS, sm.add_constant adds the column of ones for the intercept, and sm.OLS(...).fit() estimates the regression. .tvalues divides each estimate by its standard error.
The following box builds the data and fits the regression.
A rise of one percentage point in the market’s excess return goes with a rise of 1.068 points in the portfolio’s, with SMB and HML held fixed. The alpha is the return the three factors leave unexplained, so it changes when the model adds factors.
What changes with HAC standard errors?
HAC standard errors allow the errors to change in size and to be correlated across months, as in the lesson on HAC errors. Here they lower alpha’s standard error from 0.090 to 0.061 and raise its t-statistic from 3.046 to 4.472, and the estimates stay the same.
model.fit(cov_type="HAC", cov_kwds={"maxlags": 2}) fits the same regression with HAC standard errors up to two months apart.
The following box compares the two sets of standard errors and t-statistics.