I'm doing a least-square regression on some data, the function has the form
y ~ a + b*x
and I want the regression line to pass through a specific point P(x,y) (which is not the origin). How can I do that?
I'm using the lm command in R and the basic fitting GUI in Matlab. I think that I could use the constrOptim command (in R) or translate the origin into the point P, but I'm wondering if there's a specific command to do that.
I only need the solution for one of these programs, then I can use the coefficients in the other one.