I am attempting to understand how to predict expected changes to earnings in R. We are using a dataset from the "Current Population Survey" using the variables average hourly earnings (ahe), age (25 - 34), female (dummy variable) and bachelor (dummy variable). I'm getting stuck on how to interpret my regression results in order to determine the impact on average hourly earnings of a change in age from 25 to 26, versus a change in age from 33 to 34.
The problem and my code are both below. For both 25 to 26 and 33 to 34 my code is generating a Y hat of 0.02419116. But what does that value mean? How do I use it to calculate the change in ahe (which is in $/ hr)? Thank you!
The problem:
Run a regression of the logarithm of average hourly earnings, ln(AHE), on Age, Female, and Bachelor. If Age increases from 25 to 26, how are earnings expected to change? If Age increases from 33 to 34, how are earnings expected to change? (1 point)
My code:
# estimate a log-linear model
LogLinear_model <- lm(log(ahe) ~ age + female + bachelor, data = CPS2015)
LogLinear_model$rse <-sqrt(diag(vcovHC(LogLinear_model, type="HC1")))
# obtain a robust coefficient summary
coeftest(LogLinear_model, vcov = vcovHC, type = "HC1")
# predict
predictdata = data.frame(age = c(25, 26),
female = 1,
bachelor = 1)
Y_hat <- predict(LogLinear_model, predictdata)
# compute the difference: Y_hat
diff(Y_hat)
predictdata = data.frame(age = c(33, 34),
female = 1,
bachelor = 1)
Y_hat <- predict(LogLinear_model, predictdata)
# compute the difference: Y_hat
diff(Y_hat)