# Example 2.9, Voting Outcomes and Campaign Expenditures # Data set: vote1 load("vote1.Rdata") # Recap the estimated model model=lm(voteA~shareA, data=data) cat("The example uses the data set of voting outcomes and expenditures that was used in Example 2.5.\nIn the previous example, we estimated the model voteA = beta0 + beta1 * shareA + u, where voteA is ", paste(desc[desc[,1]=="voteA",2]), ", and shareA is ", paste(desc[desc[,1]=="shareA",2]), "\nThe estimated regression line was\nvoteAhat = ", round(model$coefficients[1],digits=2), " + ", round(model$coefficients[2],digits=3), " * shareA\n", "n = ", nrow(data), ", R^2 = ", round(summary(model)$r.squared,digits=3), sep="") # Interpretation of R^2 cat("The value of R^2 indicates that ", 100*round(summary(model)$r.squared,digits=3), "% of the variation in salary is explained by roe, which is a sizable portion", sep="")