Loading Libraries

library(hayashir)
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(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
library(AER)
#> Loading required package: car
#> Loading required package: carData
#> 
#> Attaching package: 'car'
#> The following object is masked from 'package:dplyr':
#> 
#>     recode
#> Loading required package: lmtest
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> 
#> Attaching package: 'lmtest'
#> The following object is masked from 'package:hayashir':
#> 
#>     moneydemand
#> Loading required package: sandwich
#> Loading required package: survival

Inspecting the data

str(griliches)
#> Classes 'tbl_df', 'tbl' and 'data.frame':    758 obs. of  20 variables:
#>  $ southern_residence   : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ southern_residence_80: num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ married              : num  0 0 0 0 1 0 1 1 1 1 ...
#>  $ married_80           : num  1 1 1 1 1 0 1 1 1 1 ...
#>  $ lives_metro          : num  1 1 1 1 1 1 1 0 1 0 ...
#>  $ lives_metro_80       : num  1 1 1 1 1 1 1 0 1 0 ...
#>  $ mothers_educ         : num  8 14 14 12 6 8 8 14 12 13 ...
#>  $ iq_score             : num  93 119 108 96 74 91 114 111 95 132 ...
#>  $ kww_score            : num  35 41 46 32 27 24 50 37 44 44 ...
#>  $ year                 : num  68 66 67 66 73 66 73 67 66 73 ...
#>  $ age                  : num  19 23 20 18 26 16 30 23 22 30 ...
#>  $ age_80               : num  31 37 33 32 34 30 38 36 36 38 ...
#>  $ education            : num  12 16 14 12 9 9 18 15 12 18 ...
#>  $ education_80         : num  12 18 14 12 11 10 18 15 12 18 ...
#>  $ experience           : num  0.462 0 0.423 0.333 9.013 ...
#>  $ experience_80        : num  10.6 11.4 11 13.1 14.4 ...
#>  $ tenure               : num  0 2 1 1 3 1 6 1 2 5 ...
#>  $ tenure_80            : num  2 16 9 7 5 0 14 1 16 13 ...
#>  $ log_wage             : num  5.9 5.44 5.71 5.48 5.93 ...
#>  $ log_wage_80          : num  6.64 6.69 6.71 6.48 6.33 ...

Table 3.1


to_summarize <- griliches %>%
                    select(age, education, log_wage, kww_score, iq_score, experience)

stargazer(as.data.frame(to_summarize), type = "html")
Statistic N Mean St. Dev. Min Pctl(25) Pctl(75) Max
age 758 21.835 2.982 16 20 24 30
education 758 13.405 2.232 9 12 16 18
log_wage 758 5.687 0.429 4.605 5.380 5.991 7.051
kww_score 758 36.574 7.302 12 32 41 56
iq_score 758 103.856 13.619 54 95.2 113.8 145
experience 758 1.735 2.106 0.000 0.282 2.440 11.444

Notice that because we are using the Blackburn-Neumark data rather than copying the data from Griliches directly we get slightly different results.

Table 3.2

First we estimate the three models. We again expect slightly different results because (i) we have different data than Griliches; and (ii) the controls are slightly different - due to data availability.

model1 <- lm(log_wage ~ education + 
                 experience + tenure +
                 southern_residence + lives_metro + 
                 age + I(age^2) + married, 
                 data = griliches)
model2 <- lm(log_wage ~ education + iq_score + 
                 experience + tenure +
                 southern_residence + lives_metro + 
                 age + I(age^2) + married, 
                 data = griliches)
model3 <- ivreg(log_wage ~ education + iq_score + 
                     experience + tenure +
                     southern_residence + lives_metro +  
                     age + I(age^2) + married | 
                     . -iq_score + kww_score + mothers_educ,
                    data = griliches)

Let’s put them all into a table, we use Std Errors in parentheses, not t-stats:


stargazer(model1, model2, model3, type = "html",
          keep = c("education", "iq_score", "experience",
                  "tenure")
          )
Dependent variable:
log_wage
OLS instrumental
variable
(1) (2) (3)
education 0.067*** 0.054*** 0.062***
(0.007) (0.008) (0.017)
iq_score 0.004*** 0.001
(0.001) (0.005)
experience 0.003 0.004 0.003
(0.007) (0.007) (0.007)
tenure 0.009 0.007 0.008
(0.008) (0.008) (0.008)
Observations 758 758 758
R2 0.426 0.437 0.432
Adjusted R2 0.420 0.430 0.426
Residual Std. Error 0.327 (df = 749) 0.324 (df = 748) 0.325 (df = 748)
F Statistic 69.490*** (df = 8; 749) 64.450*** (df = 9; 748)
Note: p<0.1; p<0.05; p<0.01