# Example 7.10, Log Hourly Wage Equation
# Data set: wage1
# Function for result reporting
source("_report.R")
# Load the data, create new variables and estimate the model
load("wage1.Rdata")
data$expersq=(data$exper)^2
data$tenuresq=(data$tenure)^2
data$female.educ=(data$female)*(data$educ)
model=lm(lwage~female+educ+female.educ+exper+expersq+tenure+tenuresq,data=data)
dig=c(3,3,3,4,3,5,3,5,3)
# Estimate the new model
{
cat("This example closely follows Example 7.5. Here we further add an interaction term, female.educ",
"\nThe estimated regression line is",
sep="")
reportreg(model,dig)
}
# Interpretation
cat("The estimated return to education for men (let female = 0) is ",
100*as.numeric(printcoef(model,3,dig[3])), "%, and that for women is ",
printcoef(model,3,dig[3]), " - ", printabscoef(model,4,dig[4]), " = ",
as.numeric(printcoef(model,3,dig[3]))+as.numeric(printcoef(model,4,dig[4])),
", or ", 100*(as.numeric(printcoef(model,3,dig[3]))+as.numeric(printcoef(model,4,dig[4]))),
"%. The difference, ", 100*as.numeric(printcoef(model,4,dig[4])), "%, is neither economically or statistically significant (the t statistic is ",
printt(model,4,dig[4]), "). Therefore, there is no evidence against the hypothesis that the return to education is the same for men and women",
sep="")