Fama-Macbeth regression is a two steps procedure. In the first step, it runs cross-sectional regression at each point of time; the second step estimates the coefficient as the average of the cross-sectional regression estimates (Fama & MacBeth, 1972). https://finpko.ku.edu/myssi/FIN938/Fama%20&%20Macbeth.JPE_1973.pdf
For each time t, we run a cross-sectional regression:
\[ R_i _t=α_i+βmvalue_i_t * mvalue_i_t + βkstock_i_t *kstock_it + ϵ_i_t \] Estimate the average of the first step regression coefficient estimates
\[ β^k= 1/T \sum_{t=1}^ {T}β_k _t \]
Load the packages
require(foreign)
require(plm)
require(lmtest)
Grunfeld Investment Data of 10 firms for 20 years (1935-1954) is available at http://people.stern.nyu.edu/wgreene/Econometrics/PanelDataSets.htm
Download and import data
library(readxl)
grunfeld <- read_excel("C:/Users/HP/Downloads/grunfeld.xlsx")
View(grunfeld)
names(grunfeld)
## [1] "FIRM" "YEAR" "I" "F" "C"
First make a copy of dataset and rename the variables
grunfeld_copy <- grunfeld
names(grunfeld_copy) <- c("FIRM", "YEAR", "investment", "mvalue", "kstock")
names(grunfeld_copy)
## [1] "FIRM" "YEAR" "investment" "mvalue" "kstock"
fpmg <- pmg(investment ~ mvalue + kstock, grunfeld_copy, index=c("YEAR","FIRM"))
summary(fpmg)
## Mean Groups model
##
## Call:
## pmg(formula = investment ~ mvalue + kstock, data = grunfeld_copy,
## index = c("YEAR", "FIRM"))
##
## Balanced Panel: n = 20, T = 10, N = 200
##
## Residuals:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -342.804 -20.101 0.727 0.000 23.653 258.505
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) -14.7569720 7.2876699 -2.0249 0.042875 *
## mvalue 0.1306047 0.0093422 13.9801 < 2.2e-16 ***
## kstock 0.0729576 0.0277398 2.6301 0.008537 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Total Sum of Squares: 9359900
## Residual Sum of Squares: 1205800
## Multiple R-squared: 0.87117
coeftest(fpmg)
##
## t test of coefficients:
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -14.7569720 7.2876699 -2.0249 0.044225 *
## mvalue 0.1306047 0.0093422 13.9801 < 2.2e-16 ***
## kstock 0.0729576 0.0277398 2.6301 0.009211 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
confint(fpmg)
## 2.5 % 97.5 %
## (Intercept) -29.04054264 -0.4734014
## mvalue 0.11229429 0.1489150
## kstock 0.01858857 0.1273265