Lab 4B
Directions: Follow along with the slides, completing
the questions in blue on your
computer, and answering the questions in red in your
journal.
Space, Click, Right Arrow or swipe left to move to
the next slide.
arm_span
data
again.xyplot
with
height
on the y-axis and armspan
on the
x-axis.
add_line()
or
get_line()
to graph a line that you think fits the data
well.height
s based on their
armspan
:arm_span
data.arm_span
.mutate
, the first argument of
summarize
is a dataframe, and the second argument is the
action to perform on a column of the dataframe. Whereas the output of
mutate
is a column, the output of summarize
is
(usually) a single number summary.height
of people with
similar armspan
s.lm
, which stands for linear
model:best_fit
into the console to
see the slope and intercept of the regression line.armspan
vs. height
again. Then fill in the
blanks below to add the line of best fit.R
is familiar with is
simpler than with lines, or models, we come up with ourselves.
best_fit
:predict
function takes a linear model as
input, and outputs the predictions of that model.lm()
function creates the line of best fit
equation by finding the line that minimizes the mean squared
error. Meaning, it’s the best fitting line possible.lm()
. Which linear
model performed better?lm()
line in terms of the MSE. Were any of them
successful?