library(wooldridge)
library(rmarkdown)
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
library(AER)
## Loading required package: car
## Loading required package: carData
## Loading required package: lmtest
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: sandwich
## Loading required package: survival
data("card")
paged_table(card)
MODEL1<-lm(educ~nearc4+exper+I(exper^2)+black+smsa+south,data = card)
summary(MODEL1)
##
## Call:
## lm(formula = educ ~ nearc4 + exper + I(exper^2) + black + smsa +
## south, data = card)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.6419 -1.3928 -0.0953 1.2638 6.2692
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 16.6591746 0.1763889 94.446 < 2e-16 ***
## nearc4 0.3373208 0.0825004 4.089 4.45e-05 ***
## exper -0.4100081 0.0336939 -12.169 < 2e-16 ***
## I(exper^2) 0.0007323 0.0016499 0.444 0.657201
## black -1.0061383 0.0896454 -11.224 < 2e-16 ***
## smsa 0.4038769 0.0848872 4.758 2.05e-06 ***
## south -0.2914640 0.0792247 -3.679 0.000238 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.943 on 3003 degrees of freedom
## Multiple R-squared: 0.4745, Adjusted R-squared: 0.4734
## F-statistic: 451.9 on 6 and 3003 DF, p-value: < 2.2e-16
Model2<-lm(formula = log(wage)~educ+exper+I(exper^2)+black+smsa+south,data = card)
stargazer(Model2,type = "text")
##
## ===============================================
## Dependent variable:
## ---------------------------
## log(wage)
## -----------------------------------------------
## educ 0.074***
## (0.004)
##
## exper 0.084***
## (0.007)
##
## I(exper2) -0.002***
## (0.0003)
##
## black -0.190***
## (0.018)
##
## smsa 0.161***
## (0.016)
##
## south -0.125***
## (0.015)
##
## Constant 4.734***
## (0.068)
##
## -----------------------------------------------
## Observations 3,010
## R2 0.291
## Adjusted R2 0.289
## Residual Std. Error 0.374 (df = 3003)
## F Statistic 204.932*** (df = 6; 3003)
## ===============================================
## Note: *p<0.1; **p<0.05; ***p<0.01
summary(Model2)
##
## Call:
## lm(formula = log(wage) ~ educ + exper + I(exper^2) + black +
## smsa + south, data = card)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.59297 -0.22315 0.01893 0.24223 1.33190
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.7336642 0.0676026 70.022 < 2e-16 ***
## educ 0.0740090 0.0035054 21.113 < 2e-16 ***
## exper 0.0835958 0.0066478 12.575 < 2e-16 ***
## I(exper^2) -0.0022409 0.0003178 -7.050 2.21e-12 ***
## black -0.1896315 0.0176266 -10.758 < 2e-16 ***
## smsa 0.1614230 0.0155733 10.365 < 2e-16 ***
## south -0.1248615 0.0151182 -8.259 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3742 on 3003 degrees of freedom
## Multiple R-squared: 0.2905, Adjusted R-squared: 0.2891
## F-statistic: 204.9 on 6 and 3003 DF, p-value: < 2.2e-16
Model3<-ivreg(log(wage)~educ+exper+I(exper^2)+black+smsa+south|exper+I(exper^2)+black+smsa+south+nearc4,data = card)
stargazer(Model3,type = "text")
##
## ===============================================
## Dependent variable:
## ---------------------------
## log(wage)
## -----------------------------------------------
## educ 0.132***
## (0.049)
##
## exper 0.107***
## (0.021)
##
## I(exper2) -0.002***
## (0.0003)
##
## black -0.131**
## (0.053)
##
## smsa 0.131***
## (0.030)
##
## south -0.105***
## (0.023)
##
## Constant 3.753***
## (0.829)
##
## -----------------------------------------------
## Observations 3,010
## R2 0.225
## Adjusted R2 0.224
## Residual Std. Error 0.391 (df = 3003)
## ===============================================
## Note: *p<0.1; **p<0.05; ***p<0.01
summary(Model3)
##
## Call:
## ivreg(formula = log(wage) ~ educ + exper + I(exper^2) + black +
## smsa + south | exper + I(exper^2) + black + smsa + south +
## nearc4, data = card)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.82125 -0.24065 0.02368 0.25469 1.43205
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.7527815 0.8293409 4.525 6.27e-06 ***
## educ 0.1322888 0.0492332 2.687 0.00725 **
## exper 0.1074980 0.0213006 5.047 4.76e-07 ***
## I(exper^2) -0.0022841 0.0003341 -6.836 9.84e-12 ***
## black -0.1308019 0.0528723 -2.474 0.01342 *
## smsa 0.1313237 0.0301298 4.359 1.35e-05 ***
## south -0.1049005 0.0230731 -4.546 5.67e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.391 on 3003 degrees of freedom
## Multiple R-Squared: 0.2252, Adjusted R-squared: 0.2237
## Wald test: 120.8 on 6 and 3003 DF, p-value: < 2.2e-16
stargazer(Model2,Model3,type = "text")
##
## ======================================================================
## Dependent variable:
## --------------------------------------
## log(wage)
## OLS instrumental
## variable
## (1) (2)
## ----------------------------------------------------------------------
## educ 0.074*** 0.132***
## (0.004) (0.049)
##
## exper 0.084*** 0.107***
## (0.007) (0.021)
##
## I(exper2) -0.002*** -0.002***
## (0.0003) (0.0003)
##
## black -0.190*** -0.131**
## (0.018) (0.053)
##
## smsa 0.161*** 0.131***
## (0.016) (0.030)
##
## south -0.125*** -0.105***
## (0.015) (0.023)
##
## Constant 4.734*** 3.753***
## (0.068) (0.829)
##
## ----------------------------------------------------------------------
## Observations 3,010 3,010
## R2 0.291 0.225
## Adjusted R2 0.289 0.224
## Residual Std. Error (df = 3003) 0.374 0.391
## F Statistic 204.932*** (df = 6; 3003)
## ======================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01