02.52classpad

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:

02.52clsspdeg1a.gif

.

Solution

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

.

  • Tap the left icon to draw the graph.
02.52clsspdeg1c.gif

.

  • 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:
02.52clsspdeg1b.gif

.

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:
02.52clsspdeg1d.gif

.

  • 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:
02.52clsspdeg1e.gif

.

  • 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:

.

Quadratic Regression:

02.52clsspdeg1h.gif

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

… … $r^2 = 0.999993$

.

Cubic Regression:

02.52clsspdeg1i.gif

.
… … $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.

02.52clsspdeg1j.gif

.

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:

02.52clsspdeg2a.gif

Solution

Go to the Statistics Page.

  • Enter the x values into List1
  • and the y values into List2
02.52clsspdeg2b.gif

.

Tap the left icon to draw the graph

02.52clsspdeg2c.gif

.

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

02.52clsspdeg2d.gif

.

… … $y = -4.54x + 33.4$

… … $r^2 = 0.8035$

02.52clsspdeg2e.gif

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

02.52clsspdeg2f.gif

.

and do linear regression on those values compared to the y-values in list2

02.52clsspdeg2g.gif

.

02.52clsspdeg2h.gif

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

02.52clsspdeg2i.gif

and do linear regression on those values compared to the y-values in list2

02.52clsspdeg2j.gif

.

02.52clsspdeg2k.gif

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:

02.52clsspdeg2l.GIF

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)

.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License