# Example 4.1, Hourly Wage Equation
# Data set: wage1
# Functions for result reporting
source("_report.R")
# Load the data and estimate the model
load("wage1.Rdata")
model=lm(lwage~educ+exper+tenure, data=data)
dig=c(3,3,4,3,3) # No. of decimal places for each coefficient and R^2
# Report results
{
cat("This example estimates the same model as in Example 3.2, i.e. lwage = beta0 + beta1 * educ + beta2 * exper + beta3 * tenure + u; but this time, we report the standard errors of the estimated coefficients in the parentheses below as well. The estimation result is:")
reportreg(model,dig)
}
# Interpretation
cat("The equation can be used for hyphothesis testing. For example, we can test whether the return to exper, controlling for educ and tenure, is zero in the population, against the alternative that it is positive. This can be written as",
"\n\tH0: beta2 = 0 vs H1: beta2 > 0",
"\nWith ", nrow(model$model)-nrow(summary(model)$coef),
" degrees of freedom, the 1% critical value is about 2.326. And since the t statistic on exper is ",
printcoef(model,3,dig[3]), "/", printse(model,3,dig[3]), " = ", printt(model,3,dig[3]),
" > 2.326, we reject H0 at the 1% significance level, i.e. exper is statistically significant at the 1% level", sep="")