Purpose of this post is to explain Frisch-Waught in a very simple form as many a times students in econometric classes are used to memorize the concept \(y=\beta_0x+\beta_1x_1+\beta_2x_2+\epsilon\) Using the data set Growth described (description is provided in previous video), excluding the data for Malta, run the following five regressions: Growth on
(1) TradeShare and YearsSchool;
library(readxl)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(moderndive)
library(gridExtra)
## Warning: package 'gridExtra' was built under R version 3.6.2
##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
library(ggplot2)
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.2. https://CRAN.R-project.org/package=stargazer
Growth <- read_excel("C:/Users/hp/Dropbox/Applied Economics/Growth.xlsx")
glimpse(Growth)
## Observations: 65
## Variables: 7
## $ country_name <chr> "India", "Argentina", "Japan", "Brazil", "United Stat...
## $ growth <dbl> 1.9151680, 0.6176451, 4.3047590, 2.9300970, 1.7122650...
## $ rgdp60 <dbl> 765.9998, 4462.0010, 2954.0000, 1784.0000, 9895.0040,...
## $ tradeshare <dbl> 0.1405020, 0.1566230, 0.1577032, 0.1604051, 0.1608150...
## $ yearsschool <dbl> 1.45, 4.99, 6.71, 2.89, 8.66, 0.79, 3.80, 2.97, 3.02,...
## $ rev_coups <dbl> 0.1333333, 0.9333333, 0.0000000, 0.1000000, 0.0000000...
## $ assasinations <dbl> 0.8666667, 1.9333330, 0.2000000, 0.1000000, 0.4333333...
growth_malta<-Growth %>% filter(country_name!="Malta")
mod.lm1<-lm(growth~tradeshare+yearsschool,data = growth_malta)
mod.lm2<-lm(growth~yearsschool,data = growth_malta)
mod.lm3<-lm(tradeshare~yearsschool,data = growth_malta)
gr_yrs<-mod.lm2$residuals
trsh_yrs<-mod.lm3$residuals
mod.lm4<-lm(gr_yrs~trsh_yrs)
get_regression_table(mod.lm1)
## # A tibble: 3 x 7
## term estimate std_error statistic p_value lower_ci upper_ci
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 intercept -0.122 0.663 -0.184 0.854 -1.45 1.20
## 2 tradeshare 1.90 0.936 2.03 0.047 0.026 3.77
## 3 yearsschool 0.243 0.084 2.90 0.005 0.076 0.41
get_regression_table(mod.lm4)
## # A tibble: 2 x 7
## term estimate std_error statistic p_value lower_ci upper_ci
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 intercept 0 0.21 0 1 -0.419 0.419
## 2 trsh_yrs 1.90 0.928 2.04 0.045 0.042 3.75
stargazer(mod.lm1,mod.lm4,type = "text")
##
## ==============================================================
## Dependent variable:
## ------------------------------------------
## growth gr_yrs
## (1) (2)
## --------------------------------------------------------------
## tradeshare 1.898**
## (0.936)
##
## yearsschool 0.243***
## (0.084)
##
## trsh_yrs 1.898**
## (0.928)
##
## Constant -0.122 0.000
## (0.663) (0.210)
##
## --------------------------------------------------------------
## Observations 64 64
## R2 0.161 0.063
## Adjusted R2 0.133 0.048
## Residual Std. Error 1.691 (df = 61) 1.677 (df = 62)
## F Statistic 5.836*** (df = 2; 61) 4.178** (df = 1; 62)
## ==============================================================
## Note: *p<0.1; **p<0.05; ***p<0.01