Learn R Programming

BSDA (version 1.2.0)

Gpa: High school GPA versus college GPA

Description

Data for Example 2.13

Usage

Gpa

Arguments

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

Run this code
# NOT RUN {
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
cor(Gpa$hsgpa, Gpa$collgpa)

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

# }

Run the code above in your browser using DataLab