Simple Linear Regression

  • A foundational technique in statistics
  • Models the relationship between one independent variable X and a dependent variable Y
  • Example: Predict miles per gallon (mpg) from horsepower (hp) using mtcars dataset

The Mathematical Model

We assume a linear relationship between \(Y\) and \(X\):

\[ Y = \beta_0 + \beta_1 X + \epsilon \]

Where:

  • \(Y\): Dependent variable
  • \(X\): Independent variable
  • \(\beta_0, \beta_1\): Model parameters
  • \(\epsilon\): Random error term

Application: Predicting MPG with Horsepower

We will use the mtcars dataset built into R.

\[ \text{mpg} = \beta_0 + \beta_1 \cdot \text{hp} \]

Scatter Plot with Regression Line