Session Ready
Exercise

Linear regression

You can use the lm() function to perform simple linear regression. In this exercise, you will fit a model for age as a function of, or predicted by shuckedWeight. You will save the model results as an object and then display elements from this output object such as the coefficients.

You will also run a summary() of the model object and save that output in another object, which will contain elements related to the model fit such as r.squared and adj.r.squared. The abaloneKeep dataset has been loaded for you.

Instructions
100 XP
  • Use lm() to perform a simple linear regression of age by shucked weight. Save the output as lmshucked.
  • Display the coefficients element from lmshucked to get the intercept and slope model coefficients.
  • Run a summary() for lmshucked and save the output as smrylmshucked.
  • From the summary output object smrylmshucked, display the r.squared and adj.r.squared elements.