Saturday, March 4, 2023

Radio Shack EC-4000 (equiv. of TI-57): Linear Regression

Radio Shack EC-4000 (equiv. of TI-57):   Linear Regression








The TI-57 Clone and the Statistics


The Radio Shack EC-4000, which is identical to the 1977 Texas Instruments TI-57 programming calculator.  The calculators have a program space of 50 programming steps with a simple function set.  We get loops and tests, but the statistics kind of lack.  Despite this, the EC-4000 can work with two variable statistics.


Entering bivariate data: x [ x<>t ] y  [ 2nd ]  ( Σ+ )


2nd xbar (x with a bar over the x): mean of x data (1 variable); mean of y data (2 variable)


INV 2nd xbar:  mean of x data (2 variable)


2nd σ^2:  variance of x data (1 variable), variance of y data (2 variable)


INV 2nd σ^2:  variance of x data (2 variable)


Registers:

R0 = n

R1 = Σy

R2 = Σy^2

R3 = Σx

R4 = Σx^2

R5 = Σxy

R7: use for data entry


This leaves R6 is available for calculations.  



Formulas Used

y = a * x + b

a:  slope
b:  y-intercept
r^2:  r-square (closer to 1 is best)

Simplifying the formulas in order to fit the three formulas within 50 steps:

a = ( Σx * ybar - Σxy ) / ( xbar * Σx - Σx^2 )

b = ybar - a * xbar

r^2 = abs( a * ( Σx * ybar - Σxy) / ( Σy^2 - Σy * ybar ) )



Radio Shack EC-4000/TI-57 Program: Linear Regression

Output:  [ R/S ] a [ R/S ] b [ R/S ] r^2

Step #: Code [ key ]

// Calculate a (slope):
00:  43  [ ( ]
01:  33,3  [ RCL 3 ]
02:  55  [ × ]
03:  89  [ xbar ]
04:  65  [ - ]
05:  33,5  [ RCL 5 ]
06:  44  [ ) ]
07:  45  [ ÷ ]
08:  43  [ ( ]
09:  -89  [ INV xbar ]
10:  55  [ × ]
11:  33, 3  [ RCL 3 ]
12:  65   [ - ] 
13:  33, 4  [ RCL 4 ]
14:  85  [ = ]
15:  32, 6  [ STO 6 ]
16:  81  [ R/S ]

// Calculate b (y-intercept):
17:  89  [ xbar ]
18:  65  [ - ]
19:  33, 6  [ RCL 6 ]
20:  55  [ × ]
21:  -89  [ INV xbar ]
22:  85  [ = ]
23:  81  [ R/S ]

// Calculate r^2
24:  33, 6  [ RCL 6 ]
25:  55  [ × ]
26:  43  [ (  ]
27:  33, 3  [ RCL 3 ]
28:  55  [ × ]
29:  89  [ xbar ]
30:  65  [ - ]
31:  33, 5  [ RCL 5 ]
32:  44  [ ) ]
33:  45  [ ÷ ]
34:  43  [ ( ]
35:  33, 2  [ RCL 2 ]
36:  65  [ - ]
37:  33, 1  [ RCL 1 ]
38:  55  [ × ]
39:  89  [ xbar ]
40:  85  [ = ]
41:  40  [ |x| ]
42:  81 [ R/S ]
43:  71  [ RST ]

Like the TI-57, the program memory is lost when the EC 4000 is turned off.   In fact, it is the only way to clear the program memory.  

Want to clear statistical memory while keeping the program memory?  Press [ INV ] [ 2nd ] ( C.t ).


Examples


Example 1:
( x, y ) Data
1:  ( 5.08, 150.0 )
2:  ( 5.26, 150.5 )
3:  ( 5.51, 151.0 )
4:  ( 5.67, 151.5 )
5:  ( 5.89, 152.0 )
6:  ( 6.18, 152.5 )

Results:
a:  2.3032805
b:  138.35547
r^2:  0.993701

Example 2:
( x, y ) Data
1:  ( -2, 546 )
2:  ( -1, 540 )
3:  ( 0, 533 )
4:  ( 1, 527 )
5:  ( 2, 521 )
6:  ( 3, 515 )

Results: 
a:  -6.2285714
b:  533.44762
r^2:  0.999383 


Tomorrow, more programs.   I'm back to Saturday-Sunday posts.   

Take care,

Eddie 

All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.