plot(y3 ~ x2, data = anscombe, pch = 16)
abline(lm(y3 ~ x3, anscombe), col = "grey20")
Yes, there is a positive relationship between x and y. As x increases, y generally increases. The relationship is mostly linear, although some points are not exactly on the line.
ad_sales <- read.csv("https://raw.githubusercontent.com/utjimmyx/regression/master/advertising.csv")
plot(sales ~ TV, data = ad_sales)
Yes, there is a strong positive relationship between TV advertising and Sales. As TV advertising increases, sales usually increase. The points show a clear upward pattern.
plot(sales ~ radio, data = ad_sales)
Radio advertising also has a positive relationship with Sales. However, the points are more spread out than the TV results, so the relationship is weaker and less consistent.
One function I learned was plot(). The
plot() function creates a graph that helps me compare two
variables. It helps me see whether the relationship is positive,
negative, or has no clear pattern.