library(ggplot2) mean(anscombe$x1) mean(anscombe$x2) mean(anscombe$x3) mean(anscombe$x4) mean(anscombe$y1) mean(anscombe$y2) mean(anscombe$y3) mean(anscombe$y4) var(anscombe$x1) var(anscombe$x2) var(anscombe$x3) var(anscombe$x4) var(anscombe$y1) var(anscombe$y2) var(anscombe$y3) var(anscombe$y4) cor(anscombe$x1,anscombe$y1)^2 cor(anscombe$x2,anscombe$y2)^2 cor(anscombe$x3,anscombe$y3)^2 cor(anscombe$x4,anscombe$y4)^2 linearMod1 <- lm(y1 ~ x1, data=anscombe) linearMod2 <- lm(y2 ~ x2, data=anscombe) linearMod3 <- lm(y3 ~ x3, data=anscombe) linearMod4 <- lm(y4 ~ x4, data=anscombe) summary(linearMod1) summary(linearMod2) summary(linearMod3) summary(linearMod4) ggplot(data = anscombe, aes(x = x1, y = y1)) + geom_point(color='blue') + geom_smooth(method = "lm", se = FALSE) ggplot(data = anscombe, aes(x = x2, y = y2)) + geom_point(color='blue') + geom_smooth(method = "lm", se = FALSE) ggplot(data = anscombe, aes(x = x3, y = y3)) + geom_point(color='blue') + geom_smooth(method = "lm", se = FALSE) ggplot(data = anscombe, aes(x = x4, y = y4)) + geom_point(color='blue') + geom_smooth(method = "lm", se = FALSE)