This program is a shortened version of the program Regression in which more regression models are integrated.
Every measurement is influenced by many uncertainties. Measurement uncertainties can never be completely eliminated, so the true value for any quantity is never known exactly.
Linear regression is a statistical tool that helps you to determine the "best-fitting" straight line for any given set of experimental data. In the relationship y = ax + b the constants a and b are being determined. The obtained function hands over which value is to be expected on an average for the one variable (y) at a given value of the other variable (x).
You might prefer knowing more about linear regression beforehand. If so, it is recommended to view an interactive demonstration in order to understand the basic outcomes a linear regression analysis has to offer.
|PROGRAM:REGLIN||R : ALPHA, R keys|
|ClrHome||> PRGM > I/O > ClrHome|
|RectGC:CoordOn||> 2nd FORMAT > ...
: : ALPHA, : keys
|PlotsOff||> 2nd STAT PLOT > PlotsOff|
|FnOff||> VARS > Y-VARS > On/Off... > ...|
|GraphStyle(1,1)||> PRGM > CTL > GraphStyle
, : comma key
|1 → Xres||"→" Symbolizes the STO> key
> VARS > Window... > Xres
|Disp "STORE VALUES","INTO L1 AND L2."||> PRGM > I/O > Disp
Space: ALPHA, .. (above 0 key)
L1 : 2nd, L1 keys
|Pause||> PRGM > CTL > Pause|
|(max(L1)–min(L1))/5 → U||> MATH > NUM > max(|
|10^(int(log(U))) → Z||10^( : 2nd, 10x keys
> MATH > NUM > int(
|U/Z → U|
|(int(√(U–1))²+1)Z → Xscl||√( : 2nd, √ keys (square root)
² : x² key
> VARS > Window... > X/Y > Xscl
|(max(L2)–min(L2))/5 → V|
|10^(int(log(V))) → Z|
|V/Z → V|
|(int(√(V–1))²+1)Z → Yscl||√( : square root
Xscl and Yscl will be set to 1, 2, or 5 times a power of ten.
|Plot1(Scatter,L1,L2, §)||> 2nd STAT PLOT > Plot1(
> 2nd STAT PLOT > TYPE > Scatter
> 2nd STAT PLOT > MARK > § (small square)
|ZoomStat||> ZOOM > ZoomStat|
|ZoomSto||> ZOOM > MEMORY > ...|
|Lbl 0 : ClrHome||> PRGM > CTL > Lbl
> PRGM > I/O > ClrHome
|Menu("","VIEW L1,L2",1, "LinReg(ax+b) ", 2, "ZOOM,Trace", 60, "Stop",7)||> PRGM > CTL > Menu(
> STAT > CALC > LinReg(ax+b)
> PRGM > CTL > Stop
|Menu("","Zoom Out",61, "Zoom In",62, "RESET ZOOM",63, "Trace",64, "HOME",65)||> ZOOM > ...|
|Output(1,1,L1)||> PRGM > I/O > ...|
|Goto 0||> PRGM > CTL > ...|
|Disp "LinReg(ax+b) ", "a,b,r²,r"||> STAT > CALC > LinReg(ax+b)
> VARS > Statistics... > EQ > a (and b,r²,r)
|LinReg(ax+b) Y1||> VARS > Y-VARS > Function... > Y1|
|Disp a,b,r²,r||> VARS > ...|
|DispGraph||> PRGM > I/O > DispGraph|
|√(2) → Z : Z → XFact||(square root)|
|Z → YFact||> VARS > Window... > X/Y > Xfact|
|10^(int(log((Xmax-Xmin)/Z))) → Xscl|
|10^(int(log((Ymax-Ymin)/Z))) → Yscl|
|Zoom Out||> ZOOM > Zoom Out|
|ZoomRcl:Pause||> ZOOM > MEMORY > ZoomRcl|
|Lbl 64:Trace||> TRACE|
|Lbl 65:Goto 0|
|Xscl → ΔTbl:Stop||> VARS > Table... > ΔTbl (Delta-Tbl)
> PRGM > CTL > Stop
After putting in the program listing, you might like to see the program working. Try this example.
A long tube is placed vertically and filled with a viscous liquid. (Which liquid is not?) When a bullet, being made up of steel, is let loose in the liquid, the sinking speed soon becomes constant. To determine this constant velocity, the position x is measured as a function of time t. The measuring outcome is:
Entering the Values
The time t is considered the independent variable and is measured along the horizontal axis of a graph. The position x, the dependent variable, is measured along the vertical axis. List 1 (L1) must contain values of the variable, which is to be plotted along the horizontal axis.
Getting the Linear Equation and the Coefficient of Correlation
After preparing L1 and L2, run the program. A menu appears.
The produced value of the coefficient of correlation (r = 0,99952) indicates that the found linear equation is only a fair representation of the relationship between the measured t and x values. Counting the nines, that directly follow the comma in the coefficient of correlation, is a convenient way to find out the usefulness of the equation. In chemical and physical determinations the number of nines may be interpreted in this way: five nines mean an excellent representation, four nines a good one, three nines a fair one, two nines a poor one, and one nine means a very poor representation. With no nines directly behind the comma the equation is "unusable".
Viewing the Plotted Points and the Straight Line
Once the graph has been drawn, press ENTER, select option "3:ZOOM,Trace" in the menu, and "4:Trace" in the following sub-menu. Next, use the left and right arrow keys to trace the values of the plotted measuring points.
Press the up arrow key once to enable tracing the plotted line. Again, use the left and right arrow keys to explore the coordinates of some points of the line.
Using the TABLE function is another way to get these values. Stop the execution of the program by selecting "5:HOME" in the sub-menu and "4:Stop" in the main menu. Then call on the TABLE function. You may have to adjust the table settings using the TBLSET function.
Hein ten Horn
Top | Programs Texas Instruments | Home