HP Forums
[12C] Linear Regression - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: [12C] Linear Regression (/thread-12224.html)



[12C] Linear Regression - Gamo - 01-19-2019 06:01 AM

HP-10C 11C and 15C came with [L.R.] (Linear Regression) function.

HP-12C don't have this function this program will do the L.R. function based
on the formula shown on the HP-11C manual on page 63

To use this L.R. function program, use the [Σ+] key to accumulate the statistic of
a series of two or more data pair. Then execute [R/S]

Procedure:
[R/S] display Y-intercept on stack register X
[X<>Y] display Slope on stack register Y

------------------------------------------------------------
Program: L.R. for HP-12C
Quote:RCL 1
RCL 6
x
RCL 2
RCL 4
x
-
RCL 1
RCL 3
x
RCL 2
ENTER
x
-
÷
STO 0
--------------------------
RCL 4
RCL 3
x
RCL 2
RCL 6
x
-
RCL 1
RCL 3
x
RCL 2
ENTER
x
-
÷
RCL 0
X<>Y

Remark:

For HP-12C Platinum
Simply remove [ENTER] [x] to [X^2]
And remove [STO] 0 [RCL] 0 and [X<>Y]

Gamo


RE: [12C] Linear Regression - Gene - 01-19-2019 01:46 PM

Gamo,

The HP 12c has linear regression built in. The slope has to be computed by calculating the difference in the predicted Y-values for two X-values.

This is covered in the HP-12c manual and in the learning module.

HP-12c learning module


RE: [12C] Linear Regression - Dieter - 01-19-2019 01:57 PM

(01-19-2019 01:46 PM)Gene Wrote:  The HP 12c has linear regression built in. The slope has to be computed by calculating the difference in the predicted Y-values for two X-values.

This has already been discussed here, cf. http://www.hpmuseum.org/forum/thread-6185-post-55342.html#pid55342

0  g [y^, r] => intercept
1  g [y^, r] => slope + intercept

So this...
Code:
1
y^, r
0
y^, r
x<>y
R↓
-
LstX

...returns the y-intercept in X, the slope in Y and the correlation coefficient in Z and T.

Also post #8 in that thread has essentially the same program as Gamo's, just without the double calculation of the determinant.

Note: Gamo, I have sent a PM earlier today as you originally posted this to the Articles forum where no replies are possible.

Dieter


RE: [12C] Linear Regression - Gamo - 01-20-2019 12:19 AM

Thanks to Dieter and Gene

The 12C learning module explain in detail and same as Dieter mention.

No wonder that 12C came with both X^,r and Y^,r


Gamo