2025-03-17

Definition

  • A linear regression is a model used to describe the linear relationship between two or more variables
  • A simple linear regression is a linear regression applied to two variables. More than two variables is considered a multiple linear regression
  • This presentation will use the iris and ggplot2movies datasets for examples

Example of Simple Linear Regression

Linear Equation of Regression Model: \[ f(x) = 0.41x + 4.31 \]

When to Apply Linear Regressions

  • Linear regression models only fully represent the data when it makes sense for them to
  • For example, two variables may appear to follow a certain linear trend; however, this does not necessarily mean that they are

Example of Inappropriate Linear Regression

Example of Inappropriate Linear Regression

  • Not only does it not make sense for the year to have an impact on the rating of the movie, the scatter plot itself shows no linear correlation between the two variables
  • Therefore, using a linear regression model here does not make sense

R-Squared Values

  • Any linear regression model’s fit accuracy can be described by its r-squared value
  • An r-squared value can be anywhere between 0 and 1
  • An r-squared value of 1 indicates a perfect fit

R-Squared Values

\[ R^2 = 0.76 \]