0
$\begingroup$

I have a question about the Fama-MacBeth regression in Python. There is a library called linearmodels which contains this procedure under FamaMacBeth class. However, when I was looking for some examples, I found this Notebook from a popular book.

So I am wondering why the author uses the LinearFactorModel class to estimate the Fama-MacBeth regression when there is a separate class called FamaMacBeth (documentation available here) in the very same library? I might be missing some nuances on the estimation procedure in them.

$\endgroup$

2 Answers 2

1
$\begingroup$

@Jerry, Considering the beta values in Kevin's example are constant rather than time-varying, his method is correct. When beta estimates are not changing over time, both cross-sectional regression and Fama-MacBeth regression would yield the same result regardless whether you calculate the time-series average before or after the regression. The original paper (FM, 1973), however, uses a rolling window to estimate betas, followed by the T equations to estimate risk premiums. I think the slight disadvantage of his package is that there is no argument to tune the beta estimation window, and thus its second stage is no different from usual cross-sectional regression.

$\endgroup$
0
$\begingroup$

This is not exactly an answer, but I hope to discuss a few things.

LinearFactorModel is definitely not Fama-Macbeth regression. The first stage seems the same, but the second stage only performs one regression, with the endogenous variable being the average of excess returns, whereas in Fama-Macbeth regression, there should be T regressions, one for each time period, and the final estimators should be the average of T sets of estimators.

On the other hand, FamaMacBeth does not seem to have the first stage for a 2-stage Fama-Macbeth regression, which should be N regressions, one for each asset. I guess you could perform the first stage manually if the factors are returns, but the p-values will not be correct.

The situation is further complicated by the fact that the author of the linearmodels package, Kevin Sheppard, does not seem to fully grasp the concept. In his Example: Fama-Macbeth Regression, you can clearly see in code block 3 that he performs the "LinearFactorModel" kind of regression by taking the average of excess returns. I believe he is indeed an expert in econometrics, but he may have been a little confused here. The documentation for linearmodels is a bit lacking as well.

I have also been searching for a well-established python package for 2-stage Fama-Macbeth regression (as I find it difficult to derive the distribution of the estimators and thus the confidence intervals), but so far no satisfying results.

$\endgroup$

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