2026-10-16

What is Simple Linear Regression?

Definition: Simple linear regression is a statistical method that studies the relationships between two continuous(quantitative) variables.

X variable is regarded as the predictor

Y variable is regarded as the response

In all while using a straight line to describe the relationship.

Regression Equation

The equation for simple linear regression would be \[ y = a + bx \]

  • y is the predicted value
  • x is the predictor value
  • a is the y-intercept
  • b is slope

Example : Engine displacement and Horsepower

An example of simple linear regression is using the mtcars data set in r and figuring out if the engine displacement can be used to predict a car’s horsepower.

  • x = engine displacement (disp)
  • y = horsepower (hp)

Scatter plot of Engine displacement and Horsepower

The different colors represent cars with 4, 6, and 8 cylinders. Showing their relationship between engine displacement and horsepower.

Finding regression line

mod <- lm(mtcars$hp ~ mtcars$disp)
mod
## 
## Call:
## lm(formula = mtcars$hp ~ mtcars$disp)
## 
## Coefficients:
## (Intercept)  mtcars$disp  
##     45.7345       0.4376

After running the R code we can see the intercept is 45.7345 and the slope is 0.4376

Making the simple linear regression equation be : \[ y = 45.7345 + 0.4376x \]

Scatter plot with the regression line

Interactive plot of the Displacement and Horsepower

Conclusion

We can observe that between the engine displacement and horsepower have a positive relationship using simple linear regression. Seeing that as the engine displacement increases and so does the horsepower.