Re: hp41 howto do simple linear regression? Message #2 Posted by Dave Shaffer on 17 Dec 2002, 8:02 p.m., in response to message #1 by David E
Well, David, you can always do it the semi-hard way - with just the '41 itself.
If you use the sigma+ button (top left on the keypad)(after clearing the summation registers using the CLSigma button - shift x<>y key, just below the sigma+ key), you can accumulate the sums of x, x^2, y, y^2, and xy in memory registers 11 through 15 respectively, while register 16 will get the value of n (the number of x,y pairs). To put in your numbers, enter y first, then "ENTER", and then enter your x value - then hit the sigma+ key.
After you have entered all you pairs of values, you need to remember (or be told - or, left as an exercise for the student, derive!) the least-squares fitting expressions for slope, intercept, and correlation coefficient. In case you are rusty:
the slope is (n*SUMxy - SUMx*Sumy)/(n*SUMx^2 - (Sumx)^2)
the intercept has the numerator SUMy*SUMx^2 - SUMxy*SUMx
(with the same denominator as for the slope)
r is (n*SUMXY - SUMx*SUMy) / ( SQRT(n*SUMx^2 - (SUMx)^2) * SQRT(n*SUMy^2 - (SUMy)^2) )
I hope my notation is clear. SUMx means the summation of x, and (SUMx)^2 means to square this sum (whereas SUMx^2 means the summation of x-squared).
Have fun.
|