TI 84 Plus CE and HP 33S: Scaled Data for Statistics
Introduction and the Mathematics
The goal of the programs posted today is to take a data set of real numbers and scale it down to the range [1,10]. Why? Sometimes scaling data by applying a linear transformation, it could make curve fitting and data analysis more accessible and open up regression analysis previously not available, such as logarithmic or power regression.
Let:
max = maximum value of the data set
min = minimum value of the data set
And:
min * a + b = 1
max * a + b = 10
Solving for a and b:
a = 9/(max - min)
b = 1 - a * min = 10 - a * max
Apply this transformation to the data set to get:
x' = a*x + b
And to convert back:
x = (b - x')/a
TI-84 Plus CE Program: DSCALE (TI-Basic)
Disp "DATA SCALE TO [1,10]","BY EDWARD SHORE"
Input "XLIST: ",L5
9/(max(L5)-min(L5))→A
1-A*min(L5)→B
Disp "FORMULA:","X'="+toString(A)+"X+"+toString(B)
Pause
A*L5+B→L6
Disp "SCALED DATA:"
Pause L6
Note:
L5: List 5, used for input, [ 2nd ] [ 5 ]
L6: List 6, used for output, [ 2nd ] [ 6 ]
HP 33S Programs
LBL Y: determine A and B. Stack: Y: max, X: min
HP 33S Size: LN = 72, CK = B830
Y0001 LBL Y
Y0002 -
Y0003 LASTx
Y0004 x<>y
Y0005 1/x
Y0006 9
Y0007 ×
Y0008 STO A
Y0009 VIEW A
Y0010 ×
Y0011 1
Y0012 x<>y
Y0013 -
Y0014 STO B
Y0015 VIEW B
Y0016 RTN
LBL X: Calculate x'
HP 33S Size: LN = 15, CK = 08B6
X0001 LBL X
X0002 RCL- B
X0003 RCL÷ A
X0004 STOP
X0005 GTO X // this allows for repeated calculations by pressing R/S
LBL Z: Calculate x
HP 33S Size: LN = 15, CK = 4552
Z0001 LBL Z
Z0002 RCL× A
Z0003 RCL+ B
Z0004 STOP
Z0005 GTO Z // this allows for repeated calculations by pressing R/S
Instructions:
1. Do this first: max [ ENTER ] min [ XEQ ] Y
2. XEQ Z to calculate X'. XEQ X to calculate X'.
X' = A * X + B
Example
Data Set: [-5, -3, 2, 3, 6]
max = 6
min = -5
(results are rounded to six decimal places)
a = 0.818182
b = 5.090909
Translated Data:
x to x':
x = -5, x' = 1.000000
x = -3, x' = 2.636364
x = 2, x' = 6.727273
x = 3, x' = 7.545455
x = 6, x' = 10.000000
x' to x:
x' = 2.5, x = -3.16667
x' = 5, x = -0.111111
x' = 7.5, x = 2.944444
Hope you find this helpful. Next week is a retro review of the HP 33S Calculator, once abhorred now held as valuable.
Eddie
All original content copyright, © 2011-2022. 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.