2026-10-06

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 regared as the predictor

Y varible is regarded as the response

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

Regression Equation

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

  • y is the predicted value
  • x is the predictior 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)

Scatterplot of 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 \]

Scatterplot 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.