# Modelling and Regression on the Classpad

CAS calculators can perform regression for a number of different curves. We will use Linear, Quadratic and Cubic Regression.

.

#### Example 1

Use the Classpad to find the best model (equation) for the following data: .

Solution

• Go to the Statistics Page.
• Enter the x values into List1
• and the y values into List2 .

• Tap the left icon to draw the graph. .

• Looking at the graph we can see that the graph curves upwards so it is probably a quadratic or cubic.

.

• If the graph doesn’t draw automatically, you may need to click in the table area then go to the SetGraph menu, select Settings, then give it the following shown here: .

For this demonstration, I will start by doing a Linear Regression (for comparison purposes).

Linear Regression

• Click in the table area then go to Calc menu and select Linear Reg.

.

• You should get a screen like the one shown here: .

• XList and YList should match the lists where you entered your data (List1 and List2).
• If you set Copy Formula away from OFF you can store the resulting regression equation in Y1 (or Y2, etc)
• Select OK and you should get a screen like the one shown here: .

• Using the values of a and b that are supplied, we get:

… … … … \$y = 10.96x - 4.24\$

This is the linear regression equation or the “line of best fit.”

I have circled the r2 value on the Linear Regression screen.

• The r2 value is a measure of how closely the line fits the data. The r2 values vary from 0 to 1 where:
• 0 means the data bears no relationship to the line
• more than 0.9 means a strong correlation exists
• 1 means a perfect fit – every data point is on the line.

The r2 value of 0.92 shown here is pretty good.
But looking at the graph suggests a quadratic or cubic function might be better.

Repeating the process with Quadratic Regression and Cubic Regression gives the following results:

. .
… … \$y = 2.20x^2 - 0.05x + 3.10\$

… … \$r^2 = 0.999993\$

.

Cubic Regression: .
… … \$y = 0.005x^3 +2.17x^2 - 0.01x + 3.08\$

… … \$r^2 = 0.999994\$

We can see that both the Quadratic and Cubic Regression Lines are effectively a perfect fit. .

Since the cubic regression has an x3 term coefficient of less than 0.005,
we can use the Quadratic Regression for all practical purposes.

.

## Changing to Linear Regression on the Classpad

If the calculator can’t automatically do the regression curve you want, you’ll have to change the x-values (in List1) using the appropriate function the same way we did in Modelling and then check using Linear Regression.

.

#### Example 2

Use the Classpad to find the best model (equation) for the following data: Solution

Go to the Statistics Page.

• Enter the x values into List1
• and the y values into List2 .

Tap the left icon to draw the graph .

The shape of the graph appears to be either a hyperbola or a truncus.
The Classpad doesn’t offer regression for those shapes so we need to do a little manual processing.

Again, for the purposes of this exercise only, I’ve included Linear Regression on the original data for comparison

Linear Regression .

… … \$y = -4.54x + 33.4\$

… … \$r^2 = 0.8035\$ It is clear from the r2 value that the correlation is good, but could be better.

Hyperbola Regression

To model a hyperbola, \$X = \dfrac{1}{x}\$, replace the x-values in list1 with

… … … 1, 1/2, 1/3, 1/4, 1/5, 1/6 .

and do linear regression on those values compared to the y-values in list2 . The graph of X against y shows a very strong linear correlation

… … \$y = 30.20X + 5.17\$

… … \$r^2 = 0.9959\$

If we then substitute \$X = \dfrac{1}{x}\$ back in, this would give us the hyperbola:

… … \$y = \dfrac{30.20}{x} + 5.17\$

Truncus Regression

To model a truncus, \$X = \dfrac{1}{x^2}\$, replace the x-values in list1 with

… … … 1, 1/4, 1/9, 1/16, 1/25, 1/36 and do linear regression on those values compared to the y-values in list2 . The graph of X against y shows a strong correlation, but not as good as for the Hyperbola

… … \$y = 24.49X + 11.41\$

… … \$r^2 = 0.9477\$

If we then substitute \$X = \dfrac{1}{x^2}\$ back in, this would give us the truncus:

… … \$y = \dfrac{24.49}{x^2} + 11.41\$

Comparison of the results shows that the hyperbola is the best fit (biggest r2 value).

Here is the graph of the truncus against the original data: Note: We could have done Example 1 this way to force the quadratic regression to stick to the form y = ax2 + b (instead of y = ax2 + bx + c)

.