Lab 4B
Directions: Follow along with the slides and answer the questions in red font in your journal.
arm_span
data again.
xyplot
with height
on the y-axis and armspan
on the x-axis.add_line()
to run the add_line
function; you’ll be prompted to click twice in the plot window to create a line that you think fits the data well.height
s based on their armspan
:arm_span
data.mean
of the squared differences. This is called the mean squared error (MSE).
height
and armspan
.
best_fit
.R
is familiar with is simpler than with lines, or models, we come up with ourselves.
best_fit
: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.
add_line()
to the the same value you calculated using the lm
function.lm
line in terms of the MSE. Were any of them successful?lm
line fits your data, create a scatterplot and then run: