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).
## Warning: package 'plm' was built under R version 4.0.5
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
grunfeld <- read.csv("d:/FREELANCE-CHEZ/grunfeld.csv")
View(grunfeld)
names(grunfeld)
## [1] "FIRM" "YEAR" "I" "F" "C"
Fama-MacBeth regression and summary of results
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,data= 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