# Modelling and Regression

## Types of Graphs

We have studied these eight types of graphs (among others).

For the purposes of this topic we will assume there is no sideways translation.

## Regression

Often we obtain a set of data and wish to produce the equation of a line that fits that data. This process is called **Regression**. You may know it as **“line of best fit.”**

.

The first step is to decide which type of curve you will try to fit to the available data.

.

Look for:

- Linear Data (Linear)
- Is there cyclic behaviour (repeated curving up then down)? (Trigonometric)
- Are there signs of a turning point? (Quadratic)
- Are there signs of a point of inflection (change from concave to convex)? (Cubic)
- Is the graph increasing but with steadily decreasing gradient? (Square root, Cube root)
- Does the graph appear to increase but approach an asymptote? (Exponential)
- Is the graph increasing and with steadily increasing gradient? (Quadratic, Cubic, Exponential)
- Does the graph appear to decrease to an asymptote? (Exponential, Hyperbola, Truncus)
- Does the graph appear to have a vertical asymptote? (Hyperbola, Truncus)

**Note:**

- Often there will be several possible curves that could fit the available data.
- The question may specify which curve to use.
- If the question / situation does not specify the curve to be used then trial and error must be used to find the curve that gives the best fit (measured by the r
^{2}value).

.

#### Example (by hand)

The data in the following table fits one of these rules. Find the equation which best models this data.

First sketch the data points and observe!!

The points appear to fit the pattern of the square root graph.

We conclude our data will probably fit a curve with the equation: $y=a \sqrt{x}+b$ where **a** and **b** are unknown constants

Based on this observation, rework the table to include a row for $X = \sqrt{x}$

Now sketch the points $(X, \; y)$

- the new points produce a straight line (or a strongly correlated linear regression line) so the correct rule has been chosen.

Draw in a linear "line of best fit" $y = aX + b$ to get a linear model for the data.

- Use this to get values for
**a**and**b**. - These constants are then the same for the original equation.

Using the points $(0, \; 0)$ and $(2,\; 5)$ gives us

- a gradient of 2.5 and
- a y-intercept of 0

so the equation of the straight line is: $y=2.5X$

The equation of a regression line fitting our original data can then be found by replacing **X** with $\sqrt{x}$

Hence our line of best fit for this data is given by: $y=2.5 \sqrt{x}$

Plot this equation over the original points to check how closely the curve “fits.”

## Regression on the CLasspad

This process of regression can be performed quite easily on the Classpad Calculator.

The concept of the process stays the same but the calculator does all the calculations for us.

.