Introductory Econometrics Using R

Also covered using Python and Stata

library(wooldridge)
library(psych)
library(stargazer)
library(car)

Example7.1. Hourly wage equation

Average wage difference between men and women in the sample

wage_fem <- lm(wage ~ female + educ + exper + tenure + 1, data=wage1)
stargazer(wage_fem, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                wage            
## -----------------------------------------------
## female                       -1.811***         
##                               (0.265)          
## educ                         0.572***          
##                               (0.049)          
## exper                         0.025**          
##                               (0.012)          
## tenure                       0.141***          
##                               (0.021)          
## Constant                     -1.568**          
##                               (0.725)          
## -----------------------------------------------
## Observations                    526            
## R2                             0.364           
## Adjusted R2                    0.359           
## Residual Std. Error      2.958 (df = 521)      
## F Statistic           74.398*** (df = 4; 521)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Average wage for men in the sample

wage_fem2 <- lm(wage ~ female + 1, data=wage1)
stargazer(wage_fem2,type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                wage            
## -----------------------------------------------
## female                       -2.512***         
##                               (0.303)          
## Constant                     7.099***          
##                               (0.210)          
## -----------------------------------------------
## Observations                    526            
## R2                             0.116           
## Adjusted R2                    0.114           
## Residual Std. Error      3.476 (df = 524)      
## F Statistic           68.537*** (df = 1; 524)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Average wage for men and women in the sample

aggregate(wage1$wage,list(wage1$female), mean )
##   Group.1        x
## 1       0 7.099489
## 2       1 4.587659

Example 7.2. Effect of computer ownership on collage GPA

colGPA_ur <- lm(colGPA ~ PC + hsGPA + ACT + 1, data=gpa1)
stargazer(colGPA_ur, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               colGPA           
## -----------------------------------------------
## PC                           0.157***          
##                               (0.057)          
## hsGPA                        0.447***          
##                               (0.094)          
## ACT                            0.009           
##                               (0.011)          
## Constant                     1.264***          
##                               (0.333)          
## -----------------------------------------------
## Observations                    141            
## R2                             0.219           
## Adjusted R2                    0.202           
## Residual Std. Error      0.333 (df = 137)      
## F Statistic           12.834*** (df = 3; 137)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
linearHypothesis(colGPA_ur, c("hsGPA = 0", "ACT=0"))
## Linear hypothesis test
## 
## Hypothesis:
## hsGPA = 0
## ACT = 0
## 
## Model 1: restricted model
## Model 2: colGPA ~ PC + hsGPA + ACT + 1
## 
##   Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
## 1    139 18.436                                  
## 2    137 15.149  2    3.2873 14.865 1.437e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
colGPA_r <- lm(colGPA ~ PC + 1, data=gpa1)
stargazer(colGPA_r, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               colGPA           
## -----------------------------------------------
## PC                           0.170***          
##                               (0.063)          
## Constant                     2.989***          
##                               (0.040)          
## -----------------------------------------------
## Observations                    141            
## R2                             0.050           
## Adjusted R2                    0.043           
## Residual Std. Error      0.364 (df = 139)      
## F Statistic           7.314*** (df = 1; 139)   
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
aggregate(gpa1$colGPA,list(gpa1$PC), mean )
##   Group.1        x
## 1       0 2.989412
## 2       1 3.158929

Example 7.3. Effect of Training Grants on hours of training

jtrain88 <- subset(jtrain, jtrain$year==1988)
jobb_reg <- lm(hrsemp ~ grant + lsales + lemploy + 1, data=jtrain88)
stargazer(jobb_reg, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               hrsemp           
## -----------------------------------------------
## grant                        26.254***         
##                               (5.592)          
## lsales                        -0.985           
##                               (3.540)          
## lemploy                       -6.070           
##                               (3.883)          
## Constant                      46.665           
##                              (43.412)          
## -----------------------------------------------
## Observations                    105            
## R2                             0.237           
## Adjusted R2                    0.214           
## Residual Std. Error      24.380 (df = 101)     
## F Statistic           10.444*** (df = 3; 101)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Example 7.4. Housing price regression

hrpice_reg <- lm(lprice ~ llotsize + lsqrft  + bdrms + colonial + 1, data=hprice1)
stargazer(hrpice_reg, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               lprice           
## -----------------------------------------------
## llotsize                     0.168***          
##                               (0.038)          
## lsqrft                       0.707***          
##                               (0.093)          
## bdrms                          0.027           
##                               (0.029)          
## colonial                       0.054           
##                               (0.045)          
## Constant                     -1.350**          
##                               (0.651)          
## -----------------------------------------------
## Observations                    88             
## R2                             0.649           
## Adjusted R2                    0.632           
## Residual Std. Error       0.184 (df = 83)      
## F Statistic           38.378*** (df = 4; 83)   
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Example7.5. Hourly wage equation

wage_reg <- lm(lwage ~ female + educ  + exper + expersq + tenure + tenursq + 1, data=wage1)
stargazer(wage_reg, type="text", single.row=TRUE, no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                lwage           
## -----------------------------------------------
## female                   -0.297*** (0.036)     
## educ                     0.080*** (0.007)      
## exper                    0.029*** (0.005)      
## expersq                 -0.001*** (0.0001)     
## tenure                   0.032*** (0.007)      
## tenursq                  -0.001** (0.0002)     
## Constant                 0.417*** (0.099)      
## -----------------------------------------------
## Observations                    526            
## R2                             0.441           
## Adjusted R2                    0.434           
## Residual Std. Error      0.400 (df = 519)      
## F Statistic           68.177*** (df = 6; 519)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
level_fem <- exp(wage_reg$coef[2]) - 1
level_fem
##     female 
## -0.2565925

Example 7.6. Hourly wage equation

marrmale <- (wage1$female==0 & wage1$married==1)
marrfem <- (wage1$female==1 & wage1$married==1)
singfem <- (wage1$female==1 & wage1$married==0)
singmale <- (wage1$female==0 & wage1$married==0)

wage_sf = lm(lwage ~ marrmale + marrfem + singfem + educ  + exper + expersq + tenure + tenursq + 1, data=wage1)
stargazer(wage_sf, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                lwage           
## -----------------------------------------------
## marrmale                 0.213*** (0.055)      
## marrfem                  -0.198*** (0.058)     
## singfem                  -0.110** (0.056)      
## educ                     0.079*** (0.007)      
## exper                    0.027*** (0.005)      
## expersq                 -0.001*** (0.0001)     
## tenure                   0.029*** (0.007)      
## tenursq                  -0.001** (0.0002)     
## Constant                 0.321*** (0.100)      
## -----------------------------------------------
## Observations                    526            
## R2                             0.461           
## Adjusted R2                    0.453           
## Residual Std. Error      0.393 (df = 517)      
## F Statistic           55.246*** (df = 8; 517)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
wage_sm = lm(lwage ~ marrmale + marrfem + singmale + educ  + exper + expersq + tenure + tenursq + 1, data=wage1)
stargazer(wage_sm, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                lwage           
## -----------------------------------------------
## marrmale                 0.323*** (0.050)      
## marrfem                   -0.088* (0.052)      
## singmale                  0.110** (0.056)      
## educ                     0.079*** (0.007)      
## exper                    0.027*** (0.005)      
## expersq                 -0.001*** (0.0001)     
## tenure                   0.029*** (0.007)      
## tenursq                  -0.001** (0.0002)     
## Constant                  0.211** (0.097)      
## -----------------------------------------------
## Observations                    526            
## R2                             0.461           
## Adjusted R2                    0.453           
## Residual Std. Error      0.393 (df = 517)      
## F Statistic           55.246*** (df = 8; 517)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Example 7.7. Effects of physical attractiveness on wage

beauty0<-subset(beauty, beauty$female==0)
beauty_reg0 <- lm(lwage ~ belavg + abvavg + educ  + exper + expersq + union + married + black + south + goodhlth + 1, data=beauty0)
stargazer(beauty_reg0, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                lwage           
## -----------------------------------------------
## belavg                   -0.165*** (0.053)     
## abvavg                    -0.025 (0.038)       
## educ                     0.061*** (0.007)      
## exper                    0.046*** (0.006)      
## expersq                 -0.001*** (0.0001)     
## union                    0.149*** (0.036)      
## married                    0.064 (0.044)       
## black                    -0.257*** (0.076)     
## south                     0.085** (0.043)      
## goodhlth                   0.001 (0.070)       
## Constant                 0.478*** (0.120)      
## -----------------------------------------------
## Observations                    824            
## R2                             0.255           
## Adjusted R2                    0.246           
## Residual Std. Error      0.469 (df = 813)      
## F Statistic          27.819*** (df = 10; 813)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
beauty1<-subset(beauty, beauty$female==1)

beauty_reg1 <- lm(lwage ~ belavg + abvavg + educ  + exper + expersq + union + married + black + south + goodhlth + 1, data=beauty1)

stargazer(beauty_reg1, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                lwage           
## -----------------------------------------------
## belavg                    -0.114* (0.066)      
## abvavg                     0.069 (0.049)       
## educ                     0.076*** (0.009)      
## exper                    0.029*** (0.007)      
## expersq                 -0.0005*** (0.0002)    
## union                    0.293*** (0.054)      
## married                   -0.062 (0.044)       
## black                     0.144** (0.069)      
## south                      0.008 (0.060)       
## goodhlth                   0.113 (0.081)       
## Constant                  -0.077 (0.144)       
## -----------------------------------------------
## Observations                    436            
## R2                             0.278           
## Adjusted R2                    0.261           
## Residual Std. Error      0.451 (df = 425)      
## F Statistic          16.399*** (df = 10; 425)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Example 7.8. Effects of law school rankings on starting salaries

r61_100 <- (lawsch85$rank>60 & lawsch85$rank<=100)
lawsch85 <- cbind(lawsch85, r61_100)
lawsch85_reg = lm(lsalary ~ top10 + r11_25  + r26_40 + r41_60 + r61_100 + LSAT + GPA + llibvol + lcost + 1, data=lawsch85)
stargazer(lawsch85_reg, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               lsalary          
## -----------------------------------------------
## top10                    0.700*** (0.053)      
## r11_25                   0.594*** (0.039)      
## r26_40                   0.375*** (0.034)      
## r41_60                   0.263*** (0.028)      
## r61_100                  0.132*** (0.021)      
## LSAT                      0.006* (0.003)       
## GPA                        0.014 (0.074)       
## llibvol                    0.036 (0.026)       
## lcost                      0.001 (0.025)       
## Constant                 9.165*** (0.411)      
## -----------------------------------------------
## Observations                    136            
## R2                             0.911           
## Adjusted R2                    0.905           
## Residual Std. Error      0.086 (df = 126)      
## F Statistic          143.199*** (df = 9; 126)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
linearHypothesis (lawsch85_reg, c("LSAT = 0",  "GPA = 0", "llibvol = 0", "lcost = 0"))
## Linear hypothesis test
## 
## Hypothesis:
## LSAT = 0
## GPA = 0
## llibvol = 0
## lcost = 0
## 
## Model 1: restricted model
## Model 2: lsalary ~ top10 + r11_25 + r26_40 + r41_60 + r61_100 + LSAT + 
##     GPA + llibvol + lcost + 1
## 
##   Res.Df     RSS Df Sum of Sq      F Pr(>F)  
## 1    130 0.99409                             
## 2    126 0.92411  4  0.069978 2.3853 0.0547 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Example 7.9. Effects of computer usage on wages

Data not available

Example 7.10. Log hourly wage equation

wage_reg <- lm(lwage ~ female*educ  + exper + expersq + tenure + tenursq + 1, data=wage1)
stargazer(wage_reg, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                lwage           
## -----------------------------------------------
## female                    -0.227 (0.168)       
## educ                     0.082*** (0.008)      
## exper                    0.029*** (0.005)      
## expersq                 -0.001*** (0.0001)     
## tenure                   0.032*** (0.007)      
## tenursq                  -0.001** (0.0002)     
## female:educ               -0.006 (0.013)       
## Constant                 0.389*** (0.119)      
## -----------------------------------------------
## Observations                    526            
## R2                             0.441           
## Adjusted R2                    0.433           
## Residual Std. Error      0.400 (df = 518)      
## F Statistic           58.371*** (df = 7; 518)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
linearHypothesis (wage_reg, c("female = 0", "female:educ = 0"))
## Linear hypothesis test
## 
## Hypothesis:
## female = 0
## female:educ = 0
## 
## Model 1: restricted model
## Model 2: lwage ~ female * educ + exper + expersq + tenure + tenursq + 
##     1
## 
##   Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
## 1    520 93.911                                  
## 2    518 82.922  2     10.99 34.325 1.002e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Example 7.11. Effects of race on baseball player salaries

mlb1<-subset(mlb1, mlb1$percblck!=0)
mlb1_reg <- lm(lsalary ~ years + gamesyr + bavg + hrunsyr + rbisyr + runsyr + fldperc + allstar + black + hispan + black:percblck + hispan:perchisp  + 1, data=mlb1)
stargazer(mlb1_reg, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               lsalary          
## -----------------------------------------------
## years                    0.067*** (0.013)      
## gamesyr                  0.009*** (0.003)      
## bavg                       0.001 (0.002)       
## hrunsyr                    0.015 (0.016)       
## rbisyr                     0.004 (0.008)       
## runsyr                     0.007 (0.005)       
## fldperc                    0.001 (0.002)       
## allstar                  0.008*** (0.003)      
## black                     -0.198 (0.125)       
## hispan                    -0.190 (0.153)       
## black:percblck            0.012** (0.005)      
## hispan:perchisp           0.020** (0.010)      
## Constant                 10.344*** (2.183)     
## -----------------------------------------------
## Observations                    330            
## R2                             0.638           
## Adjusted R2                    0.624           
## Residual Std. Error      0.713 (df = 317)      
## F Statistic          46.482*** (df = 12; 317)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
linearHypothesis (mlb1_reg, c("black = 0","hispan = 0","hispan:perchisp = 0", "black:percblck = 0"))
## Linear hypothesis test
## 
## Hypothesis:
## black = 0
## hispan = 0
## hispan:perchisp = 0
## black:percblck = 0
## 
## Model 1: restricted model
## Model 2: lsalary ~ years + gamesyr + bavg + hrunsyr + rbisyr + runsyr + 
##     fldperc + allstar + black + hispan + black:percblck + hispan:perchisp + 
##     1
## 
##   Res.Df    RSS Df Sum of Sq      F  Pr(>F)  
## 1    321 166.67                              
## 2    317 161.28  4    5.3886 2.6479 0.03348 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mlb1_reg_r <- lm(lsalary ~ years + gamesyr + bavg + hrunsyr + rbisyr + runsyr + fldperc + allstar + 1, data=mlb1)
stargazer(mlb1_reg_r, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               lsalary          
## -----------------------------------------------
## years                    0.067*** (0.013)      
## gamesyr                   0.009** (0.003)      
## bavg                       0.001 (0.002)       
## hrunsyr                    0.014 (0.017)       
## rbisyr                     0.005 (0.008)       
## runsyr                    0.008* (0.005)       
## fldperc                    0.001 (0.002)       
## allstar                   0.007** (0.003)      
## Constant                 10.637*** (2.199)     
## -----------------------------------------------
## Observations                    330            
## R2                             0.626           
## Adjusted R2                    0.616           
## Residual Std. Error      0.721 (df = 321)      
## F Statistic           67.023*** (df = 8; 321)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Equation [7.22] (Page 222)

gpa3 <- subset(gpa3, gpa3$spring==1)
gpa3_reg <- lm(cumgpa ~ female*sat + hsperc + female:hsperc + tothrs + female:tothrs + 1, data=gpa3)
stargazer(gpa3_reg, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               cumgpa           
## -----------------------------------------------
## female                    -0.353 (0.411)       
## sat                      0.001*** (0.0002)     
## hsperc                   -0.008*** (0.001)     
## tothrs                   0.002*** (0.001)      
## female:sat                0.001* (0.0004)      
## female:hsperc             -0.001 (0.003)       
## female:tothrs             -0.0001 (0.002)      
## Constant                 1.481*** (0.207)      
## -----------------------------------------------
## Observations                    366            
## R2                             0.406           
## Adjusted R2                    0.394           
## Residual Std. Error      0.468 (df = 358)      
## F Statistic           34.946*** (df = 7; 358)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
linearHypothesis (gpa3_reg, c("female:tothrs = 0",  "female:sat = 0", "female:hsperc = 0"))
## Linear hypothesis test
## 
## Hypothesis:
## female:tothrs = 0
## female:sat = 0
## female:hsperc = 0
## 
## Model 1: restricted model
## Model 2: cumgpa ~ female * sat + hsperc + female:hsperc + tothrs + female:tothrs + 
##     1
## 
##   Res.Df    RSS Df Sum of Sq      F Pr(>F)
## 1    361 79.362                           
## 2    358 78.355  3    1.0072 1.5339 0.2054

Equation [7.25] (Page 224)

gpa3_reg_r <- lm(cumgpa ~ female + sat + hsperc + tothrs + 1, data=gpa3)
stargazer(gpa3_reg_r, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               cumgpa           
## -----------------------------------------------
## female                       0.310***          
##                               (0.059)          
## sat                          0.001***          
##                              (0.0002)          
## hsperc                       -0.008***         
##                               (0.001)          
## tothrs                       0.002***          
##                               (0.001)          
## Constant                     1.329***          
##                               (0.180)          
## -----------------------------------------------
## Observations                    366            
## R2                             0.398           
## Adjusted R2                    0.392           
## Residual Std. Error      0.469 (df = 361)      
## F Statistic           59.739*** (df = 4; 361)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Equation [7.29] (Page 225)

mroz_reg <- lm(inlf ~ nwifeinc + educ + exper + expersq + age + kidslt6 + kidsge6 + 1, data=mroz)
stargazer(mroz_reg, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                inlf            
## -----------------------------------------------
## nwifeinc                 -0.003** (0.001)      
## educ                     0.038*** (0.007)      
## exper                    0.039*** (0.006)      
## expersq                 -0.001*** (0.0002)     
## age                      -0.016*** (0.002)     
## kidslt6                  -0.262*** (0.034)     
## kidsge6                    0.013 (0.013)       
## Constant                 0.586*** (0.154)      
## -----------------------------------------------
## Observations                    753            
## R2                             0.264           
## Adjusted R2                    0.257           
## Residual Std. Error      0.427 (df = 745)      
## F Statistic           38.218*** (df = 7; 745)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Example7.12. A linear probability model of arrest

arr86 <- (crime1$narr86 > 0)
crime1 <- cbind(crime1, arr86)
crime_reg <- lm(arr86 ~ pcnv + avgsen + tottime + ptime86 + qemp86 + 1, data=crime1)
stargazer(crime_reg, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                arr86           
## -----------------------------------------------
## pcnv                         -0.162***         
##                               (0.021)          
## avgsen                         0.006           
##                               (0.006)          
## tottime                       -0.002           
##                               (0.005)          
## ptime86                      -0.022***         
##                               (0.005)          
## qemp86                       -0.043***         
##                               (0.005)          
## Constant                     0.441***          
##                               (0.017)          
## -----------------------------------------------
## Observations                   2,725           
## R2                             0.047           
## Adjusted R2                    0.046           
## Residual Std. Error      0.437 (df = 2719)     
## F Statistic          27.030*** (df = 5; 2719)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01
linearHypothesis (crime_reg, c("avgsen = 0",  "tottime = 0"))
## Linear hypothesis test
## 
## Hypothesis:
## avgsen = 0
## tottime = 0
## 
## Model 1: restricted model
## Model 2: arr86 ~ pcnv + avgsen + tottime + ptime86 + qemp86 + 1
## 
##   Res.Df    RSS Df Sum of Sq      F Pr(>F)
## 1   2721 520.38                           
## 2   2719 519.97  2   0.40531 1.0597 0.3467

Equation [7.32] (Page 228)

crime_reg_2 <- lm(arr86 ~ pcnv + avgsen + tottime + ptime86 + qemp86 + black + hispan + 1, data=crime1)
stargazer(crime_reg_2, type="text", no.space=TRUE, single.row=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                                arr86           
## -----------------------------------------------
## pcnv                     -0.152*** (0.021)     
## avgsen                     0.005 (0.006)       
## tottime                   -0.003 (0.005)       
## ptime86                  -0.024*** (0.005)     
## qemp86                   -0.038*** (0.005)     
## black                    0.170*** (0.024)      
## hispan                   0.096*** (0.021)      
## Constant                 0.380*** (0.019)      
## -----------------------------------------------
## Observations                   2,725           
## R2                             0.068           
## Adjusted R2                    0.066           
## Residual Std. Error      0.433 (df = 2717)     
## F Statistic          28.405*** (df = 7; 2717)  
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Equation [7.33] (Page 229)

jtrain <- subset(jtrain, jtrain$year==1988)
jobb_reg <- lm(lscrap ~ grant + lsales + lemploy + 1, data=jtrain)
stargazer(jobb_reg, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                               lscrap           
## -----------------------------------------------
## grant                         -0.052           
##                               (0.431)          
## lsales                        -0.455           
##                               (0.373)          
## lemploy                       0.639*           
##                               (0.365)          
## Constant                       4.987           
##                               (4.656)          
## -----------------------------------------------
## Observations                    50             
## R2                             0.072           
## Adjusted R2                    0.011           
## Residual Std. Error       1.385 (df = 46)      
## F Statistic             1.182 (df = 3; 46)     
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Equation [7.35] (Page 231)

fert_reg <- lm(children ~ age + educ + 1, data=fertil2)
stargazer(fert_reg, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                              children          
## -----------------------------------------------
## age                          0.175***          
##                               (0.003)          
## educ                         -0.090***         
##                               (0.006)          
## Constant                     -1.997***         
##                               (0.094)          
## -----------------------------------------------
## Observations                   4,361           
## R2                             0.560           
## Adjusted R2                    0.559           
## Residual Std. Error      1.475 (df = 4358)     
## F Statistic         2,767.702*** (df = 2; 4358)
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01

Equation [7.37] (Page 232)

fert_reg_2 <- lm(children ~ age + educ + electric + 1, data=fertil2)
stargazer(fert_reg_2, type="text", no.space=TRUE, align=TRUE)
## 
## ===============================================
##                         Dependent variable:    
##                     ---------------------------
##                              children          
## -----------------------------------------------
## age                          0.177***          
##                               (0.003)          
## educ                         -0.079***         
##                               (0.006)          
## electric                     -0.362***         
##                               (0.068)          
## Constant                     -2.071***         
##                               (0.095)          
## -----------------------------------------------
## Observations                   4,358           
## R2                             0.562           
## Adjusted R2                    0.562           
## Residual Std. Error      1.471 (df = 4354)     
## F Statistic         1,862.831*** (df = 3; 4354)
## ===============================================
## Note:               *p<0.1; **p<0.05; ***p<0.01