library(wooldridge)
data <- wooldridge::minwage
#(i)
autocorr <- cor(data$gwage232[-1], data$gwage232[-nrow(data)], use = "complete.obs")
print(paste("First-order autocorrelation:", autocorr))
## [1] "First-order autocorrelation: -0.0349439340651554"
#This value indicates almost no autocorrelation in gwage232. Therefore, the series does not appear to exhibit weak dependence.
#(ii)
data$gwage232_lag1 <- c(NA, head(data$gwage232, -1))
model1 <- lm(gwage232 ~ gwage232_lag1 + gmwage + gcpi, data = data, na.action = na.exclude)
print("Summary of Model 1:")
## [1] "Summary of Model 1:"
summary(model1)
##
## Call:
## lm(formula = gwage232 ~ gwage232_lag1 + gmwage + gcpi, data = data,
## na.action = na.exclude)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.044642 -0.004134 -0.001312 0.004482 0.041612
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.0024003 0.0004308 5.572 3.79e-08 ***
## gwage232_lag1 -0.0779092 0.0342851 -2.272 0.02341 *
## gmwage 0.1518459 0.0096485 15.738 < 2e-16 ***
## gcpi 0.2630876 0.0824457 3.191 0.00149 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.007889 on 606 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.2986, Adjusted R-squared: 0.2951
## F-statistic: 85.99 on 3 and 606 DF, p-value: < 2.2e-16
#The coefficient of gmwage is positive and highly significant, indicating that federal minimum wage growth has a strong and immediate positive impact on wage growth in this sector.
#(iii)
data$gemp232_lag1 <- c(NA, head(data$gemp232, -1))
model2 <- lm(gwage232 ~ gwage232_lag1 + gmwage + gcpi + gemp232_lag1, data = data, na.action = na.exclude)
print("Summary of Model 2:")
## [1] "Summary of Model 2:"
summary(model2)
##
## Call:
## lm(formula = gwage232 ~ gwage232_lag1 + gmwage + gcpi + gemp232_lag1,
## data = data, na.action = na.exclude)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.043842 -0.004378 -0.001034 0.004321 0.042548
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.002451 0.000426 5.753 1.4e-08 ***
## gwage232_lag1 -0.074546 0.033901 -2.199 0.028262 *
## gmwage 0.152707 0.009540 16.007 < 2e-16 ***
## gcpi 0.252296 0.081544 3.094 0.002066 **
## gemp232_lag1 0.066131 0.016962 3.899 0.000108 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.007798 on 605 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.3158, Adjusted R-squared: 0.3112
## F-statistic: 69.8 on 4 and 605 DF, p-value: < 2.2e-16
# Adding lagged employment growth improves the model (Adjusted R2: 0.311 from 0.295), and it is statistically significant.
#(iv)
gmwage_effect_model1 <- summary(model1)$coefficients["gmwage", ]
gmwage_effect_model2 <- summary(model2)$coefficients["gmwage", ]
print("Effect of gmwage in Model 1:")
## [1] "Effect of gmwage in Model 1:"
print(gmwage_effect_model1)
## Estimate Std. Error t value Pr(>|t|)
## 1.518459e-01 9.648536e-03 1.573771e+01 4.841290e-47
print("Effect of gmwage in Model 2:")
## [1] "Effect of gmwage in Model 2:"
print(gmwage_effect_model2)
## Estimate Std. Error t value Pr(>|t|)
## 1.527070e-01 9.540003e-03 1.600701e+01 2.402983e-48
#The effect of gmwage remains almost unchanged between the two models, suggesting that adding lagged variables (gwage232_{t-1}, gemp232_{t-1}) does not significantly alter the contemporaneous impact of gmwage on gwage232.
#(v)
model3 <- lm(gmwage ~ gwage232_lag1 + gemp232_lag1, data = data, na.action = na.exclude)
print("Summary of Model 3:")
## [1] "Summary of Model 3:"
summary(model3)
##
## Call:
## lm(formula = gmwage ~ gwage232_lag1 + gemp232_lag1, data = data,
## na.action = na.exclude)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.01914 -0.00500 -0.00379 -0.00287 0.62208
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.003433 0.001440 2.384 0.0174 *
## gwage232_lag1 0.203167 0.143140 1.419 0.1563
## gemp232_lag1 -0.041706 0.072110 -0.578 0.5632
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.03318 on 607 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.00392, Adjusted R-squared: 0.0006377
## F-statistic: 1.194 on 2 and 607 DF, p-value: 0.3036
rsq <- summary(model3)$r.squared
print(paste("R-squared of the regression:", rsq))
## [1] "R-squared of the regression: 0.00391968229504527"
#The lagged variables have negligible explanatory power for gmwage, consistent with the observation in part (iv) that adding these lagged variables does not substantially change the effect of gmwage.