0

I am new to data science and my math skills are really rusty. I am try to understand linear regression, but unfortunately there is one thing that is not clear to me. Assuming I have these data (or these values x and y): {(0,1),(1,3),(2,6),(4,8)}. If this is the formula for the hypothesis:

Y = Β0 + Β1X

Then how do I generate the values B0 and B1? I see many examples using this set of values for B0 and B1:

B0   |   B1
1.5  |   0
0    |   1.5
1    |   0.5

But none of them explains how they came to that conclusion. Could someone help me understand how the hypothesis function works? I appreciate any help you can provide

  • It's not very useful to consult some table of values for $B_0$ and $B_1$ in a regression, because they can be any values! It depends on the data. Have you seen any formulas on how to calculate linear regression coefficients? Hint: it involves symbols like this: $$ \sum $$ – Matti P. Oct 23 '19 at 11:09
  • This could also be relevant: https://math.stackexchange.com/questions/3076868/linear-regression-computation-as-y-ax/3076898#3076898 – Matti P. Oct 23 '19 at 11:10
  • So I advise you to just forget about the table. Look at the values. The first value is $x$ and the second is $y$. We assume that they are linked by $$ y = ax+b $$ for some numbers $a$ and $b$. Looking at the values, would you just be able to just guess these values? (I certainly would...) – Matti P. Oct 23 '19 at 11:11
  • @MattiP. I agree, but what if you wanna calculate the MSE? Then you need to find a few hypothetical values and pick the best one, right? – hispaniccoder Oct 23 '19 at 11:20
  • The general way of calculating the least-squares linear regression is explained in the post that I linked. It can be used for this case too, but you can also just "see" the answer by looking at the numbers. So please read carefully the accepted answer in the linked post. – Matti P. Oct 23 '19 at 11:25

1 Answers1

0

Look at this page : http://mathworld.wolfram.com/LeastSquaresFitting.html

Your problem is treated equations 7-10 with notations $a=B0$ and $b=B1$ .

NUMERICAL EXMPLE :

enter image description here

The theory of mean least square linear regression is explained in the paper referenced above. It's up to you to study it.

Calculus of MSE :

Error on each point : $\quad \epsilon_k=y_k-(B0+B1\:x_k)$

$$MSE=\frac{1}{n}\sum_{k=1}^{n} (\epsilon_k)^2$$ I suppose that you can compute it.

JJacquelin
  • 66,221
  • 3
  • 37
  • 87