# Implementing Fama-MacBeth cross sectional regression

I have built a Fama and French three factors model (market excess return, small-minus-big, high-minus-low) and estimated its betas through a time series regression (code in R, but any other language works fine too):

lm(return ~ market_excess_return + small_minus_big + high_minus_low, data = df)

Now I want to run a cross-sectional regression in Fama-MacBeth (1973) fashion.

I don't understand how to proceed with this. In particular, I understand that the previously estimated betas become new explanatory variables. But what is not clear to me is:

• is there any other explanatory variable?
• how to correctly specify the dependent variable?

Online I found the following but I don't know how to use it:

twof <- lm(returns ~ betas + factorbetas, data=sstage)

You first run your FF three factor model. And get an estimate of $$\alpha$$ and $$\beta$$ for each factor.

Then for each month $$t$$, you run a cross-section regression:

$$r_{i,t} = \lambda_0 + \hat{\beta}_i {\lambda}_t + \epsilon_{i,t}$$

Where: $$\hat{\beta}_i \equiv [\beta_{i, MktRf}, \beta_{i, SMB}, \beta_{i, HML}]'$$, is a vector of the coefficients estimated on the first step.

What you are looking for is to estimate the vector of $$\hat{\lambda}_t \equiv [\lambda_{t, MktRf}, \lambda_{y, SMB}, \lambda_{t, HML}]$$.

So after the second step you will have $$T$$ estimates for each $$\lambda$$ (price of risk).

Then you just need to average those $$\lambda$$'s:

$$\hat{\lambda} = \frac{1}{T} \sum^{T}_{t=1} \hat{\lambda}_t$$

And you can test their statistical significance using as a variance estimate the following:

$$Est.Asy.Var(\hat{\lambda}) = \frac{1}{T^2} \sum^{T}_{t=1} (\hat{\lambda}_t - \hat{\lambda} )(\hat{\lambda}_t - \hat{\lambda} )'$$