##Question 1##

If you want to find out if males sleep more often than women (on average), then just look at the coefficients of the dummy variable tbh. For male, the coefficient is 87.75. Basically, that means males are sleeping ~1.5 hours more than females on average.

To assess the strength of this, we can look toward the t-stat.

\(t = \frac{E(m) - \mu_m}{Se(m)} = \frac{87.75 - 0}{34.33}\)

= 2.56

The p-value here is 0.011.

This is statistically significant at the 1% level since it is close to the significance level we need to reject \(H_0\). The critical value we need is 2.58 btw.

\(t = \frac{E(m) - \mu_m}{Se(m)} = \frac{-0.163- 0}{0.018}\)

= -9.06

0.163 * 60 = 9.8

There is a statistically significant trade-off here. One more hour of work leads to a reduction of sleep by 9.8 minutes (ceteris paribus).

We need a restricted regression model to conduct a F-test. The restricted model drops \(age\) and \(age^2\). When both of these age variables are included in the model (the unrestricted one), \(age\) has no effect if both of the parameters are 0.

##Question 2##

library(wooldridge)
data("bwght") 

q2_model <- lm(log(bwght) ~ cigs + log(faminc) + parity + male + white, data = bwght) 
summary(q2_model) 
## 
## Call:
## lm(formula = log(bwght) ~ cigs + log(faminc) + parity + male + 
##     white, data = bwght)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.59363 -0.09063  0.01947  0.12142  0.83885 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.6577114  0.0221653 210.135  < 2e-16 ***
## cigs        -0.0043502  0.0008518  -5.107 3.73e-07 ***
## log(faminc)  0.0092774  0.0059308   1.564  0.11798    
## parity       0.0159828  0.0056388   2.834  0.00466 ** 
## male         0.0265458  0.0100295   2.647  0.00822 ** 
## white        0.0547875  0.0130518   4.198 2.87e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1864 on 1382 degrees of freedom
## Multiple R-squared:  0.04719,    Adjusted R-squared:  0.04374 
## F-statistic: 13.69 on 5 and 1382 DF,  p-value: 4.578e-13

\(\Delta \text{cigs} = 10 \text{ then } \Delta \log(\text{bwght})\) = -0.0044(10) = 0.044.

There is a 4.4% lower birth weight.

The coefficient for \(white\) is 0.055, meaning there is a 5.5% chance that a white child will weigh more than a non-white child on average.

\(t_{\text{white}} \approx\) 0.0055/0.013 \(\approx\) 4.23. This is significant at the 1% level.

With one more year of education wrt to the baby’s mother, the baby’s weight is estimated to only be .3% higher (ceteris paribus. This is smaller than 1% and 5% and is hence statistically insignificant.

Unable to compute the F-stat because there are missing observations in \(fatheduc\). To compute the F-stat, we should use the same samples in both the restricted and unrestricted models. We need to re-estimate the restricted model using the same number of observations in the unrestricted model. Doing this will give us \(R^2\) which is integral to the F-test.

##Question 3##

\(t_{\text{hsize^2}} \approx\) 19.3/(2*(-2.19) \(\approx\) -4.41 \(\ approx\) |4.41|

Since \(hsize\) is measured in hundreds, we can just multiply 4.41 by 100 to obtain the optimal size. The answer is 441.

\(\hat{sat} = 1,028.10 + 19.30 \, \text{hsize} - 2.19 \, \text{hsize}^2 - 45.09 \, \text{female} - 169.81 \, \text{black} + 62.31 \, \text{female:black}\)

Sice the coefficient in $ $ is -45.09, a nonblack female has a lower SAT score than a nonblack male by -45.09 points(??) on average.

t-stat:

t = -45.09/4.29 = -10.51.

p_value <- 2 * (1 - pt(abs(10.51), 4131))
p_value
## [1] 0

The p-value here is 0. Therefore there is statistical signifiance at the 1% and 5% confidence levels.

For non-black and black males, we can sub in 0 for \(female\) to eliminate any females from the equation (ceteris paribus). This leaves us with only the coefficient for \(black\), which is -169.81.

This implies that a black male has a SAT score of 169.81 points less than a black male.

t = - 169.81 / 12.71 = 13.36

p_value <- 2 * (1 - pt(abs(13.36), 4131))
p_value
## [1] 0

Since the p-value is 0, we can reject \(H_0\).

Just sub (a) in 1 for \(black\) and \(female\) for black females and (b) \(black\) = 0, \(female\) = 1 for non-black females, ceteris paribus.

In (a), you’re left with:

-169.81

In (b) you’re left with 62.31

The difference is an SAT score of -107.50 on average.

I don’t think we can test for statistical significance wrt the difference unless we are given more information because we’re missing a t-stat here.

##C2##

data("wage2") 

model1 <- lm(lwage ~ educ + exper + tenure + married + black + south + urban, data=wage2)
summary(model1) 
## 
## Call:
## lm(formula = lwage ~ educ + exper + tenure + married + black + 
##     south + urban, data = wage2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.98069 -0.21996  0.00707  0.24288  1.22822 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.395497   0.113225  47.653  < 2e-16 ***
## educ         0.065431   0.006250  10.468  < 2e-16 ***
## exper        0.014043   0.003185   4.409 1.16e-05 ***
## tenure       0.011747   0.002453   4.789 1.95e-06 ***
## married      0.199417   0.039050   5.107 3.98e-07 ***
## black       -0.188350   0.037667  -5.000 6.84e-07 ***
## south       -0.090904   0.026249  -3.463 0.000558 ***
## urban        0.183912   0.026958   6.822 1.62e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3655 on 927 degrees of freedom
## Multiple R-squared:  0.2526, Adjusted R-squared:  0.2469 
## F-statistic: 44.75 on 7 and 927 DF,  p-value: < 2.2e-16
model1$coefficients['black'] 
##      black 
## -0.1883499

Therefore there is an 18.33499% difference in the salaries between blacks and nonblacks on average.

The p-value for \(black\) is 6.84e-07, which is much smaller than 0.01 and 0.05. This implies statistical significance. The t-value is |5|

Therefore \(H_0\) can be rejected.

model2 <- lm(log(wage) ~ educ + exper + tenure + married + black+ south + urban + I(exper^2) + I(tenure^2), data = wage2)
summary(model2) 
## 
## Call:
## lm(formula = log(wage) ~ educ + exper + tenure + married + black + 
##     south + urban + I(exper^2) + I(tenure^2), data = wage2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.98236 -0.21972 -0.00036  0.24078  1.25127 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.3586756  0.1259143  42.558  < 2e-16 ***
## educ         0.0642761  0.0063115  10.184  < 2e-16 ***
## exper        0.0172146  0.0126138   1.365 0.172665    
## tenure       0.0249291  0.0081297   3.066 0.002229 ** 
## married      0.1985470  0.0391103   5.077 4.65e-07 ***
## black       -0.1906636  0.0377011  -5.057 5.13e-07 ***
## south       -0.0912153  0.0262356  -3.477 0.000531 ***
## urban        0.1854241  0.0269585   6.878 1.12e-11 ***
## I(exper^2)  -0.0001138  0.0005319  -0.214 0.830622    
## I(tenure^2) -0.0007964  0.0004710  -1.691 0.091188 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3653 on 925 degrees of freedom
## Multiple R-squared:  0.255,  Adjusted R-squared:  0.2477 
## F-statistic: 35.17 on 9 and 925 DF,  p-value: < 2.2e-16
full_model2 <- lm(log(wage) ~ educ + exper + tenure + married + black + south + urban + I(exper^2) + I(tenure^2), data = wage2)
summary(full_model2)
## 
## Call:
## lm(formula = log(wage) ~ educ + exper + tenure + married + black + 
##     south + urban + I(exper^2) + I(tenure^2), data = wage2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.98236 -0.21972 -0.00036  0.24078  1.25127 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.3586756  0.1259143  42.558  < 2e-16 ***
## educ         0.0642761  0.0063115  10.184  < 2e-16 ***
## exper        0.0172146  0.0126138   1.365 0.172665    
## tenure       0.0249291  0.0081297   3.066 0.002229 ** 
## married      0.1985470  0.0391103   5.077 4.65e-07 ***
## black       -0.1906636  0.0377011  -5.057 5.13e-07 ***
## south       -0.0912153  0.0262356  -3.477 0.000531 ***
## urban        0.1854241  0.0269585   6.878 1.12e-11 ***
## I(exper^2)  -0.0001138  0.0005319  -0.214 0.830622    
## I(tenure^2) -0.0007964  0.0004710  -1.691 0.091188 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3653 on 925 degrees of freedom
## Multiple R-squared:  0.255,  Adjusted R-squared:  0.2477 
## F-statistic: 35.17 on 9 and 925 DF,  p-value: < 2.2e-16
reduced_model2 <- lm(log(wage) ~ educ + exper + tenure + married + black + south + urban, data = wage2)
summary(reduced_model2)
## 
## Call:
## lm(formula = log(wage) ~ educ + exper + tenure + married + black + 
##     south + urban, data = wage2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.98069 -0.21996  0.00707  0.24288  1.22822 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.395497   0.113225  47.653  < 2e-16 ***
## educ         0.065431   0.006250  10.468  < 2e-16 ***
## exper        0.014043   0.003185   4.409 1.16e-05 ***
## tenure       0.011747   0.002453   4.789 1.95e-06 ***
## married      0.199417   0.039050   5.107 3.98e-07 ***
## black       -0.188350   0.037667  -5.000 6.84e-07 ***
## south       -0.090904   0.026249  -3.463 0.000558 ***
## urban        0.183912   0.026958   6.822 1.62e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3655 on 927 degrees of freedom
## Multiple R-squared:  0.2526, Adjusted R-squared:  0.2469 
## F-statistic: 44.75 on 7 and 927 DF,  p-value: < 2.2e-16
anova_model2 <- anova(reduced_model2, full_model2)
anova_model2
## Analysis of Variance Table
## 
## Model 1: log(wage) ~ educ + exper + tenure + married + black + south + 
##     urban
## Model 2: log(wage) ~ educ + exper + tenure + married + black + south + 
##     urban + I(exper^2) + I(tenure^2)
##   Res.Df    RSS Df Sum of Sq      F Pr(>F)
## 1    927 123.82                           
## 2    925 123.42  2   0.39756 1.4898  0.226

Since the p-value is 0.226 and therefore greater than 0.2, we have uncovered joint significance at the 20% confidence level and cannot reject \(H_0\)

model3 <- lm(log(wage) ~ educ + exper + tenure + married + black+ south + urban + black*educ, data = wage2)
summary(model3) 
## 
## Call:
## lm(formula = log(wage) ~ educ + exper + tenure + married + black + 
##     south + urban + black * educ, data = wage2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.97782 -0.21832  0.00475  0.24136  1.23226 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.374817   0.114703  46.859  < 2e-16 ***
## educ         0.067115   0.006428  10.442  < 2e-16 ***
## exper        0.013826   0.003191   4.333 1.63e-05 ***
## tenure       0.011787   0.002453   4.805 1.80e-06 ***
## married      0.198908   0.039047   5.094 4.25e-07 ***
## black        0.094809   0.255399   0.371 0.710561    
## south       -0.089450   0.026277  -3.404 0.000692 ***
## urban        0.183852   0.026955   6.821 1.63e-11 ***
## educ:black  -0.022624   0.020183  -1.121 0.262603    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3654 on 926 degrees of freedom
## Multiple R-squared:  0.2536, Adjusted R-squared:  0.2471 
## F-statistic: 39.32 on 8 and 926 DF,  p-value: < 2.2e-16

The coefficient black:educ represents the difference in return to education for black and nonblack individuals. It states that the rate of return is 2.2624% lower for black individuals than non-blacks.

The p-value is 0.262603. Since the p-value is greater than 0.05, this suggests that the difference in the return to education is not statistically significance at the 5% level and we cannot reject \(H_0\). Therefore the return to education != depend on race.

model4 <- lm(log(wage) ~ educ + exper + tenure + married + black + south + urban + married*black, data = wage2)
summary(model4)
## 
## Call:
## lm(formula = log(wage) ~ educ + exper + tenure + married + black + 
##     south + urban + married * black, data = wage2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.98013 -0.21780  0.01057  0.24219  1.22889 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    5.403793   0.114122  47.351  < 2e-16 ***
## educ           0.065475   0.006253  10.471  < 2e-16 ***
## exper          0.014146   0.003191   4.433 1.04e-05 ***
## tenure         0.011663   0.002458   4.745 2.41e-06 ***
## married        0.188915   0.042878   4.406 1.18e-05 ***
## black         -0.240820   0.096023  -2.508 0.012314 *  
## south         -0.091989   0.026321  -3.495 0.000497 ***
## urban          0.184350   0.026978   6.833 1.50e-11 ***
## married:black  0.061354   0.103275   0.594 0.552602    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3656 on 926 degrees of freedom
## Multiple R-squared:  0.2528, Adjusted R-squared:  0.2464 
## F-statistic: 39.17 on 8 and 926 DF,  p-value: < 2.2e-16
wage2$married_black <- ifelse(wage2$married == 1 & wage2$black == 1, 1, 0)
wage2$married_nonblack <- ifelse(wage2$married == 1 & wage2$black == 0, 1, 0)
wage2$single_black <- ifelse(wage2$married == 0 & wage2$black == 1, 1, 0)
wage2$single_nonblack <- ifelse(wage2$married == 0 & wage2$black == 0, 1, 0)


model5 <- lm(log(wage) ~ educ + exper + tenure + south + urban + married_black + married_nonblack + single_black, data = wage2)
summary(model5) 
## 
## Call:
## lm(formula = log(wage) ~ educ + exper + tenure + south + urban + 
##     married_black + married_nonblack + single_black, data = wage2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.98013 -0.21780  0.01057  0.24219  1.22889 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       5.403793   0.114122  47.351  < 2e-16 ***
## educ              0.065475   0.006253  10.471  < 2e-16 ***
## exper             0.014146   0.003191   4.433 1.04e-05 ***
## tenure            0.011663   0.002458   4.745 2.41e-06 ***
## south            -0.091989   0.026321  -3.495 0.000497 ***
## urban             0.184350   0.026978   6.833 1.50e-11 ***
## married_black     0.009448   0.056013   0.169 0.866083    
## married_nonblack  0.188915   0.042878   4.406 1.18e-05 ***
## single_black     -0.240820   0.096023  -2.508 0.012314 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3656 on 926 degrees of freedom
## Multiple R-squared:  0.2528, Adjusted R-squared:  0.2464 
## F-statistic: 39.17 on 8 and 926 DF,  p-value: < 2.2e-16

Married non-black coefficient: 0.188915 Married black coefficient: 0.009448

The difference between them is:

0.188915 - 0.009448 = 0.179467

Therefore, married black people earn more than non-married (single) black people by an average of 17.9467%.

##C3##

\(H_0: \beta_{\text{catcher}} = 0\)

data("mlb1") 

model6 <- lm(log(salary) ~ years + gamesyr + bavg + hrunsyr + rbisyr + runsyr + fldperc + allstar + frstbase + scndbase + thrdbase + shrtstop + catcher, data = mlb1)
summary(model6)
## 
## Call:
## lm(formula = log(salary) ~ years + gamesyr + bavg + hrunsyr + 
##     rbisyr + runsyr + fldperc + allstar + frstbase + scndbase + 
##     thrdbase + shrtstop + catcher, data = mlb1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.42088 -0.42665 -0.03092  0.47925  2.74975 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 11.1295537  2.3044544   4.830 2.07e-06 ***
## years        0.0584178  0.0122732   4.760 2.87e-06 ***
## gamesyr      0.0097670  0.0033776   2.892  0.00408 ** 
## bavg         0.0004814  0.0011411   0.422  0.67340    
## hrunsyr      0.0191459  0.0159638   1.199  0.23124    
## rbisyr       0.0017875  0.0074755   0.239  0.81116    
## runsyr       0.0118707  0.0045264   2.623  0.00912 ** 
## fldperc      0.0002833  0.0023078   0.123  0.90239    
## allstar      0.0063351  0.0028828   2.198  0.02866 *  
## frstbase    -0.1328009  0.1309243  -1.014  0.31115    
## scndbase    -0.1611010  0.1414296  -1.139  0.25547    
## thrdbase     0.0145271  0.1430352   0.102  0.91916    
## shrtstop    -0.0605672  0.1302031  -0.465  0.64210    
## catcher      0.2535592  0.1313128   1.931  0.05432 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7092 on 339 degrees of freedom
## Multiple R-squared:  0.6535, Adjusted R-squared:  0.6403 
## F-statistic: 49.19 on 13 and 339 DF,  p-value: < 2.2e-16

Since the p-value for \(catcher\) is 0.05432, which is higher than 0.05, we cannot reject \(H_0\) at the 5% level.

\(H_0:\beta_{\text{firstbase}} = \beta_{\text{scndbase}} = \beta_{\text{thrdbase}} = \beta_{\text{shrtstop}} = \beta_{\text{catcher}} = 0\)

\(H_A: \text{At least one } \beta_{\text{position}} \neq 0\)

library(car)
## Loading required package: carData
h0 <- c("frstbase", "scndbase", "thrdbase", "shrtstop", "catcher")
linearHypothesis(model6, h0) 
## Linear hypothesis test
## 
## Hypothesis:
## frstbase = 0
## scndbase = 0
## thrdbase = 0
## shrtstop = 0
## catcher = 0
## 
## Model 1: restricted model
## Model 2: log(salary) ~ years + gamesyr + bavg + hrunsyr + rbisyr + runsyr + 
##     fldperc + allstar + frstbase + scndbase + thrdbase + shrtstop + 
##     catcher
## 
##   Res.Df    RSS Df Sum of Sq      F Pr(>F)
## 1    344 174.99                           
## 2    339 170.52  5    4.4703 1.7774 0.1168

Since the p-value here is 0.1168, we cannot reject \(H_0\) at the 5% level.

The results are consistent since we rejected \(H_0\) in both parts.