wooldridge
Package and Datainstall.packages("wooldridge")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library(wooldridge)
data("wage2")
educ
to obtain δ1 (Part
(i))model_a <- lm(IQ ~ educ, data = wage2)
summary(model_a)
##
## Call:
## lm(formula = IQ ~ educ, data = wage2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -50.228 -7.262 0.907 8.772 37.373
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 53.6872 2.6229 20.47 <2e-16 ***
## educ 3.5338 0.1922 18.39 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 12.9 on 933 degrees of freedom
## Multiple R-squared: 0.2659, Adjusted R-squared: 0.2652
## F-statistic: 338 on 1 and 933 DF, p-value: < 2.2e-16
delta_1 <- coef(model_a)[2]
This is a simple linear regression with
IQ
as the dependent variable and educ
(years
of education) as the independent variable.
log(wage)
on educ
to obtain β1 (Part (ii))Run a simple regression of log(wage)
on
educ
, and denote the slope coefficient as β1~.
model_b <- lm(log(wage) ~ educ, data = wage2)
summary(model_b)
##
## Call:
## lm(formula = log(wage) ~ educ, data = wage2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.94620 -0.24832 0.03507 0.27440 1.28106
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.973062 0.081374 73.40 <2e-16 ***
## educ 0.059839 0.005963 10.04 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4003 on 933 degrees of freedom
## Multiple R-squared: 0.09742, Adjusted R-squared: 0.09645
## F-statistic: 100.7 on 1 and 933 DF, p-value: < 2.2e-16
beta_1_tilde <- coef(model_b)[2]
log(wage)
on
educ
and IQ
to obtain β1 β2 (Part (iii))Run a multiple regression of log(wage)
on both
educ
and IQ
, and obtain the slope coefficients
β1 and β2, respectively.
model_c <- lm(log(wage) ~ educ + IQ, data = wage2)
summary(model_c)
##
## Call:
## lm(formula = log(wage) ~ educ + IQ, data = wage2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.01601 -0.24367 0.03359 0.27960 1.23783
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.6582876 0.0962408 58.793 < 2e-16 ***
## educ 0.0391199 0.0068382 5.721 1.43e-08 ***
## IQ 0.0058631 0.0009979 5.875 5.87e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3933 on 932 degrees of freedom
## Multiple R-squared: 0.1297, Adjusted R-squared: 0.1278
## F-statistic: 69.42 on 2 and 932 DF, p-value: < 2.2e-16
beta_1 <- coef(model_c)[2]
beta_2 <- coef(model_c)[3]
beta_1_tilde
## educ
## 0.05983921
verification <- beta_1 + beta_2 * delta_1
cat("β~_1 =", beta_1_tilde, "\n")
## β~_1 = 0.05983921
cat("β_1 + β_2 * δ_1 =", verification, "\n")
## β_1 + β_2 * δ_1 = 0.05983921