Fama and MacBeth (1973) Fastest regression in Stata

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:

Rolling window statistics with asrol


6 Comments

Dr. Hassan Raza

March 24, 2019at 11:25 am

Dear 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

asreg ex_firm_re ex_mkt_re , fmb

, 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 am

    A 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.

    asregc ex_firm_re ex_mkt_re , fmb first seve(first)

Dr. Hassan Raza

March 24, 2019at 11:43 am

Thank 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 am

    Since 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:

    edit if month_year == 487

    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 am

Dear 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 am

    Mathias
    The F-value is directly reported from the mvreg regression that is estimated for all the cross-sectional regressions of the first stage of FMB

Leave a Reply

12 + one =