Post Reply 
HP 48G Linear Regression Best Fit Line
12-11-2021, 05:38 PM (This post was last modified: 12-13-2021 05:32 AM by Rodger Rosenbaum.)
Post: #19
RE: HP 48G Linear Regression Best Fit Line
MNH, of course, wants to do this on his HP48G (EMu48, I think).

I wouldn't use the technique described on that WikiPedia page; there's no need to involve complex variables.

It can be done with the built-in LR function. if the data are input via the standard method to enter single variable data, ΣDAT will contain the X and Y data. The various summary statistics variables are used to compute the linear regression (LR), and a small program can compute the orthogonal regression from those same variables.

I called the program ORTH and used it to solve MNH's problem.

Here it is:

<< LR SWAP DROP DUP CORR DUP SIGN 4 ROLLD SQ / SWAP INV -
2 / DUP SQ 1 + √ ROT * + DUP ΣX * NEG ΣY + NΣ / >>

To use this, enter the data in the usual way as if to enable the later use of the
LR function. The result will be the slope and intercept for the line which minimizes the SSE with the deviation from the line in the orthogonal direction.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 48G Linear Regression Best Fit Line - Rodger Rosenbaum - 12-11-2021 05:38 PM



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