2 Linear regression

Reviewing linear regression and framing it as a prototypical example and source of intuition for other machine learning methods.

Joshua Loftus


Link Type Description
html pdf Slides Least-squares regression
Rmd Notebook Regression analysis and simulations


Required reading

This chapter is long but should be mostly a review of material from previous courses.

Supplemental reading

Computer setup

Identify a dataset that you can use to fit a multiple regression model (one outcome variable, multiple predictor variables). This way you can work on an example dataset that you’re personally interested in. If you can’t find something or have trouble loading it into R in time there are backup options in these packages:

Just be sure to identify in advance which variable you’ll use as an outcome to predict, and which variables you might use as predictors

Machine learning before the information age

(under construction)

Multiple regression

Regression, when conditioning on more than one predictor variable.


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Loftus (2021, Oct. 10). machine learning 4 data science: 2 Linear regression. Retrieved from http://ml4ds.com/weeks/02-linear-regression/

BibTeX citation

  author = {Loftus, Joshua},
  title = {machine learning 4 data science: 2 Linear regression},
  url = {http://ml4ds.com/weeks/02-linear-regression/},
  year = {2021}