Linear Regression for Dummies

Aditya Daria
3 min readJan 22, 2023

Linear regression is like a magic formula that helps us predict things. Imagine you have a toy car and you want to know how fast it will go when you push it with different amounts of force. You can use linear regression to make a prediction based on how hard you push the car.

To use linear regression, you first collect data by pushing the car with different amounts of force and measuring how fast it goes. Then you use that data to create a line that best fits the data. This line is called a “linear regression line” and it can be used to make predictions about the car’s speed based on how hard it is pushed.

The basic formula for linear regression is:

y = mx + b


  • y is the value we want to predict (also called the “dependent variable”)
  • x is the input value (also called the “independent variable”)
  • m is the slope of the line, it shows the change in y for each unit change in x.
  • b is the y-intercept, it shows the value of y when x is zero.

This formula is like a recipe for making predictions. We plug in the value of x that we want to make a prediction for and then use the formula to calculate the value of y that we predict. The slope (m) and y-intercept (b) are determined from the data.

Image from Google

Another example would be, let’s say we want to use linear regression to predict a student’s test score based on the number of hours they studied.

First, we collect data from a group of students on their study hours and test scores. The data might look like this:

Next, we use this data to create a linear regression line. The line is created by finding the best values for the slope and intercept. The slope tells us how much the test score changes for each additional hour of study, and the intercept tells us the test score when a student studies for 0 hours.

The line will look something like this:

Test Score = (slope) x Study Hours + (intercept)

The slope and intercept values are chosen so that the line fits the data points as closely as possible.

Once we have the line, we can use it to make predictions. For example, if a student studies for 6 hours, we can use the line to predict that they will get an 85 on the test. Or, if a student studies for 8 hours, we can use the line to predict that they will get a 92 on the test.

It’s important to note that linear regression is not always the best model to use and it also has some limitations such as it assumes linearity between independent and dependent variables and it assumes that the errors are normally distributed and have constant variance.

In summary, we used linear regression to predict a student’s test score based on the number of hours they studied. We collected data on study hours and test scores, used that data to create a linear regression line, and then used that line to make predictions about future test scores. Linear regression is a powerful tool that can help us understand the relationship between different things and make predictions, but it also has some limitations.

I hope that you will find this article insightful and informative. If you enjoyed it, please consider sharing the link with your friends, family, and colleagues. If you have any suggestions or feedback, please feel free to leave a comment. And if you’d like to stay updated on my future content, please consider following and subscribing using the provided link. Thank you for your support!