05092016, 07:33 PM
Pages: 1 2
05092016, 07:33 PM
05112016, 05:58 AM
(05092016 07:33 PM)bshoring Wrote: [ > ]This is amazing! I never knew you could do a linear regression this way. Thanks for enlightening me.
There are various options. For instance, you could also use \(m = (\bar yb)/\bar x\).
Dieter
05122016, 06:32 PM
(05112016 05:58 AM)Dieter Wrote: [ > ](05092016 07:33 PM)bshoring Wrote: [ > ]This is amazing! I never knew you could do a linear regression this way. Thanks for enlightening me.
There are various options. For instance, you could also use \(m = (\bar yb)/\bar x\).
Dieter
How would I do that in RPN ?
05122016, 10:05 PM
(05122016 06:32 PM)bshoring Wrote: [ > ](05112016 05:58 AM)Dieter Wrote: [ > ]\(m = (\bar yb)/\bar x\).How would I do that in RPN ?
01: 0
02: g y,r
03: RCL 1
04: ×
05: CHS
06: RCL 4
07: +
08: RCL 2
09: ÷
10: R/S
The result is same: 11.09933164
The above equation for the fitted line means that the least squares method fits a line which is goes through the center of "gravity" of the data points. If you know that you'll never forget how simple to calculate slope of that line.
Csaba
05122016, 10:20 PM
(05062016 01:11 PM)Dieter Wrote: [ > ]...direct solution using the six registers is inherently more exact. As long as these data do not have too many significant digits (which usually is the case with empirical data) the results are exact. Even in the last digit.
May I can spend a short time to check what does it mean in the regression coefficients if each data has a given relative error. Let's say the relative error approx. 1E3 (=0.1%) in the engineering practice and we have n measuring points (n=5 ... n=9 typical number of data) what is the relative error of slope and intercept.
Csaba
05132016, 06:24 AM
(05122016 06:32 PM)bshoring Wrote: [ > ](05112016 05:58 AM)Dieter Wrote: [ > ]There are various options. For instance, you could also use \(m = (\bar yb)/\bar x\).
How would I do that in RPN ?
You could do it the way described by Csaba (which actually is the above expression with nominator and denominator multiplied by n). On the other hand both means are returned by the x_bar key (g 0), so this is a direct translation of the formula:
Code:
01 g x_bar
02 x<>y
02 0
03 g ŷ, r
04 x<>y
05 R↓
06 
07 x<>y
08 /
09 R/S
Dieter
05132016, 07:54 PM
Thanks. All very fascinating.
08032016, 07:38 PM
(05062016 01:11 PM)Dieter Wrote: [ > ]... the suggested direct solution using the six registers is inherently more exact ...
And what is your opinion about that method which is described in the TI65 Guidebook?!
Csaba
 The forum motor do not like the Google links (( So try to right click and Open in new tab, or something...
08032016, 10:10 PM
(08032016 07:38 PM)Csaba Tizedes Wrote: [ > ]And what is your opinion about that method which is described in the TI65 Guidebook?!
I'd tell you if ...I could take a look at this book. ;)
(08032016 07:38 PM)Csaba Tizedes Wrote: [ > ]  The forum motor do not like the Google links (( So try to right click and Open in new tab, or something...
Your link does not work because you used IMG tags for something that is not a picture.
A regular link should be fine: Try this one.
But anyway, this Google thing does not work for me.
But why do you want to link to Google instead of providing a simple link to the picture? You can even insert the picture in your forum post – as a simple JPG or PNG file attachment.
Or what about explaing the method in your own words?
Dieter
01192019, 05:36 PM
(05052016 07:07 AM)Csaba Tizedes Wrote: [ > ]01: 0
02: g y,r
03: x<>y
04: g s
05: ÷
06: ×
07: R/S
This regression slope code is neat !
(05062016 01:11 PM)Dieter Wrote: [ > ]The method you suggested is short and elegant. However, it uses the regression coefficient and the two standard deviations, where all three are internally calculated using square roots. That's why this method is prone to slight errors in the last digit, just as the method suggested in the manual.
Manual suggested method, slope = f(1)  f(0), may lose *many* significant digits, due to subtraction cancellation.
01212019, 08:10 PM
(01192019 05:36 PM)Albert Chan Wrote: [ > ]Manual suggested method, slope = f(1)  f(0), may lose *many* significant digits, due to subtraction cancellation.
OK, then let's combine a manual calculation from the stored sums for the slope and the 0 y^ method for the intercept. The latter should be exact by design as the calculator evaluates 0*slope + intercept. I assume this calculation is even done with the internal extended precision.
Which leads to this program:
Code:
RCL 1
RCL 6
x
RCL 2
RCL 4
x

RCL 1
RCL 3
x
RCL 2
ENTER
x

÷
0
y^, r
X<>Y
ENTER
R↓
R↓
GTO 00
On exit the stack holds all relevant data:
T: r
Z: r
Y: slope
X: intercept
You may replace the last ENTER with RCL 1 X<>Y, so that T finally holds the number of data points.
Dieter
Pages: 1 2