Post Reply 
[HP-12C] Angular coefficent from linear regression off by 1
01-21-2019, 08:10 PM
Post: #31
RE: [HP-12C] Angular coefficent from linear regression off by 1
(01-19-2019 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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [HP-12C] Angular coefficent from linear regression off by 1 - Dieter - 01-21-2019 08:10 PM



User(s) browsing this thread: 2 Guest(s)