# Example 7.3, Effects of Training Grants on Hours of Trianing
# Data set: jtrain
# Function for result reporting
source("_report.R")
# Load the data and estimate the model in the background
load("jtrain.Rdata")
data=data[data$year==1988,] # Refine the data to year 1988
model=lm(hrsemp~grant+lsales+lemploy,data=data)
dig=c(2,2,2,2,3)
# Describe the model
cat("Model to estimate: hrsemp = beta0 + beta1 * grant + beta2 * lsales + beta3 * lemploy + u",
"\nwhere hrsemp is ", paste(desc[desc[,1]=="hrsemp",2]),
"\ngrant ", paste(desc[desc[,1]=="grant",2]),
"\nlsales is ", paste(desc[desc[,1]=="lsales",2]), " (sales: ", paste(desc[desc[,1]=="sales",2]), ")",
"\nand lemploy is ", paste(desc[desc[,1]=="lemploy",2]), " (employ: ", paste(desc[desc[,1]=="employ",2]), ")",
sep="")
# Report results
{
cat("The estimated regression line is")
reportreg(model,dig)
}
# Interpretation
cat("The coefficient on the dummy variable, grant, implies that for the same levels of sales and employ, firms that received a grant trained each worker, on average, ",
printcoef(model,2,dig[2]), " hours more. This is a large effect, considering the sample mean of hrsemp is only about ",
round(mean(model$model$hrsemp)), ", and maximum ", round(max(model$model$hrsemp)),
". The coefficient on grant has a t statistic of ", printt(model,2,dig[2]),
", and is very statistically significant",
sep="")