# Example 4.3, Determinants of College GPA
# Data set: gpa1
# Functions for result reporting
source("_report.R")
# Load the data and estimate the model in the background
load("gpa1.Rdata")
model=lm(colGPA~hsGPA+ACT+skipped, data=data)
dig=c(2,3,3,3,3)
# Describe the model
cat("This example uses the GPA data set that was used in Example 3.1",
"\nModel to estimate: colGPA = beta0 + beta1 * hsGPA + beta2 * ACT + beta3 * skipped + u",
"\nwhere colGPA is ", paste(desc[desc[,1]=="colGPA",2]),
"\nhsGPA is ", paste(desc[desc[,1]=="hsGPA",2]),
"\nACT is ", paste(desc[desc[,1]=="ACT",2]),
"\nand skipped is ", paste(desc[desc[,1]=="skipped",2]),
sep="")
# Report results
{
cat("The estimated regression line is")
reportreg(model,dig)
}
# Interpretation
cat("With df = ", nrow(model$model)-nrow(summary(model)$coef), ", the two tailed 5% critical value is 1.96, and 1% critical value 2.58",
"\nThe t statistic on hsGPA is as large as ", printt(model,2,dig[2]), ", so hsGPA is statistically significant at any conventional significance level",
"\nThe t statistic on ACT is ", printt(model,3,dig[3]), ", so ACT is not statistically significant at the 10% level against a two-sided alternative",
"\nThe t statistic on skipped is ", printt(model,4,dig[4]), " < -2.58, so skipped is statistically significant at the 1% level. This indicates that an increasse of 1 in skipped lowers predicted colGPA by ",
printabscoef(model,4,dig[4]),
"\nWe can also conduct one-sided t tests. Since hsGPA and skipped are significant using a two-tailed test and have expected signs, there is no reason to do a one-tailed test. On the other hand, against a one-sided alternative (beta3 > 0), ACT is still insignificant at the 5% level, but significant at the 10% level",
sep="")