Resources For Teachers For Tutors For Students & Parents AI New Books Pricing
Year 12 Maths - General (Unit 3 & Unit 4) Investigating and modelling linear associations

Data transformations

20 practice questions 0 video lessons Theory + worked examples

Straighten curved data with data transformations in Year 12 VCE General Mathematics. Water flow through an irrigation pipe near Shepparton grows with the square of its diameter, and an e-bike loses value quickly before levelling off. A straight line fits neither, but squaring, logging or taking reciprocals of one variable can make the pattern linear.

You will calculate squared, log and reciprocal values, read the shape of a scatterplot, and use the circle of transformations to pick a transformation for \(x\) or \(y\). You will compare \(r\) before and after and use residual plots to confirm the result, ready to fit and use a least squares line on the transformed data.

Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

A data transformation can turn a curved scatterplot into a straight one. This Year 12 General Mathematics guide for students in Victoria shows how to apply square, log and reciprocal transformations to one axis, choose them with the circle of transformations, and check the result with \(r\) and residual plots.

Many scatterplots curve. A data transformation replaces the values on one axis with new values so that the transformed points lie close to a straight line. The transformations used are the square (\(x^2\) or \(y^2\)), the logarithm base \(10\) (\(\log x\) or \(\log y\)) and the reciprocal (\(\dfrac{1}{x}\) or \(\dfrac{1}{y}\)). Only one variable is transformed at a time; the other keeps its original values.

The shape of the scatterplot decides which transformations can work. The circle of transformations matches each of four curved shapes to its transformations. Squaring stretches large values, so it straightens a curve that is flattening out along that axis; log and reciprocal squash large values, so they straighten a curve that is getting steeper along that axis.

To check whether a transformation has worked, compare Pearson's correlation coefficient \(r\) before and after (closer to \(1\) or \(-1\) means more linear) and look at the residual plot: a curved pattern should become random scatter.

Key idea. Read the shape (increasing or decreasing, levelling off or getting steeper), find it on the circle of transformations, and apply one of its transformations to \(x\) or \(y\). Then confirm with \(r\) and the residual plot.
The circle of transformationsA circle centred on the axes. Each quarter of the circle is the shape of a scatterplot, with the transformations that can straighten it: top right (decreasing, curving down) x squared or y squared; top left (increasing, levelling off) y squared, log x or 1 over x; bottom left (decreasing, levelling off) log x, 1 over x, log y or 1 over y; bottom right (increasing, getting steeper) x squared, log y or 1 over y. x y 1 x², y² 2 y² log x, 1/x 3 log x, 1/x log y, 1/y 4 x² log y, 1/y
The circle of transformations. Each quarter of the circle is the shape of a scatterplot; the transformations beside it can straighten that shape. For example, data that increase and level off (quadrant 2) can be straightened with \(y^2\), \(\log x\) or \(\dfrac{1}{x}\).
x y 1 2 3 4 5 6 20 40 60 80
After: y against x squaredThe same six points plotted against x squared lie on a straight line. x² y 10 20 30 20 40 60 80
Before: \(y\) against \(x\) curves upwards (\(r \approx 0.979\)). After squaring \(x\), the points lie on a straight line (\(r \approx 1.000\) to three decimal places).

The six transformations, each applied to one axis only:

\[x \to x^2, \quad x \to \log x, \quad x \to \dfrac{1}{x} \qquad \text{or} \qquad y \to y^2, \quad y \to \log y, \quad y \to \dfrac{1}{y}\]
x→x2,logx,1x

Logarithms are base \(10\): \(\log x\) is the power of \(10\) that gives \(x\).

\[\log 10^k = k, \qquad \log 1000 = 3, \qquad \log 1 = 0\]
log10k=k

Circle of transformations (shape of the scatterplot and the transformations that can linearise it):

\[\begin{array}{ll} \text{1: decreasing, curving down} & x^2,\ y^2 \\ \text{2: increasing, levelling off} & y^2,\ \log x,\ \dfrac{1}{x} \\ \text{3: decreasing, levelling off} & \log x,\ \dfrac{1}{x},\ \log y,\ \dfrac{1}{y} \\ \text{4: increasing, getting steeper} & x^2,\ \log y,\ \dfrac{1}{y} \end{array}\]
quadrant 2: y2,logx,1x
Domain check. \(\log x\) and \(\dfrac{1}{x}\) need every \(x\)-value to be positive (\(\log 0\) and \(\dfrac{1}{0}\) do not exist). The same goes for \(y\) with \(\log y\) and \(\dfrac{1}{y}\).

Linearising data with a transformation

  1. Describe the shape. Is the scatterplot increasing or decreasing? Is it levelling off or getting steeper?
  2. Use the circle. Find the matching quadrant and list its transformations.
  3. Transform one axis. Calculate the new values (for example \(\log x\) for every \(x\)) in a new row of the table or a new list on your calculator. Leave the other variable unchanged.
  4. Compare \(r\). Find \(r\) for the original and the transformed data. The transformation whose \(r\) is closest to \(1\) in size gives the most linear plot.
  5. Check the residual plot. Random scatter about zero confirms the transformed data are linear; a remaining pattern means the transformation has not fully worked.
Example 1 — Transformed values
Find \(x^2\), \(\log x\) (correct to two decimal places) and \(\dfrac{1}{x}\) for \(x = 4\), \(8\), \(20\), \(50\) and \(1000\).
Solution

Apply each transformation to every value. Three of them worked in full:

\(20^2\)\(=\)\(400\)
\(\log 20\)\(\approx\)\(1.3010\)
\(\log 20\)\(\approx\)\(1.30\)
\(\log 1000\)\(=\)\(\log 10^3\)
\(\log 1000\)\(=\)\(3\)
\(\dfrac{1}{8}\)\(=\)\(0.125\)
log1000=3
\(x\)\(4\)\(8\)\(20\)\(50\)\(1000\)
\(x^2\)\(16\)\(64\)\(400\)\(2500\)\(1\,000\,000\)
\(\log x\)\(0.60\)\(0.90\)\(1.30\)\(1.70\)\(3.00\)
\(\dfrac{1}{x}\)\(0.25\)\(0.125\)\(0.05\)\(0.02\)\(0.001\)

Squaring makes large values much larger, while log and reciprocal shrink them: \(1000\) becomes \(1\,000\,000\), \(3\) and \(0.001\). That is why they straighten different shapes.

Example 2 — Choosing from the shape
A Melbourne bike shop recorded the resale value (dollars) of e-bikes of different ages (years). Which transformations could linearise the data? Which would not?
Solution

Read the shape of the scatterplot, then use the circle of transformations.

age value 1 2 3 4 5 6 7 1000 2000 3000
\(\text{shape}\)\(\)\(\text{decreasing, levelling off}\)
\(\text{quadrant}\)\(=\)\(3\)
\(\text{transformations}\)\(\)\(\log x,\ \dfrac{1}{x},\ \log y,\ \dfrac{1}{y}\)
quadrant 3

The value falls quickly at first and then levels off, so the shape is quadrant 3. Any one of \(\log x\), \(\dfrac{1}{x}\), \(\log y\) or \(\dfrac{1}{y}\) could linearise the data (all ages are positive, so log and reciprocal can be used). \(x^2\) and \(y^2\) would not help: they belong to other quadrants and would make this curve bend more.

Example 3 — Comparing two transformations by r
A Shepparton irrigation supplier measured the flow rate through pipes of different diameters. The scatterplot of \(y\) against \(x\) increases and gets steeper. Find \(r\) for \(y\) against \(x\), for \(y\) against \(x^2\), and for \(\log y\) against \(x\), each correct to three decimal places. Which transformation linearises the data better?
Diameter \(x\) (cm)\(2\)\(3\)\(4\)\(5\)\(6\)\(7\)
Flow \(y\) (L/min)\(3.4\)\(7.0\)\(12.6\)\(20.3\)\(28.5\)\(39.6\)
Solution

Increasing and getting steeper is quadrant 4: \(x^2\), \(\log y\) or \(\dfrac{1}{y}\). Transform, then find \(r\) with technology:

\(x^2\)\(\)\(4,\ 9,\ 16,\ 25,\ 36,\ 49\)
\(\log y\)\(\approx\)\(0.531,\ 0.845,\ 1.100,\ 1.307,\ 1.455,\ 1.598\)
\(r \ (y \text{ against } x)\)\(\approx\)\(0.985\)
\(r \ (y \text{ against } x^2)\)\(\approx\)\(1.000\)
\(r \ (\log y \text{ against } x)\)\(\approx\)\(0.987\)
r≈1.000

Both transformations raise \(r\) from \(0.985\), but \(y\) against \(x^2\) gives \(r \approx 1.000\), much closer to \(1\) than \(0.987\). The \(x^2\) transformation linearises the data better, which makes sense: the flow depends on the area of the pipe's opening, and area depends on the diameter squared.

Example 4 — Residual plots before and after
A Ballarat driving school recorded the hours of practice \(x\) and the score \(y\) on a hazard-perception test for seven learners. The scatterplot increases and levels off. A least squares line was fitted to \(y\) against \(x\), and another to \(y\) against \(\log x\). Use \(r\) and the residual plots to decide whether the \(\log x\) transformation has linearised the data.
Hours \(x\)\(1\)\(2\)\(4\)\(6\)\(8\)\(12\)\(16\)
Score \(y\)\(22\)\(31\)\(40\)\(46\)\(49\)\(55\)\(58\)
Solution

Increasing and levelling off is quadrant 2, so \(\log x\) is a sensible choice. Compare:

\(r \ (y \text{ against } x)\)\(\approx\)\(0.928\)
\(r \ (y \text{ against } \log x)\)\(\approx\)\(1.000\)
r≈1.000
Residual plot, y against xResiduals negative, then positive, then negative: a curved pattern. x residual 4 8 12 16 -8 -4 0 4
Residual plot, y against log xResiduals scattered above and below zero with no pattern. log x residual 0.4 0.8 1.2 -0.5 0 0.5

For \(y\) against \(x\), the residuals are negative, then positive, then negative again: a curved pattern, so a linear model does not suit the original data even though \(r \approx 0.928\). For \(y\) against \(\log x\), the residuals are small and randomly scattered about zero, and \(r\) rises to \(1.000\). The \(\log x\) transformation has linearised the data.

Common pitfalls

Transform one axis only. Each transformation replaces either the \(x\)-values or the \(y\)-values, never both. Plot the transformed variable against the original other variable.
Match the quadrant carefully. \(x^2\) suits shapes that get steeper as \(x\) increases (quadrant 4) or curve down (quadrant 1), but it makes a levelling-off curve (quadrant 2) bend even more. Read the circle, do not guess.
Compare \(r\) by size and check the residuals. For a decreasing pattern \(r\) is negative, and a reciprocal can flip its sign, so compare \(|r|\). A high \(|r|\) alone does not prove linearity; the residual plot must show no pattern.

Frequently asked questions

What is a data transformation in statistics?

It is replacing the values of one variable with their squares, logarithms (base 10) or reciprocals so that a curved scatterplot becomes linear. Only one axis is transformed at a time.

What is the circle of transformations?

It is a circle drawn on a set of axes. Each quarter shows a curved scatterplot shape and lists the transformations that can straighten it, for example log x, 1/x, log y or 1/y for data that decrease and level off.

How do you know which transformation to use?

Describe the shape: increasing or decreasing, and levelling off or getting steeper. Find that shape on the circle of transformations, try its transformations, and keep the one whose r is closest to 1 in size and whose residual plot shows no pattern.

Which transformation straightens data that increase and level off?

Data that increase and level off match quadrant 2 of the circle: y squared, log x or 1/x can linearise them.

How can you tell if a transformation has worked?

The size of r should be closer to 1 for the transformed data, and the residual plot for the transformed data should show random scatter about zero instead of a curve.

Why can't you take log x when x is 0?

There is no power of 10 that gives 0, so log 0 does not exist, and 1/0 is undefined too. Log and reciprocal transformations need all the values being transformed to be positive.