>A couple thoughts:
>
>1. Excel is setup to handle that type of analysis. Import and run!
>
>2. A book on stats would give you the algorithms you need if you want to perform this in VFP. It shouldn't be that difficult to translate.
>
>Jay
The following website explains it:
http://www.shodor.org/succeed/compchem/tools/llsalg.htmly = m*x + b
All you need to do is accumualate five variables as each data point is entered:
n = number of values
nSumX = sum of the x values
nSumY = sum of the y values
nSumXY = sum of the (x*y) values
nSumX2 = sum of the x^2 values
m = (n*nSumXY - nSumX*nSumY)/(n*nSumX2 - nSumX*nSumX)
b = (nSumX2*nSumY - nSumXY*nSumX)/(n*nSumX2 - nSumX*nSumX)
As each data point is entered the counter, n, is incremented and the other sums accumulated. A data point is removed by decrementing n and subtracting the appropriate values from the sums.
Very easy to do.
JLK
Nebraska Dept of Revenue