Greene Chapter 3 Exercise

In this exercise only 15 observations are used and two set of variables are used.

## -- Attaching packages --------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.0     v purrr   0.3.3
## v tibble  3.0.0     v dplyr   0.8.5
## v tidyr   1.0.2     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## -- Conflicts ------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
## 
## Attaching package: 'huxtable'
## The following object is masked from 'package:dplyr':
## 
##     add_rownames
## The following object is masked from 'package:purrr':
## 
##     every
## The following object is masked from 'package:ggplot2':
## 
##     theme_grey
Person Education Wage Experience Ability medu fedu Sibilings
1 13 1.82 1 1    12 12 1
2 15 2.14 4 1.5  12 12 1
3 10 1.56 1 -0.36 12 12 1
4 12 1.85 1 0.26 12 10 4
5 15 2.41 2 0.3  12 12 1
6 15 1.83 2 0.44 12 16 2
7 15 1.78 3 0.91 12 12 1
8 13 2.12 4 0.51 12 15 2
9 13 1.95 2 0.86 12 12 2
10 11 2.19 5 0.26 12 12 2
11 12 2.44 1 1.82 16 17 2
12 13 2.41 4 -1.3  13 12 5
13 12 2.07 3 -0.63 12 12 4
14 12 2.2  6 -0.36 10 12 2
15 12 2.12 5 0.28 10 12 3

Analysis

Let X1 equal a constant, education, experience, and ability (the individual’s own characteristics). Let X2 contain the mother’s education, the father’s education, and the number of siblings (the household characteristics). Let y be the log of the hourly wage
a. Compute the least squares regression coefficients in the regression of y on X1. Report the coefficients. b. Compute the least squares regression coefficients in the regression of y on X1 and X2. Report the coefficients.

You can also embed plots, for example:

## 
## Call:
## lm(formula = Wage ~ Education + Experience + Ability, data = ch3)
## 
## Coefficients:
## (Intercept)    Education   Experience      Ability  
##     1.61429      0.01892      0.06602      0.02175
## 
## Call:
## lm(formula = Wage ~ Education + Ability + Experience + medu + 
##     fedu + Sibilings, data = ch3)
## 
## Coefficients:
## (Intercept)    Education      Ability   Experience         medu         fedu  
##   -0.491974     0.034725    -0.009527     0.121874     0.151657    -0.011383  
##   Sibilings  
##    0.029403
## 
## 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
(1) (2)
(Intercept) 1.614 * -0.492  
(0.622)  (0.924) 
Education 0.019   0.035  
(0.049)  (0.040) 
Experience 0.066   0.122 *
(0.045)  (0.044) 
Ability 0.022   -0.010  
(0.098)  (0.109) 
medu        0.152  
       (0.071) 
fedu        -0.011  
       (0.041) 
Sibilings        0.029  
       (0.064) 
N 15       15      
R2 0.183   0.602  
logLik 1.051   6.451  
AIC 7.898   3.098  
*** p < 0.001; ** p < 0.01; * p < 0.05.

Residual Analysis

  1. Regress each of the three variables in X2 on all the variables in X1 and compute the residuals from each regression. Arrange these new variables in the 15 * 3 matrix X2*. What are the sample means of these three variables? Explain the finding.
  2. Using (3-26), compute the R2 for the regression of y on X1 and X2. Repeat the computation for the case in which the constant term is omitted from X1. What happens to R2?
  3. Compute the adjusted R2 for the full regression including the constant term. Interpret your result.
  4. Referring to the result in part c, regress y on X1 and X2*. How do your results compare to the results of the regression of y on X1 and X2? The comparison you are making is between the least squares coefficients when y is regressed on X1 and M1X2 and when y is regressed on X1 and X2. Derive the result theoretically. (Your numerical results should match the theory, of course.)
resid1<-lm(medu~Education+Experience+Ability,data = ch3)$residuals
resid2<-lm(fedu~Education+Experience+Ability,data = ch3)$residuals
resid3<-lm(Sibilings~Education+Experience+Ability,data = ch3)$residuals
resid1
##           1           2           3           4           5           6 
## -1.05221942  0.01216759 -0.71527895 -0.81117002 -0.18653030 -0.24940133 
##           7           8           9          10          11          12 
## -0.09167214  0.27421779 -0.62055219  0.57274592  2.48826710  2.08705037 
##          13          14          15 
##  0.32610250 -0.68876015 -1.34496677
X21<-cbind(resid1,resid2,resid3)
X21<-as.data.frame(X21)

dd <- cbind(ch3,X21)
dd<-as.data.frame(dd)
dd
Person Education Wage Experience Ability medu fedu Sibilings resid1 resid2 resid3
1 13 1.82 1 1    12 12 1 -1.05   -1.27   -0.625 
2 15 2.14 4 1.5  12 12 1 0.0122 -1.66   -0.0244
3 10 1.56 1 -0.36 12 12 1 -0.715  -0.0253 -2.05  
4 12 1.85 1 0.26 12 10 4 -0.811  -2.61   1.64  
5 15 2.41 2 0.3  12 12 1 -0.187  -0.704  -1.15  
6 15 1.83 2 0.44 12 16 2 -0.249  3.18   -0.0228
7 15 1.78 3 0.91 12 12 1 -0.0917 -1.19   -0.579 
8 13 2.12 4 0.51 12 15 2 0.274  2.24   -0.0494
9 13 1.95 2 0.86 12 12 2 -0.621  -1.12   0.255 
10 11 2.19 5 0.26 12 12 2 0.573  -0.455  -0.381 
11 12 2.44 1 1.82 16 17 2 2.49   3.06   1.08  
12 13 2.41 4 -1.3  13 12 5 2.09   0.778  1.28  
13 12 2.07 3 -0.63 12 12 4 0.326  0.207  0.833 
14 12 2.2  6 -0.36 10 12 2 -0.689  0.0732 -0.889 
15 12 2.12 5 0.28 10 12 3 -1.34   -0.502  0.692 
summary(X21) 
##      resid1            resid2            resid3        
##  Min.   :-1.3450   Min.   :-2.6119   Min.   :-2.04748  
##  1st Qu.:-0.7020   1st Qu.:-1.1552   1st Qu.:-0.60221  
##  Median :-0.1865   Median :-0.4551   Median :-0.02439  
##  Mean   : 0.0000   Mean   : 0.0000   Mean   : 0.00000  
##  3rd Qu.: 0.3002   3rd Qu.: 0.4927   3rd Qu.: 0.76255  
##  Max.   : 2.4883   Max.   : 3.1768   Max.   : 1.63573
 ##3f
mod3f<- lm(Wage~resid1+resid2+resid3+Education+Experience+Ability ,data=dd)
huxreg(mod3a,mod3b,mod3f)
(1) (2) (3)
(Intercept) 1.614 * -0.492   1.614 *
(0.622)  (0.924)  (0.509) 
Education 0.019   0.035   0.019  
(0.049)  (0.040)  (0.040) 
Experience 0.066   0.122 * 0.066  
(0.045)  (0.044)  (0.037) 
Ability 0.022   -0.010   0.022  
(0.098)  (0.109)  (0.080) 
medu        0.152         
       (0.071)        
fedu        -0.011         
       (0.041)        
Sibilings        0.029         
       (0.064)        
resid1               0.152  
              (0.071) 
resid2               -0.011  
              (0.041) 
resid3               0.029  
              (0.064) 
N 15       15       15      
R2 0.183   0.602   0.602  
logLik 1.051   6.451   6.451  
AIC 7.898   3.098   3.098  
*** p < 0.001; ** p < 0.01; * p < 0.05.