# Example 7.6, Log Hourly Wage Equation
# Data set: wage1
# Function for result reporting
source("_report.R")
# Load the data, create new variables and estimate the models
load("wage1.Rdata")
data$expersq=(data$exper)^2
data$tenuresq=(data$tenure)^2
data$marrmale=(data$married)*(1-data$female)
data$marrfem=(data$married)*(data$female)
data$singmale=(1-data$married)*(1-data$female)
data$singfem=(1-data$married)*(data$female)
model1=lm(lwage~marrmale+marrfem+singfem+educ+exper+expersq+tenure+tenuresq,data=data)
model2=lm(lwage~marrmale+singmale+singfem+educ+exper+expersq+tenure+tenuresq,data=data)
dig=c(3,3,3,3,3,3,5,3,5,3)
# Describe the model
cat("This example closely follows Example 7.5. Here we drop the original dummy, female, and add three more dummy independent variables into the model: marrmale, marrfem and singfem. They stand for married men, married women and single women, respectively. Single men is chosen to be the base group",
"\nModel to estimate: lwage = beta0 + beta1 * marrmale + beta2 * marrfem + beta3 * singfem + beta4 * educ + beta5 * exper + beta6 * expersq + beta7 * tenure + beta8 * tenuresq + u",
sep="")
# Report results
{
cat("The estimated regression line is")
reportreg(model1,dig)
}
# Interpretation
{
cat("All the dummy variables are statistically significant at the 5% level. Their coefficients indicate the percentage wage difference between the corresponding group and the base group (single men). For example, married men are predicted to earn ",
100*as.numeric(printcoef(model1,2,dig[2])), "% more than single men, and married women are predicted to earn ",
100*as.numeric(printabscoef(model1,3,dig[3])), "% less than single men",
"\nWe can also use the equation to obtain the estimated difference between any two groups. For example, since the difference between the coefficients on singfem and marrfem is ",
printcoef(model1,4,dig[4]), " - (", printcoef(model1,3,dig[3]), ") = ",
as.numeric(printcoef(model1,4,dig[4]))-as.numeric(printcoef(model1,3,dig[3])),
", single women are predicted to earn ", 100*(as.numeric(printcoef(model1,4,dig[4]))-as.numeric(printcoef(model1,3,dig[3]))),
"% more than married women. However, to determine the statistical significance of the estimated difference, we need to change the base group and reestimate the equation. If the base group is switched to married women, the new estimation result will be",
sep="")
reportreg(model2,dig)
cat("\nAs expected, the coefficient on singfem is ", printcoef(model2,4,dig[4]),
"; it has a t statistic of ", printt(model2,4,dig[4]), ", which is marginal evidence against the null",
sep="")
}