(a) Report coefficients and robust standard error

Step1: Load the data and create subsample

dat <- read.csv("cps09mar.csv") 
mydata <- dat[which((dat$female== 0) & (dat$hisp== 1) & dat$race== 1),]
colnames(mydata) <- c( "age",    "female" ,   "hisp"  ,    "education", "earnings",  "hours"   ,  "week"    ,  "union"    , "uncov"  ,   "region" ,   "race",      "marital"  )
mydata$experience = mydata$age - mydata$education -6

Step2: Conduct regression

require(lmtest)
## Loading required package: lmtest
## Warning: package 'lmtest' was built under R version 3.4.4
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 3.4.4
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
require(sandwich)
## Loading required package: sandwich
## Warning: package 'sandwich' was built under R version 3.4.4
model <- lm(log(earnings/(hours*week)) ~ education + experience + I(experience^2/100), data = mydata)
coeftest(model, vcov = vcovHC(model, type="HC1"))
## 
## t test of coefficients:
## 
##                       Estimate Std. Error t value  Pr(>|t|)    
## (Intercept)          1.1852095  0.0461003 25.7094 < 2.2e-16 ***
## education            0.0904490  0.0029165 31.0133 < 2.2e-16 ***
## experience           0.0353797  0.0025854 13.6844 < 2.2e-16 ***
## I(experience^2/100) -0.0465059  0.0053069 -8.7633 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The results: \[\beta_1 = 0.0904490 \\ \beta_2 = 0.0353797\\ \beta_3 = -0.0465059\\ \beta_4 = 1.1852095\]

robust standard error

\[e(\beta_1) = 0.0029165 \\ e(\beta_2) = 0.0025854\\ e(\beta_3) = 0.0053069\\ e(\beta_4) = 0.0461003\]

(b) write \(\theta\) and compute \(\hat{\theta}\)
  1. \(\theta\)

\[\theta = \frac{\beta_1}{\beta_2 + \beta_3\frac{experience}{50}}\]

  1. \(\hat{\theta}\)

\[\hat{\theta} = \frac{\hat{\beta_1}}{\hat{\beta_2} + \hat{\beta_3}\frac{experience}{50}} = \frac{0.0904490}{0.0353797-0.0465059*20/50} = 5.391141\] Note: take experience = 20 here.

(c) write the formula for asmptotic standard error for \(\theta\) as a function of \(V_\hat{\beta}\) compute \(\hat{\theta}\) and compute \(\hat{s}_\hat{\theta}\)
  1. define \[r(\beta) =\frac{\beta_1}{\beta_2 + \beta_3\frac{experience}{50}}\]

  2. define \[R = \frac{\partial r}{\partial \beta} \\ = (\frac{1}{\beta_2 + \beta_3\frac{experience}{50}}, -\frac{\beta_1}{(\beta_2 + \beta_3\frac{experience}{50})^{2}}, -\frac{experience}{50}*\frac{\beta_1}{(\beta_2 + \beta_3\frac{experience}{50})^{2}})^T\]

  3. thus, \[\hat{V}_\hat{\theta} = \hat{R}^{'}\hat{V}_\hat{\beta} \hat{R}\]

Compute \(\hat{s}_\hat{\theta}\)

R = matrix(c(0, 1/(0.03537968-0.04650594*20/50),
             - 0.09044896/(0.03537968-0.04650594*20/50)^2,
             - (20/50)*(0.09044896/(0.03537968-0.04650594*20/50)^2)), ncol=1, nrow=4)
vb = vcov(model)
#calculate S_\theta
s_theta = sqrt(t(R)%*%vb%*%R)

Thus, \(\hat{s}_\hat{\theta} = 0.2841722\)

(d) construct 90% confidence interval for \(\theta\)

\[C = [\hat{\theta}-1.645*\hat{s}_\hat{\theta}, \space \hat{\theta}+1.645*\hat{s}_\hat{\theta}]\\ =[5.391141-1.645*0.2841722, 5.391141+1.645*0.2841722] = [4.923678, 5.858604]\]

(e) computation at (12, 20) and construct confidence interval

  1. computed value:

\[x^{'}\beta = \beta_1*education + \beta_2*experience + \beta_3*experience^2/100 + \beta_4\\ = 0.0904490*12+0.0353797*20−0.0465059*20^2/100+1.1852095= 2.792168\]

  1. confidence interval
x <- matrix(c(1, 12, 20, 4), ncol = 1, nrow = 4)
vol <- sqrt(t(x) %*% vb %*% x)
print(vol)
##            [,1]
## [1,] 0.01121868

\[[x^{'}\beta-1.96 \sqrt{x{'}\hat{V}_\hat{\beta}x)}, \space x^{'}\beta+1.96 \sqrt{x{'}\hat{V}_\hat{\beta}x)}] \\ = [2.792168 - 1.96*0.01121868, 2.792168+ 1.96*0.01121868]\\ =[2.770179, 2.814157]\]

(f) forecast for (16, 5) and construct forecast confidence interval

  1. computed value:

\[x^{'}\beta = \beta_1*education + \beta_2*experience + \beta_3*experience^2/100 + \beta_4\\ = 0.0904490*16+0.0353797*5−0.0465059*5^2/100+1.1852095= 2.797666\]

  1. confidence interval
xx <- matrix(c(1, 16, 5, 4), ncol = 1, nrow = 4)
vol1 <- (t(xx) %*% vb %*% xx)
print(vol1)
##             [,1]
## [1,] 0.001182139
  1. calculate the standard divation

\[\hat{s}_{(x)}=\sqrt{\hat{\sigma}_{x}+x{'}\hat{V}_\hat{\beta}x}\\ =\sqrt{0.2841722^2+0.001182139}=0.2862446\]