Paul, I'm not sure that the code is bug free. A scan with S := 30 looks iffy. That is, adding the condition ----- if b > .1 then println symbol,",",b:8:2,",",close(0):8:2; endif; ------ and sorting on b doesn't look quite right. I want to check it out in MSWIN or by exporting the list to a spreadsheet to be sure.
The values of a and b in y = a + b*x must satify the two equations Sy = a*S + b*Sy and Sxy = a*Sx + b*Sxx, which gives a = (Sxx*Sy - Sx*Sxy)/D, b = S*Sxy - Sx*Sy/D, where D = S*Sxx - Sx*Sx.
Anyone see any obvious errors in the equations or the code ?
Bob |