The Fama-McBeth (1973) regression is a two-step procedure . The first step involves estimation of N cross-sectional regressions and the second step involves T time-series averages of the coefficients of the N-cross-sectional regressions. The standard errors are adjusted for cross-sectional dependence. This is generally an acceptable solution when there is a large number of cross-sectional units and a relatively small time series for each cross-sectional unit. However, if both cross-sectional and time-series dependencies are suspected in the data set, then Newey-West consistent standard errors can be an acceptable solution.

## Estimation Procedure

The Fama-McBeth (FMB) can be easily estimated in Stata using asreg package. Consider the following three steps for estimation of FMB regression in Stata.

1. Arrange the data as panel data and use xtset command to tell Stata about it.

2. Install **asreg** from ssc with this line of code:

`ssc install asreg`

3. Apply **asreg** command with **fmb** option

## An Example

We shall use the grunfeld dataset in our example. Let’s download it first:

webuse grunfeld

This data is already xtset, with the following command:

xtset company year

Assume that we want to estimate a FMB regression where the dependent variable is *invest* and independent variables are *mvalue* and *kstock*. Just like regress command, **asreg** uses the first variable as dependent variable and rest of the variables as independent variables. Using the *grunfeld* data, **asreg** command for FMB regression is given below:

asreg invest mvalue kstock, fmb

Fama-MacBeth (1973) Two-Step procedure Number of obs = 200 Num. time periods = 20 F( 2, 19) = 195.04 Prob > F = 0.0000 avg. R-squared = 0.8369 ------------------------------------------------------------------------------ | Fama-MacBeth invest | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- mvalue | .1306047 .0093422 13.98 0.000 .1110512 .1501581 kstock | .0729575 .0277398 2.63 0.016 .0148975 .1310176 _cons | -14.75697 7.287669 -2.02 0.057 -30.01024 .496295 ------------------------------------------------------------------------------

## Newey-West standard errors

If Newey-West standard errors are required for the second stage regression, we can use the option **newey(***integer***).** The integer value specifies the number of lags for estimation of Newey-West consistent standard errors. Please note that without using option **newey**, asreg estimates normal standard errors of OLS. This option accepts only integers, for example **newey**(*1*) or **newey**(*4*) are acceptable, but **newey**(*1.5*) or **newey**(*2.3*) are not. So if we were to use two lags with the Newey-West error for the above command, we shall type;

asreg invest mvalue kstock, fmb newey(2) Fama-MacBeth Two-Step procedure (Newey SE) Number of obs = 200 (Newey-West adj. Std. Err. using lags(2)) Num. time periods = 20 F( 2, 19) = 39.73 Prob > F = 0.0000 avg. R-squared = 0.8369 --------------------------------------------------------------------------------- | Newey-FMB invest | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+------------------------------------------------------------------- mvalue | .1306047 .0150138 8.70 0.000 .0991804 .1620289 kstock | .0729575 .0375046 1.95 0.067 -.0055406 .1514557 _cons | -14.75697 8.394982 -1.76 0.095 -32.32787 2.813928 ---------------------------------------------------------------------------------

For some reasons, if we wish to display the first stage N – cross-sectional regressions of the FMB procedure, we can use the option **first**. And if we wish to save the first stage results to a file, we can use the option **save**(*filename*). Therefore, commands for these options will look like:

asreg invest mvalue kstock, fmb newey(2) first asreg invest mvalue kstock, fmb newey(2) first save(FirstStage)

** First stage Fama-McBeth regression results**

_TimeVar | _obs | _R2 | _b_mva~e | _b_kstock | _Cons |

1935 | 10 | .865262 | .1024979 | -.0019948 | .3560334 |

1936 | 10 | .6963937 | .0837074 | -.0536413 | 15.21895 |

1937 | 10 | .6637627 | .0765138 | .2177224 | -3.386471 |

1938 | 10 | .7055773 | .0680178 | .2691146 | -17.5819 |

1939 | 10 | .8266015 | .0655219 | .1986646 | -21.15423 |

1940 | 10 | .8392551 | .095399 | .2022906 | -27.04707 |

1941 | 10 | .8562148 | .1147638 | .177465 | -16.51949 |

1942 | 10 | .857307 | .1428251 | .071024 | -17.61828 |

1943 | 10 | .842064 | .1186095 | .1054119 | -22.7638 |

1944 | 10 | .875515 | .1181642 | .0722072 | -15.82815 |

1945 | 10 | .9067973 | .1084709 | .0502208 | -10.51968 |

1946 | 10 | .8947517 | .1379482 | .0054134 | -5.990657 |

1947 | 10 | .8912394 | .163927 | -.0037072 | -3.732489 |

1948 | 10 | .7888235 | .1786673 | -.0425555 | 8.53881 |

1949 | 10 | .8632568 | .1615962 | -.0369651 | 5.178286 |

1950 | 10 | .8577138 | .1762168 | -.0220956 | -12.17468 |

1951 | 10 | .873773 | .1831405 | -.1120569 | 26.13816 |

1952 | 10 | .8461224 | .1989208 | -.067495 | 7.29284 |

1953 | 10 | .8892606 | .1826739 | .0987533 | -50.15255 |

1954 | 10 | .8984501 | .1345116 | .3313746 | -133.3931 |

Relevant articles:

## 20 Comments

## Dr. Hassan Raza

March 24, 2019at 11:25 amDear Sir,

Hope you are fine and in good health. I am one of your student from Bara-Gali workshop, I am applying Fama and Macbeth regression on Pakistan Stock exchange firms on monthly data (Data sheet attached herewith). I have some queries regarding asreg

, this code provides the second stage Fama and Macbeth results, but as I check the first stage it only shows me … (Dots) in the first process, why?

When same procedure is applied for Global market excess return, it omitted the same variable and provide results for only constant term why?

I am sorry for your precious time. Please also let me know about any coming workshop on Stata.

## Attaullah Shah

March 24, 2019at 11:35 amA bit of code was missing which I have added. The updated version can be downloaded from SSC a week or so. However, at the moment, there is a workaround and you do not need to wait for the updated version. So just add the

`save`

option to the line and it will work as expected. Bonus yet, you can the first stage regression ouptut in a file.## Dr. Hassan Raza

March 24, 2019at 11:43 amThank you so much sir. What about when I regressed against excess global premium it omitted the said variable and only report constant. Sorry for your time.

## Attaullah Shah

March 24, 2019at 11:45 amSince the FMB regression is a cross-sectional regression, estimated in each time period, therefore, the variables need to vary across entities. Your gspc_return variable seems to be constant within a given period. See the case of the first month:

and you shall see that all the values of this variable are the same within the given month, and is also the case with other months; therefore, the regression does not find any variation in the dataset to fit the model.

## Mathias

April 12, 2019at 10:37 amDear Attaullah Shah,

Is the F value in asreg Y X, fmb by(time) defined as the time-series average of the F values from the cross-sectional regressions?

Thank you for your asreg package, which is very useful to me.

Regards,

Mathias

## Attaullah Shah

April 13, 2019at 11:26 amMathiasThe F-value is directly reported from the mvreg regression that is estimated for all the cross-sectional regressions of the first stage of FMB

## Anonymous

April 26, 2019at 6:26 pmDear Attaullah Shah,

Is it possible to generate the adj. R^2? Thank you!

## Monica

April 26, 2019at 6:28 pmDear Attaullah Shah,

Is it possible to derive the adj. R^2 variable? Thank you.

## Marie

May 9, 2019at 3:01 pmHey,

I am a little bit unsure how I should understand the procedure.

Does this mean that you estimate one regression for each year across the firms? Or do you estimate one regression on each firm (even though some may be unbalanced, thus some periods may be missing both in the long time interval both also in consecutive periods), and then take the average of this coefficient for each year given the firm present in each period.

Thank you!

## Attaullah Shah

May 9, 2019at 4:07 pmMarie

To understand the FMB procedure, you should first study their 1973 paper and relevant other literature. The procedure estimates a cross-sectional regression in each period in the first step. And in the second step, all those cross-sectional coefficients are averaged across time periods. The standard errors are adjusted, see Fama and MacBeth(1973) paper for more details.

## Thomas A.

May 14, 2019at 5:03 pmDear Attaullah Shah,

First of all, thank you for your website it has been great support to me.

However, I have problems using the fmb on my data set. I have a panel dataset with monthly fund returns from which I wanted to get the average alpha using the fama french 3-factor model. When I set xtset Fund Time I always get omitted variables. The paper I am referring to is doing the same, but does not get omitted variables? Do you have an idea what I’m doing wrong?

I am using: asreg fund_return mktfrf smb hml, fmb

## Attaullah Shah

May 15, 2019at 2:01 amThomas

A similar issue is reported every now and then on Statalist. A more recent thread on the Statalist discusses the issue of variables that are invariant cross-sectionally. Please go there and read the thread.

## Thomas A.

May 15, 2019at 3:53 pmThank you for the answer,

not sure if I got it right. The Fama-French factors are panel invariant variables and thus the variables get omitted. But why are so many research papers state that they are using FMB in this context since they all face the same problem? Is there a step to perform before using asreg fmb to get variant variables or would an xtset to time id help?

## Attaullah Shah

May 15, 2019at 4:18 pmThomas

We would be interested in posting relevant text from such papers here. If you

this will cause asreg to first estimate a time series regression for each company and then report the averages of those time series regressions.

## Thomas A.

May 15, 2019at 8:19 pmHappy to share that paper with you, but since it is a working paper which is not published yet I would prefer to send in private. Just leave me an e-mail adress where to send it to.

## Attaullah Shah

May 16, 2019at 9:34 pmThomas

What I meant was to share text from the mentioned papers that use Fama and French factors in Fama and MacBeth (1973) regression.

## Thomas A.

May 16, 2019at 10:44 pmAtthullah

here is a link to one paper: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3081166

I am referring to the description of table 2 in specific.

## Attaullah Shah

May 17, 2019at 1:03 amOn page 9 of the mentioned paper, the author writes

“Table 2 shows by-fund average fund performance with Fama and MacBeth (1973) standard errors based on monthly returns.”Therefore, the author does not estimate cross-sectional regressions in the first stage of the Fama and MacBeth (1973) procedure. Rather, he estimates time series regression for each fund, and then finds averages across all firms.

## Antonio

May 25, 2019at 10:09 pmDear Sir,

I was wandering how to run a Fama and MacBeth regression over 25 Portfolios.

In accordance with your code, the first variable needs to be the dependent variable while the following variables are considered as independent variables.. Basically I would like to calculate the risk premium of a factor over the 25 value ans size sorted portfolios. Therefore in my case i would have more dependent variables and just one dependent variable.

Thanks for your avialability

## Attaullah Shah

May 26, 2019at 1:17 amAntonio

To answer your question, I have written this post.