0
$\begingroup$

There is a formula for calculating slope (Regression coefficient), b1, for the following regression line:

y= b0 + b1 xi + ei (alternatively y'(predicted)=b0 + b1 * x); which is

b1=(∑(xi-Ẋ) * (yi-Ῡ)) / (∑ ((xi- Ẋ) ^ 2)) ---- (formula-A)

source: https://stattrek.com/statistics/measurement-scales.aspx?Tutorial=reg etc.

Now, how to derive that formula (formula-A here) and what are the logical or intuitive rationales behind the formula?

I searched the web but couldnot find anything helpful

$\endgroup$
  • $\begingroup$ please feel free to do necessary mathjax edits i have forgot it $\endgroup$ – Always Confused Nov 12 '19 at 11:00
1
$\begingroup$

I don't have enough reputation to past a comment so I'm going to place an answer.

In my understanding to derive this formula you have to go through the sum of squared residuals.

residual = E_i = (y_i - (b_o + b_1*X_i)) = (y_i - b_0 - b_1*x_i)

Therefore the sum of squared residuals =

SUM (E_i)^2 from i to n which = sum(y_i - b_0 - b_1*x_i)^2 from i to n

we know that b_0 and b_1 = 0 because they are constants and when you take the partial derivative they should also equal 0 so we can set that equation. In this case since you are only asking about b_1 we will only do that equation.

derivative of Sr/b_1 = 0

which is the same as

derivative Sr/b_1 sum(y_i - b_0 - b_1*x_i)^2 from i to n

= sum(2(y_i - b_0 - b_1*X_i)(-X_i) = 0 from i to n

= -2sum(X_iY_i) + 2sum(b_0*X_i) + 2sum(X_i^2) = 0 with all sums being from i to n

You can now divide both sides by two to remove those and move the sum(X_i*Y_i) to the other side.

You can now pull out constants from the sumation.

b_0*sum(X_i) + b_1*sum(X_i^2) = sum(X_i*Y_i)

Use algebra to solve.

b_1 = nsum(X_iY_i) - sum(X_i)sum(Y_i) / nsum(X_i^2) - (sum(X_i))^2

Which I believe is the same as your equation above.

Again I could be completely wrong, this is just how I remember it and how it was described to me.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.