# Example 7.1, Hourly Wage Equation
# Data set: wage1
# Function for result reporting
source("_report.R")
# Load the data and estimate the models in the background
load("wage1.Rdata")
model1=lm(wage~female+educ+exper+tenure,data=data)
model2=lm(wage~female,data=data)
dig1=c(2,2,3,3,3,3)
dig2=c(2,2,3)
# Describe the model
cat("This example uses the wage data set that was used in Example 3.2. In the previous example, we estimated the model: lwage = beta0 + beta1 * educ + beta2 * exper + beta3 * tenure + u",
"\nwhere lwage is ", paste(desc[desc[,1]=="lwage",2]), " (wage: ", paste(desc[desc[,1]=="wage",2]), ")",
"\neduc is ", paste(desc[desc[,1]=="educ",2]),
"\nexper is ", paste(desc[desc[,1]=="exper",2]),
"\nand tenure is ", paste(desc[desc[,1]=="tenure",2]),
"\nIn this example, we use wage instead of lwage as the dependent variable, as well as add a dummy independent variable, female, which equals 1 if an individual is female and 0 if male. That makes the model to estimate",
"\n\twage = beta0 + beta1 * female + beta2 * educ + beta3 * exper + beta4 * tenure + u",
sep="")
# Report results
{
cat("The estimated regression line is")
reportreg(model1,dig1)
}
# Interpretation
cat("The coefficient on female, ", printcoef(model1,2,dig1[2]), ", indicates that for a man and a woman with the same levels of educ, exper and tenure, the latter earns $",
printabscoef(model1,2,dig1[2]), " less on average. This wage differential cannot be explained by the difference of the controlled factors (educ, exper and tenure) between men and women",
sep="")
# Estimate the simple regression model
{
cat("We further estimate a simple model where female is the only independent variable. The result turns out to be")
reportreg(model2,dig2)
}
# Interpretation of the 2nd model
cat("The intercept of the regression is the average wage for men in the sample (when female = 0), $",
printcoef(model2,1,dig2[1]), "; the slope coefficient is the difference in the average wage between women and men, i.e. women on average earn $",
printabscoef(model2,2,dig2[2]), " less than men, or $",
as.numeric(printcoef(model2,1,dig2[1]))+as.numeric(printcoef(model2,2,dig2[2])),
". This coefficient has a t statistic of ", printt(model2,2,dig2[2]), ", and thus is very statistically significant",
"\nThe wage differential implied by the second model is larger than that in the first, because the simple regression does not control for differences in educ, exper and tenure, which are generally lower for women in this sample; the first model gives a more reliable estimate of the ceteris paribus gender wage gap",
sep="")