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

Modelling with transformed data

20 practice questions 0 video lessons Theory + worked examples

Put transformed data to work in Year 12 VCE General Mathematics. Once squaring, logging or taking reciprocals has straightened a scatterplot, a least squares line on the new values gives a curved model that fits the original data, such as the cost per person of a bus to Falls Creek, which drops sharply and then levels off as the group grows.

You will fit models like \(y = a + b\log x\) and \(\log y = a + bx\) with technology, then make predictions by transforming \(x\), substituting and undoing any change to \(y\). You will interpret \(b\) for a transformed variable, compare models using \(r^2\) and residuals, and remember that extrapolation stays risky.

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

Theory

After a transformation straightens the data, a least squares line on the transformed values becomes a powerful curved model. This Year 12 General Mathematics guide for students in Victoria shows how to fit models such as \(y = a + b\log x\), make predictions by transforming and undoing, interpret \(b\) and compare models with \(r^2\).

Once a transformation has straightened the data, a least squares line is fitted to the transformed data, in exactly the same way as before. If \(x\) was transformed, the model is \(y = a + bx^2\), \(y = a + b\log x\) or \(y = a + b \times \dfrac{1}{x}\). If \(y\) was transformed, it is \(y^2 = a + bx\), \(\log y = a + bx\) or \(\dfrac{1}{y} = a + bx\).

To fit the line with technology, make a new list of transformed values (for example \(\log x\) for every \(x\)) and use it in place of the original variable in the linear regression. The model is a straight line on the transformed axes and a curve on the original axes.

To make a prediction, transform the given \(x\) the same way, substitute, and if \(y\) was transformed, undo it at the end: square root for \(y^2\), \(10\) to the power for \(\log y\), reciprocal for \(\dfrac{1}{y}\). Predictions outside the range of the data are still extrapolation, and \(r^2\) for the transformed data compares how well different models fit.

Key idea. Fit \(y = a + bX\) with \(X\) the transformed \(x\), or \(Y = a + bx\) with \(Y\) the transformed \(y\). Predict by transforming, substituting, then undoing any transformation of \(y\).
Least squares line on the transformed datay plotted against log x lies close to the straight line y = 10.2 + 19.9 log x. log x y 0.4 0.8 1.2 10 20 30 40
Transformed axes: \(y\) against \(\log x\) is linear, so the least squares line \(y = 10.2 + 19.9\log x\) fits it well (\(r^2 \approx 0.999\)).
The same model on the original axesy plotted against x rises quickly then levels off; the model y = 10.2 + 19.9 log x is a curve through the points. x y 4 8 12 16 10 20 30 40
Original axes: the same model \(y = 10.2 + 19.9\log x\) is a curve that rises quickly and then levels off, matching the data.

Models after transforming \(x\) (fit \(y\) against the transformed values):

\[y = a + bx^2, \qquad y = a + b\log x, \qquad y = a + b \times \dfrac{1}{x}\]
y=a+blogx

Models after transforming \(y\) (fit the transformed values against \(x\)):

\[y^2 = a + bx, \qquad \log y = a + bx, \qquad \dfrac{1}{y} = a + bx\]
logy=a+bx

Undoing a transformation of \(y\) to give the prediction:

\[y = \sqrt{y^2}, \qquad y = 10^{\log y}, \qquad y = \dfrac{1}{1/y}\]
y=10logy
Interpreting \(b\). \(b\) is the change in the response for each increase of \(1\) in the transformed variable. For \(y = a + b\log x\), an increase of \(1\) in \(\log x\) means \(x\) is multiplied by \(10\), so each tenfold increase in \(x\) adds \(b\) to the predicted \(y\).

Fitting and using a model on transformed data

  1. Transform. Calculate the transformed values for the chosen variable (a new row or list).
  2. Fit. Use linear regression with the transformed variable in place of the original one. Write the model with the transformation shown, for example \(y = a + b\log x\).
  3. Predict. Transform the given \(x\) (if \(x\) was transformed), substitute, and calculate.
  4. Undo. If the model gives \(y^2\), \(\log y\) or \(\dfrac{1}{y}\), convert back to \(y\) before answering in context.
  5. Judge. Compare \(r^2\) with other models, check the residuals, and say whether the prediction is interpolation or extrapolation.
Example 1 β€” Predicting from an \(x^2\) model
A Geelong rug maker prices round wool rugs using the model \(\text{price} = 15 + 0.012 \times \text{diameter}^2\), with the price in dollars and the diameter in centimetres. Find the price of a rug of diameter \(150\) cm and of diameter \(300\) cm.
Solution

Square the diameter first (the model uses the transformed value), then substitute.

\(\text{diameter}^2\)\(=\)\(150^2\)
\(\text{diameter}^2\)\(=\)\(22500\)
\(\text{price}\)\(=\)\(15 + 0.012 \times 22500\)
\(\text{price}\)\(=\)\(15 + 270\)
\(\text{price}\)\(=\)\(285\)
\(\text{diameter}^2\)\(=\)\(300^2\)
\(\text{diameter}^2\)\(=\)\(90000\)
\(\text{price}\)\(=\)\(15 + 0.012 \times 90000\)
\(\text{price}\)\(=\)\(15 + 1080\)
\(\text{price}\)\(=\)\(1095\)
price=285

The \(150\) cm rug costs \(\$285\) and the \(300\) cm rug costs \(\$1095\). Doubling the diameter roughly quadruples the price, because the model uses the diameter squared (the amount of wool depends on the area).

Example 2 β€” Fitting \(y = a + b\log x\)
A Bendigo animal shelter recorded the number of online impressions of an advertisement and the number of adoption enquiries it received.
Impressions \(x\)\(10\)\(100\)\(1\,000\)\(10\,000\)\(100\,000\)
Enquiries \(y\)\(12\)\(19\)\(25\)\(33\)\(40\)
(a) Use technology to fit the least squares line \(y = a + b\log x\).
(b) Interpret \(b\).
(c) Predict the number of enquiries for \(5000\) impressions.
Solution

Each \(x\) is a power of \(10\), so \(X = \log x\) is exactly \(1, 2, 3, 4, 5\). Fit \(y\) against \(X\):

\(S_{XX}\)\(=\)\(10\)
\(S_{Xy}\)\(=\)\(70\)
\(b\)\(=\)\(\dfrac{S_{Xy}}{S_{XX}}\)
\(b\)\(=\)\(7\)
\(\bar{X}\)\(=\)\(3\)
\(\bar{y}\)\(=\)\(25.8\)
\(a\)\(=\)\(\bar{y} - b\bar{X}\)
\(a\)\(=\)\(4.8\)
\(y\)\(=\)\(4.8 + 7\log x\)
\(\log 5000\)\(\approx\)\(3.6990\)
\(y\)\(\approx\)\(4.8 + 7 \times 3.6990\)
\(y\)\(\approx\)\(4.8 + 25.893\)
\(y\)\(\approx\)\(30.69\)
y=4.8+7logx

(a) \(y = 4.8 + 7\log x\).

(b) Each increase of \(1\) in \(\log x\) means ten times as many impressions, so on average each tenfold increase in impressions adds about \(7\) enquiries.

(c) About \(31\) enquiries. Since \(5000\) is inside the data (\(10\) to \(100\,000\)), this is interpolation.

Example 3 β€” Undoing a \(\log y\) transformation
The weekly number of visitors \(y\) to a new Ballarat tourism website, \(x\) weeks after launch, is modelled by \(\log y = 1.8 + 0.15x\) for the first \(12\) weeks.
(a) Predict the number of visitors in week \(8\) and in week \(10\).
(b) What number of visitors does the model give at launch (\(x = 0\))?
Solution

Substitute \(x\) to get \(\log y\), then undo the log with \(y = 10^{\log y}\).

\(\log y\)\(=\)\(1.8 + 0.15 \times 8\)
\(\log y\)\(=\)\(1.8 + 1.2\)
\(\log y\)\(=\)\(3\)
\(y\)\(=\)\(10^{3}\)
\(y\)\(=\)\(1000\)
\(\log y\)\(=\)\(1.8 + 0.15 \times 10\)
\(\log y\)\(=\)\(3.3\)
\(y\)\(=\)\(10^{3.3}\)
\(y\)\(\approx\)\(1995.26\)
\(\log y\)\(=\)\(1.8\)
\(y\)\(=\)\(10^{1.8}\)
\(y\)\(\approx\)\(63.10\)
y=103=1000

(a) About \(1000\) visitors in week \(8\) and \(1995\) in week \(10\). The answer \(3.3\) is \(\log y\), not the number of visitors.

(b) About \(63\) visitors at launch. Notice the model multiplies visitors by the same factor each week, so it would grow very fast if extended well past week \(12\): extrapolation is risky.

Example 4 β€” A reciprocal model, compared by \(r^2\)
A Falls Creek bus company charges a group for a trip, shared equally. The table shows the cost per person for different group sizes.
People \(x\)\(1\)\(2\)\(4\)\(5\)\(10\)\(20\)
\(\dfrac{1}{x}\)\(1\)\(0.5\)\(0.25\)\(0.2\)\(0.1\)\(0.05\)
Cost per person \(y\) (\(\$\))\(631\)\(328\)\(182\)\(149\)\(91\)\(59\)
(a) Use technology to fit \(y = a + b \times \dfrac{1}{x}\), with \(a\) and \(b\) correct to two decimal places.
(b) Compare \(r^2\) for this model with \(r^2\) for a straight line fitted to \(y\) against \(x\).
(c) Predict the cost per person for a group of \(8\).
Solution

Use \(X = \dfrac{1}{x}\) (exact values in the table) as the explanatory variable:

\(S_{XX}\)\(=\)\(0.63\)
\(S_{Xy}\)\(=\)\(378.35\)
\(b\)\(=\)\(\dfrac{S_{Xy}}{S_{XX}}\)
\(b\)\(\approx\)\(600.56\)
\(\bar{X}\)\(=\)\(0.35\)
\(\bar{y}\)\(=\)\(240\)
\(a\)\(=\)\(\bar{y} - b\bar{X}\)
\(a\)\(\approx\)\(29.81\)
\(y\)\(\approx\)\(29.81 + 600.56 \times \dfrac{1}{x}\)
\(r^2 \ (y \text{ against } \tfrac{1}{x})\)\(\approx\)\(0.9999\)
\(r^2 \ (y \text{ against } x)\)\(\approx\)\(0.48\)
\(\dfrac{1}{8}\)\(=\)\(0.125\)
\(y\)\(=\)\(29.81 + 600.56 \times 0.125\)
\(y\)\(=\)\(29.81 + 75.07\)
\(y\)\(=\)\(104.88\)
y=29.81+600.56×1x

(a) \(y = 29.81 + 600.56 \times \dfrac{1}{x}\).

(b) The reciprocal model explains about \(99.99\%\) of the variation in cost per person, compared with only about \(48\%\) for the straight line, so it is far better.

(c) About \(\$104.88\) per person. As the group gets very large, \(\dfrac{1}{x}\) approaches \(0\), so the cost per person levels off near \(a = \$29.81\).

Common pitfalls

Transform before you substitute. In \(y = 4.8 + 7\log x\), substitute \(\log 5000\), not \(5000\). In \(y = a + bx^2\), square \(x\) first.
Undo a transformation of \(y\). A model for \(\log y\), \(y^2\) or \(\dfrac{1}{y}\) gives the transformed value. Convert back (\(10\) to the power, square root or reciprocal) before answering.
Interpret \(b\) per unit of the transformed variable. In \(y = a + b\log x\), \(b\) is not the change per unit of \(x\); it is the change for each tenfold increase in \(x\). Extrapolating a transformed model is just as risky as with a straight line.

Frequently asked questions

How do you fit a least squares line to transformed data?

Make a new list of the transformed values, such as log x for every x, and use it in place of the original variable in the calculator's linear regression. Write the model with the transformation, for example y = a + b log x.

How do you make a prediction from a log y model?

Substitute x to find log y, then undo the logarithm: y equals 10 to the power of that value. For example, log y = 3 gives y = 1000.

How do you interpret b in y = a + b log x?

An increase of 1 in log x means x is multiplied by 10, so b is the predicted change in y for each tenfold increase in x.

How do you compare a transformed model with a linear model?

Compare their r squared values: the model with the larger r squared explains more of the variation in the response. Also check that its residual plot shows no pattern.

Is extrapolation reliable with a transformed model?

No. A transformed model is still only supported inside the range of the data, and curved models such as log y can grow very quickly outside it.