Introduction to Linear Regression

Let's get a brief overview of linear regression.

R packages

We’ll use the following R packages in this chapter:

  • ggplot2
  • MASS
  • SemiPar
  • arm

Introduction to linear regression

So far, we’ve discussed linear models for analyses with categorical explanatory variables (factors), often known as an analysis of variance (ANOVA). But what if our explanatory variable is continuous and not categorical? For that, you need a closely related linear model known as regression. The good news is that ANOVA and regression are similar. We can use R for both types of analyses with the same lm() linear model function. This means we don’t need to learn any new R functions, we only need to know how to interpret the output in this new context.

Get hands-on with 1400+ tech skills courses.