The following R chunk reads in a data set called anscombe
. It has four pairs of x variables and y variables: (x1, y1), (x2, y2), (x3, y3), and (x4, y4). You will examine one of these pairs of variables, and then we will discuss them all as a class.
anscombe <- read_csv("https://mhc-stat140-2017.github.io/data/base_r/anscombe.csv")
SOLUTION:
## use the lm() function to fit a linear model.
## It should look like this: anscombe_fit <- lm( ~, data = anscombe)
## You will need to fill in the proper formula with the
## response and explanatory variables you're using.
SOLUTION:
## Use the coef() function to print out the regression coefficients,
## or use summary(anscombe_fit) to print out more information, including the
## regression coefficients
SOLUTION:
## If you didn't already print out the summary(anscombe_fit) for part 2,
## you'll have to do it now
SOLUTION: