I have a temporary table with 2 numeric columns, Y and X.
CREATE TEMP TABLE findslope(y numeric,x numeric);
Which I then populate with the desired X and Y for the line I'm trying to fit a least squares best fit line which I am currently using the following:
SELECT REGR_SLOPE(y, x) slope FROM findslope into slope_variable;
This works well, but is it possible to force the line through a point or to set the intercept? Specifically I'd like the line to go through the origin: 0,0.
Below is the working code: