# Example 6.4, CEO Compensation and Firm Performance
# Data set: ceosal1
# Function for result reporting
source("_report.R")
# Load the data and estimate the models in the background
load("ceosal1.Rdata")
model1=lm(salary~sales+roe,data=data)
model2=lm(lsalary~lsales+roe,data=data)
dig1=c(2,4,2,3)
dig2=c(2,3,4,3)
# Describe the models
cat("We estimate two separate models in this example,",
"\n\tsalary = beta0 + beta1 * sales + beta2 * roe + u",
"\nand", "\n\tlsalary = beta0 + beta1 * lsales + beta2 * roe + u",
"\nwhere salary is ", paste(desc[desc[,1]=="salary",2]),
"\nsales is ", paste(desc[desc[,1]=="sales",2]),
"\nroe is ", paste(desc[desc[,1]=="roe",2]),
"\nlsalary is ", paste(desc[desc[,1]=="lsalary",2]),
"\nand lsales is ", paste(desc[desc[,1]=="lsales",2]),
sep="")
# Report results
{
cat("The estimation results for the models are")
reportreg(model1,dig1,adj=T)
cat("\nand")
reportreg(model2,dig2,adj=T)
}
# Interpretation
cat("The R^2s indicate that in the first model, sales and roe explain ", 100*as.numeric(printr(model1,dig1[4])),
"% of the variation in salary, and that in the second model, lsales and roe explain ", 100*as.numeric(printr(model2,dig2[4])),
"% of the variation in lsalary. However, this does not imply that the second model is better in terms of goodness-of-fit. Actually, the total sum of squares for salary is ",
sum(anova(model1)$"Sum Sq"), ", while that for lsalary is only ", round(sum(anova(model2)$"Sum Sq"),2),
". We need other methods than R^2 or adjusted R^2 for goodness-of-fit comparison",
sep="")