 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?

Implementing the Shanken correction using the asreg package is a fairly easy process, and can be done in three steps:

1. Find the covariance matrix of the right-hand-side variables. In this example, the right-hand-side variables are rm_rfsmb, and hml. To find the covariance matrix, use the following command:
cor rm_rf smb hml, cov
matrix S = r(C)


2. Find the first stage lambdas of the right-hand side (RHS) variables:

bys portfolios: asreg excess_returns rm_rf smb hml
* Drop unnecessary variables
drop _Nobs _R2 _adjR2 _b_cons 

3. In the final stage of the Fama and MacBeth regression, we would use the fmb and shanken options. The shanken option requires the covariance matrix that we created in step 1.

asreg excess_returns _b_mmrf _b_smb _b_hml, fmb shanken(S)

## Pricing

The asreg program is a freeware and can be downloaded from the SSC website. The Shanken correction is available for $100 per model, plus a$50 fee for raw data processing. This fee is charged in case the data is not in Stata format and variables are not already constructed. attaullah.shah@imsciences.edu.pk
Stata.Professor@gmail.com

### References

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.