Data for Example 2.13

Gpa

Format

A data frame/tibble with 10 observations on two variables

hsgpa

high school gpa

collgpa

college gpa

References

Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.

Examples


plot(collgpa ~ hsgpa, data = Gpa)
mod <- lm(collgpa ~ hsgpa, data = Gpa)
abline(mod)               # add line

yhat <- predict(mod)      # fitted values
e <- resid(mod)           # residuals
cbind(Gpa, yhat, e)       # Table 2.1
#>    hsgpa collgpa     yhat           e
#> 1    2.7     2.2 2.686530 -0.48653001
#> 2    3.1     2.8 3.225329 -0.42532943
#> 3    2.1     2.4 1.878331  0.52166911
#> 4    3.2     3.8 3.360029  0.43997072
#> 5    2.4     1.9 2.282430 -0.38243045
#> 6    3.4     3.5 3.629429 -0.12942899
#> 7    2.6     3.1 2.551830  0.54816984
#> 8    2.0     1.4 1.743631 -0.34363104
#> 9    3.1     3.4 3.225329  0.17467057
#> 10   2.5     2.5 2.417130  0.08286969
cor(Gpa$hsgpa, Gpa$collgpa)
#> [1] 0.8439231

if (FALSE) {
library(ggplot2)
ggplot2::ggplot(data = Gpa, aes(x = hsgpa, y = collgpa)) + 
           geom_point() + 
           geom_smooth(method = "lm") + 
           theme_bw()
}