# Example 7.2, Effects of Computer Ownership on College GPA
# Data set: gpa1
# Function for result reporting
source("_report.R")
# Load the data and estimate the model in the background
load("gpa1.Rdata")
model=lm(colGPA~PC+hsGPA+ACT,data=data)
dig=c(2,3,3,4,3)
# Describe the model
cat("This example uses the wage data set that was used in Example 3.4. In the previous example, we estimated the model: colGPA = beta0 + beta1 * hsGPA + beta2 * ACT + u",
"\nwhere colGPA is ", paste(desc[desc[,1]=="colGPA",2]),
"\nhsGPA is ", paste(desc[desc[,1]=="hsGPA",2]),
"\nand ACT is ", paste(desc[desc[,1]=="ACT",2]),
"\nIn this example, we use add a dummy independent variable, PC, which equals 1 if a student owns a personal computer and 0 otherwise. That makes the model to estimate",
"\n\tcolGPA = beta0 + beta1 * PC + beta2 * hsGPA + beta3 * ACT + u",
sep="")
# Report results
{
cat("The estimated regression line is")
reportreg(model,dig)
}
# Interpretation
cat("The regression result implies that a student who owns a PC has a predicted colGPA ",
printcoef(model,2,dig[2]), " points higher than a comparable student (one with the same levels of hsGPA and ACT) without a PC. The t statistic on PC is ",
printt(model,2,dig[2]), ", making PC very statistically significant",
sep="")