# 4.6 - Exploring Data: Nonlinear Models

This section is a continuation of section 2.6, Exploring Data: Linear Models and Scatter Plots. Please see that section for the introductory information on how to enter data into your calculator, create scatter plots, and perform regression.

## TI-82 / TI-83 Models

Model Calculator Command Equation
Linear LinReg(ax+b) L1, L2 y = ax + b
At least 3 points required
QuadReg L1, L2 y = ax2 + bx + c
Cubic,
At least 4 points required
CubicReg L1, L2 y = ax3 + bx2 + cx + d
Quartic,
At least 5 points required
QuartReg L1, L2 y = ax4 + bx3 + cx2 + dx + e
Logarithmic LnReg L1, L2 y = a + b ln x
Exponential ExpReg L1, L2 y = a bx
Power PwrReg L1, L2 y = a xb
Logistic (TI83 only) Logistic L1, L2 y = c / ( 1 + a e-bx )
Sinusoidal (TI83 only),
At least 4 points required
SinReg L1, L2 y = a sin (bx + c) + d

With the TI-83, you may store the regression equation directly into a y-variable by specifying the y-variable after the lists where your data is stored. Example: "LnReg L1, L2, y1" would compute the logarithmic model and save the result into y1.

## TI-85 Models

Model Calculator Command Equation
Linear LINR y = a + bx
At least 3 points required
P2REG You are given a list of coefficients. These coefficients are in standard form, so the first coefficient will be the leading cofficent, and the last coefficient in the list will be the constant.
Cubic,
At least 4 points required
P3REG
Quartic,
At least 5 points required
P4REG
Logarithmic LNR y = a + b ln x
Exponential EXPR y = a bx
Power PWRR y = a xb

Notice that things are a little different for the TI-85 when it comes to polynomial regression. The results are not given in equation form with individual coefficients, but are given as a list of coefficients and stored in the variable PRegC. If PRegC = { 3, 2, -1, 5 }, then the regression equation would be y = 3x3 + 2x2 - x + 5. DRREG will correctly draw the regression equation even if polynomial regression is used.

## Least Squares Regression Model

The concept behind fitting a model to data is to find the model that has the smallest deviation from the actual data. This deviation is the predicted (estimated by the model) y-value minus the actual y-value. These deviations are all squared to make sure they don't cancel each other out, and then added. We're then looking for the smallest sum of the squared deviations, that is the "Least Squares" model.

### TI-82 / TI-83

Note problems 35 and 36 will be much easier if you follow the instructions here than the instructions in the book.

Assume that you have entered the x-values into list 1 and the y-values into list 2. You have computed whichever model you're working with and have saved the resulting equation into y1.

The predicted y-values can be found by evaluating y1 at each x-value (list 1): y1(L1)

The sum of the squared deviations can be found using the following command:

```   sum ( ( L2 - y1(L1) )2 )
```
• The "sum" command can be found under the LIST key. After hitting 2nd Stat to get the List menu, arrow right to Math, and choose sum.
• The L1 and L2 commands can be obtained by hitting 2nd 1 and 2nd 2.
• The y-variables like y1 can be found on the TI-82 under the Y-VARS key (2nd VARS), and on the TI-83 under the VARS key, and then arrow right to the Y-Vars option.

The model with the smallest sum of the squared deviations is the best model.

### TI-85

With the TI-85, this is a much harder task to accomplish. Calculate the regression equation as normal, then enter the following expression to find the sum of the squares (extra spaces inserted for readability).

```  sum seq( ( yStat(x) - fcsty xStat(x) )2, x, 1, dimL xStat, 1)
```
• sum, seq, and dimL can be found under the LIST key, and the OPS sub menu.
• The xStat and yStat can be found under the LIST key, and the NAMES sub menu. They can also be found under the STAT key and the VARS sub menu, but it is probably easier from list since that's where the rest of the commands are.
• The fcsty can be found under the CATALOG by pressing the Alpha and then F keys.

If someone can find an easier way on the TI-85, then please let me know. You may want to write a short program with that command in it.

## Correlation Coefficient

We mentioned the correlation coefficient, r, back in section 2.6. Back then, it was only for linear models. We can also compute (well, we'll let the calculator compute) the value for r and r2 for nonlinear models also.

Back in section 2.6, we said that the closer the value of r was to 1 or -1, the better the model fit the data. For nonlinear models, we often ignore the value of r and look at the value of r2. The value of r2 can be found by simply squaring r.

There is always variation in your data. That is, never (almost) is all of the data exactly the same. The interpretation of r2, from a statistical point of view is the percent of the variation that can be explained by the model. The higher the value of r-squared, the better the model explains the data.

The TI-85 does not calculate the value of r2 for polynomial (quadratic, cubic, or quartic models). For the other models, you may have to square the correlation (corr variable). The variables necessary to easily compute the value the correlation coefficient aren't computed when doing polynomial regression, so finding r or r2 for polynomial regression are going to be extremely difficult for the TI-85 users. I suggest you find a TI-82 or TI-83 and borrow it long enough to do that particular regression model.

The model with the highest value for r2 is the best model.