TI-BASIC:Cubicreg

From Learn @ Cemetech
Revision as of 19:38, 24 February 2016 by KermMartian (talk | contribs)
Jump to navigationJump to search

CUBICREG.GIF

Command Summary

Calculates the best fit cubic function through a set of points.

Command Syntax

CubicReg @@[@@x-list, y-list, [frequency list@@]@@, [equation variable@@]@@

Menu Location

Press:

  1. [STAT] to access the statistics menu
  2. [LEFT] to access the CALC submenu
  3. 6 to select CubicReg, or use arrows

Calculator Compatibility

TI-83/84/+/SE

Token Size

1 byte

The CubicReg command can calculate the best fit cubic function through a set of points. 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. You must have at least 4 points, because there's infinitely many cubics that can go through 3 points or less.

In its simplest form, CubicReg takes no arguments, and calculates a cubic through the points in L₁ and L₂:

:{9,13,21,30,31,31,34→L₁
:{260,320,420,530,560,550,590→L₂
:CubicReg

On the home screen, or as the last line of a program, this will display the equation of the quadratic: you'll be shown the format, y=ax³+bx²+cx+d, and the values of a, b, c, and d. 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, c, d, and R² will be set as well. This latter variable 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
:CubicReg ∟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 equation is stored to this variable 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 quadratic will be in terms of X anyway, this doesn't make much sense.

An example of CubicReg 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
:CubicReg ∟FAT,∟CALS,∟FREQ,Y₁


Advanced

Note that even if a relationship is actually linear or quadratic, since a cubic regression has all the freedom of a linear regression and more, it will produce a better R² value, especially if the number of points is small, and may lead you to (falsely) believe that a relationship is cubic when it actually isn't. Take the correlation constant with a grain of salt, and consider if the fit is really that much better at the expense of doubling the complexity, and if there's any reason to believe the relationship between the variables may be cubic.

Related Commands