I don't understand what the regress function is returning. My understanding that it should be the gradient of the line of best fit. For example:
x = [1:5]'y = [2 4 6 8 10]'b = regress(y, x)
returns b = 2 as expected, whereas:
x = [1:5]'y = [5 4 3 2 1]'b = regress(y, x)
returns b = 0.6364 as opposed to -1.
What is the regress function calculating in this case? Where does this value for b come from?
Best Answer