Wednesday, August 30, 2017

TI-84 Plus CE: Fitting a Parametric Line

TI-84 Plus CE:  Fitting a Parametric Line

The program PARLIN attempts to fit a parametric line for a collection of points (x(t), y(t)) using the following equations:

x = a * t + b
y = c * t + d

where the independent variable is t.  The program also plots the estimated line and the scatter plot.  I decided to keep the correlation (r^2) separate, so we can tell how well the line fits both the x and y data. 

TI-84 Plus CE Program PARAM

Notes:

L1: list 1, [ 2nd ] [ 1 ]; L2: list 2, [ 2nd ] [ 2 ], etc.  X1T, Y1T are from the [ vars ], Y-VARS, Parametric submenu

[square] is from [2nd] [ y= ] (stat plot) , MARK submenu, option 1

Program:

Param
Input "T LIST: ",L1
Input "X LIST: ",L2
Input "Y LIST: ",L3
FnOff
PlotsOff
LinReg(ax+b) L1,L2
a→A:b→B:r²→E
"AT+B"→X1T
ClrHome
Disp "X = A*T + B"
Disp A
Disp B
Disp "CORR: "
Pause E
LinReg(ax+b) L1,L3
a→C:b→D:r²→F
"CT+D"→Y1T
ClrHome
Disp "Y = C*T + D"
Disp C
Disp D
Disp "CORR: "
Pause F
min(L1)-5→Tmin
max(L1)+5→Tmax
FnOn 1
PlotsOn 1
GraphColor(1,BLUE)
Plot1(Scatter,L2,L3, [square] ,ORANGE)
ZoomStat

(Obviously use the colors and makers you like.   If you are working with a monochrome TI-83/TI-84, ignore the color commands.)

You can also download the program here:


Example 1

Fit the data to a parametric line:

T
X
Y
1
2.3
-3.0
2
2.8
-2.6
3
3.2
-2.3
4
3.7
-1.9
5
4.2
-1.6

Results:  
x = 0.47*t + 1.83 (r^2 ≈ 0.998)
y = 0.35*t – 3.33 (r^2 ≈ 0.997)




Example 2

Fit the data to a parametric line:

T
X
Y
1
-1.0
1.000
2
1.0
1.250
4
5.3
1.746
8
13.6
2.825
16
30.1
4.275

Results:
x = 2.075268817 * t – 3.066666667 (r^2 ≈ 0.99997)
y = 0.2196827957* t + 0.857166667 (r^2 ≈ 0.99145)



Eddie


This blog is property of Edward Shore, 2017.