If you are not yet familiar with asreg, here is a quick start. Implementing the Fama and MacBeth regression using asreg is super-fast and easy. Here are a few posts related to this implementation.

FMB regressions with asreg

FMB regression – what, how and where

FMB regressions with 25-portfolios – An example


The Shanken Correction

In applying standard OLS formulas to a cross-sectional regression, we assume that the right-hand variables β are fixed. The β in the cross-sectional regressions are not fixed, of course, but are estimated in the time-series regression.  Therefore, there might be a sampling error in the estimates of β.  Shanken (1992) suggested a correction to the standard errors of the estimates.


How to do it?

The focus in this post is on the Fama and MacBeth implementation with Shanken () correction. Like with many other commands using asreg, the Shanken correction is fairly easy. The following steps are needed:


1. Find a covariance matrix among the right hand-side variables and write it to a matrix. Suppose variables in our dataset include rm_rf smb and hml, then to find the covariance and write it to a matrix, we would do the following:

cor rm_rf smb hml, cov
matrix S = r(C)  


2. Find the first stage lambda of the RHS variables.

bys portfolios: asreg excess_returns rm_rf smb hml
* Remove uncessary variables
 drop _Nobs _R2 _adjR2 _b_cons 


3. Fama and MacBeth regression: In this last stage, we would use the fmb and shanken option. The shanken option requires the covariance matrix that we created in step 1 above

asreg excess_returns _b_mmrf _b_smb _b_hml , ///
fmb shanken(S)



The asreg program is a freeware and can be downloaded from SSC. The Shanken correction is available for $100/model, plus a $50 for raw data processing (in case the data is not in Stata format and variables are not already constructed). For further details, please contact us at:




See our full list of completed projects


  1. Fama, E. F., & MacBeth, J. D. (1973). Risk, return, and equilibrium: Empirical tests. Journal of political economy81(3), 607-636.
  2. Shanken, J. (1992). On the estimation of beta-pricing models. The review of financial studies5(1), 1-33.