TI-BASIC:Linreg A Bx

From Learn @ Cemetech
Revision as of 23:54, 24 February 2016 by Maintenance script (talk | contribs) (Automated internal link correction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

[[File:|border]]

Command Summary

Calculates the best fit line through a set of points.

Command Syntax

LinReg(a+bx) [x-list, y-list, [frequency], [equation]

Menu Location

Press:

  1. STAT to access the statistics menu
  2. LEFT to access the CALC submenu
  3. 8 to select LinReg(a+bx), or use arrows

Calculator Compatibility

TI-83/84/+/SE

Token Size

1 byte

The LinReg(a+bx) command is one of several that can calculate the line of best fit through a set of points (it differs from LinReg(ax+b) only in the format of its output). To use it, you must first store the points to two lists: one of the x-coordinates and one of the y-coordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit...) is a useful window for entering the points.

In its simplest form, LinReg(a+bx) takes no arguments, and calculates a best fit line through the points in L₁ and L₂:

:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:LinReg(a+bx)

On the home screen, or as the last line of a program, this will display the equation of the line of best fit: you'll be shown the format, y=a+bx, and the values of a and b. It will also be stored in the RegEQ variable, but you won't be able to use this variable in a program - accessing it just pastes the equation wherever your cursor was. Finally, the statistical variables a, b, r, and r² will be set as well. These latter two variables will be displayed only if "Diagnostic Mode" is turned on (see DiagnosticOn and DiagnosticOff).

You don't have to do the regression on L₁ and L₂, but if you don't you'll have to enter the names of the lists after the command. For example:

:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:LinReg(a+bx) ∟FAT,∟CALS

You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument - the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the x-list and y-list as well, even when they're L₁ and L₂.

Finally, you can enter an equation variable (such as Y₁) after the command, so that the line of best fit is stored to this equation automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last. You can use polar, parametric, or sequential variables as well, but since the line of best fit will be in terms of X anyway, this doesn't make much sense.

An example of LinReg(a+bx) with all the optional arguments:


:{9,13,21,30,31,31,34→FAT
:{260,320,420,530,560,550,590→CALS
:{2,1,1,1,2,1,1→FREQ
:LinReg(a+bx) ∟FAT,∟CALS,∟FREQ,Y₁


Advanced Uses (for programmers)

LinReg(a+bx), along with LinReg(ax+b), can be used to convert a number to a string.

Related Commands