# Example 2.8, CEO Salary and Return on Equity
# Data set: ceosal1
load("ceosal1.Rdata")
# Recap the estimated model
model=lm(salary~roe, data=data)
cat("The example uses the data set of CEO salaries that was used in Example 2.3.\nIn the previous example, we estimated the model salary = beta0 + beta1 * roe + u, where salary is ",
paste(desc[desc[,1]=="salary",2]), ", and roe is ", paste(desc[desc[,1]=="roe",2]),
"\nThe estimated regression line was\nsalaryhat = ", round(model$coefficients[1],digits=3), " + ",
round(model$coefficients[2],digits=3), " * roe\n",
"n = ", nrow(data), ", R^2 = ", round(summary(model)$r.squared,digits=4), sep="")
# Interpretation of R^2
cat("The value of R^2 indicates that ", 100*round(summary(model)$r.squared,digits=4),
"% of the variation in salary is explained by roe, and the rest ",
100*(1-round(summary(model)$r.squared,digits=4)), "% is left unexplained by the model",
sep="")