3.3 Main Regression
\[ wage = \beta_0 + \beta_1 education_i + \beta_2 experience_i + \beta_3 ethnicity_i + \epsilon \]
# Omit negative values
wages <- wages %>%
filter(experience > 0)
# Plot wage on education
ggplot(data = wages,
mapping = aes(x = education, y = wage)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
scale_x_continuous(breaks = seq(min(wages$education), max(wages$education), by = 2))+
labs(x = "Education, years", y = "Wage, $ per week")
## `geom_smooth()` using formula = 'y ~ x'
#plot wage on experience
ggplot(data = wages,
mapping = aes(x = experience, y = wage)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
scale_x_continuous(breaks = seq(min(wages$experience), max(wages$experience), by = 5))+
labs(x = "Experience, years", y = "Wage, $ per week")
## `geom_smooth()` using formula = 'y ~ x'
The scatter plot above for education does show that there may be heteroskedasticity in the model and some potential outliers. Individuals with less than 9 years of education all seem to have much less variation in wages than those who went to high school (9th grade and above). The plot for experience, however, shows no clear evidence of heteroskedasticity or even a relationship between experience and wage.
# Run main regression
main_reg <- lm(wage ~ education + experience + ethnicity, data = wages)
#display results
stargazer(main_reg,
title = "Main Regression", align = TRUE, type = "text", header = FALSE)
##
## Main Regression
## ================================================
## Dependent variable:
## ----------------------------
## wage
## ------------------------------------------------
## education 59.901***
## (0.895)
##
## experience 9.184***
## (0.206)
##
## ethnicity 135.065***
## (9.288)
##
## Constant -457.762***
## (15.511)
##
## ------------------------------------------------
## Observations 26,895
## R2 0.172
## Adjusted R2 0.172
## Residual Std. Error 412.765 (df = 26891)
## F Statistic 1,856.822*** (df = 3; 26891)
## ================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
#Show res plots
par(mfrow = c(2, 2))
plot(main_reg)
The sheer number of observations makes it difficult to assess heteroskedasticity by eyeballing the scale-location plot. Thus, a test is necessary.