Gpa | R Documentation |
Data for Example 2.13
Gpa
A data frame/tibble with 10 observations on two variables
high school gpa
college gpa
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
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()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.