I tried to do a simple linear regression using the "Numworks" calculator and unless I add many more data points or add a point where x=0 it doesn't give me the correct equation.
Could someone explain why is the equation
y = 2*x -1.776356839e-15
instead of
y = 2*x + 0
Is it because of the linear regression algorithm they use.
If this is the case shouldn't it still work for such a simple equation ?
I found the c++ code the calculator is using for linear model https://github.com/numworks/epsilon/blob/master/apps/shared/linear_regression_store.cpp#L87
The code seem to do the following steps:
x = {1, 2, 3}
y = {2, 4, 6}
slope = Covariance[x, y] / Variance[x]
intercept = Mean[y] - slope * Mean[x]