The maths behind multiple linear regression

We looked at the maths behind the simple linear regression, if you grasped it well, this part would be trivial.

Using the line formula y = b + mx, we figured out the slope (m) and multiplied that with the house price, added the bias (b) and got our prediction. Now, given that we have more features than one, that means we have more than one x variables to worry about. In our previous post, we dealt with three independent variables instead of one. So, we can represent them as x1, x2 and x3. Just like before, each of these independent variables will have a slope (m), let’s call those m1, m2 and m3. We leave the bias as a single value.

Based on all of the above information, our new formula takes the shape of ..

y = b + m1x1 + m2x2 + m3x3

That’s it!

Generally, the formula would look like this

y = b + m1x1 + m2x2 + …. mnxn

So you can now extend that to include as many features as you want!

Important Note

Again, a quick reminder, when looking around on the internet, I got pretty confused between the terminology. Most places will likely use the following notation.

This is the difference between the maths and the stats world. Don’t fret and just grasp the general idea.

  • β0 refers to the constant bias/y-intercept
  • The β1, β2 .. βn refer to the slope and called the coefficient or coefficient of slope

Leave a comment