Our best linear tools (slope, correlation, and the least-squares regression line) only work on straight lines, so when a scatterplot curves, we rescale the axes until the points line up straight.
1
Straightening Curves by Rescaling Axes
Before fitting a line to curved data, we want to see why a relationship curves in the first place and how rescaling one axis straightens it out.
Straightening Curves by Rescaling Axes
Text solution
Stretch the slow axis (X to X2)Squaring the table widths on the horizontal axis stretches the X values out to two dimensions so they grow at the same rate as the areas on the vertical axis.
Squish the fast axis (Y to Y)Taking the square root of the areas on the vertical axis pulls the Y values back down to one dimension to match the original widths.
Either rescaling turns the upward curve of patio table areas into a straight line where equal steps across give equal steps up.
2
The Ladder of Powers
When we don't already know the exact formula behind a curved scatterplot, we use an ordered list of powers and roots that stretch or squish an axis by different amounts.
The Ladder of Powers
stretch big values outx3,x2⟵original scalex⟶squish big values inx,logx,−x1
Moving an axis up the Ladder of Powers stretches the gaps between 1,10, and 100 apart, while moving down the ladder squishes those large values back together until the plotted points line up straight.
Moving down the ladder pulls big values in and moving up stretches them out, so you can straighten a curve either by pulling the fast axis in or stretching the slow axis out.
3
Log Transformations and Power Models
Many real-world quantities grow by multiplying at each step rather than following a simple square or cube, so we need a transformation that turns multiplication into the equal additions of a straight line.
Log Transformations and Power Models
normal ruler
1
2
3
4
+1
+1
+1
log ruler
1
10
100
1000
×10
×10
×10
Text solution
Turn multiplication into additionTaking the base-10 logarithm of values that multiply by 10 at each step replaces them with exponents that add 1 at each step.
log101,10,100,1000(×10 each step)0,1,2,3(+1 each step)
Take the log of both sides of a power modelApplying a logarithm to Y=a⋅Xb splits the product into a sum and brings the exponent b down in front of log(X).
So plotting log(Y) against log(X) straightens any power relationship Y=a⋅Xb into a line whose slope is the exponent b.
Taking the log of both variables turns any power curve into a straight line whose slope matches the exponent.
4
Choosing a Transformation with Residual Plots and r2
When an exponential model (logY versus X) and a power model (logY versus logX) are both candidates for straightening an upward curve, we need a way to test which transformation actually straightened the data.
Choosing a Transformation with Residual Plots and r²
0
10
20
30
100
200
300
exponential model
logY vs. X
power model
logY vs. logX
Volume(board feet)
Diameter(in)
Candidate A
r2=91.4%
log(Volume) vs. Diameter
residual
10
20
30
−0.4
−0.2
0.2
0
Diameter
Candidate B
r2=98.8%
log(Volume) vs.log(Diameter)
residual
0.8
1
1.2
1.4
−0.4
−0.2
0.2
0
log(Diameter)
Text solution
Check the residual plots firstCheck whether the residuals scatter randomly around the zero line, which eliminates the exponential model because its residual plot still bends in a clear curve.
Candidate A (log(Volume) vs. Diameter):curved residuals (eliminated)⟶Candidate B (log(Volume) vs. log(Diameter)):random scatter
Confirm and break ties with r2Compare r2 only after the residual plot shows random scatter to see which model explains more variation in the transformed response.
r2power=98.8%>r2exponential=91.4%
So the power model (log(Volume) versus log(Diameter)) is the better fit, explaining 98.8% of the variation in log(Volume). On a test, always state both the random scatter in the residual plot and the transformed name of the response variable (log(Volume), not just Volume) when explaining r2.
5
Making Predictions with Transformed Models
Once we have a regression line in transformed units, we want to plug in a value of X and predict Y in its original real-world units.
Making Predictions with Transformed Models
1
2
3
4
5
6
7
8
9
10
log10(Price)
Age(years)
Age=5 years→Predicted Price=?
To undo a transformation on the response variable Y at the end of a calculation, apply the inverse operation to the predicted value:
Ylog10(Y)ln(Y)⟶(answer)2⟶10answer⟶eanswer
First, here is the prediction when only Y is logged, for a 5-year-old car in Predicted log10(Price)=4.5−0.1(Age).
Text solution
Plug in untransformed X and calculateBecause Age has no log on it in the equation, substitute Age=5 directly to find the predicted log price.
Predicted log10(Price)=4.5−0.1(5)=4.5−0.5=4.0
Untransform Y at the endUndo the base-10 logarithm on Price by raising 10 to the result.
Predicted Price=104.0=$10,000
So a 5-year-old car has a predicted price of $10,000.
Now here is the prediction when both X and Y are logged, for a tree with a diameter of 100 inches in Predicted log10(Volume)=−1.2+2.5⋅log10(Diameter).
Text solution
Transform X before plugging inBecause Diameter is inside a base-10 log in the equation, take the log of 100 inches before substituting.
log10(Diameter)=log10(100)=2
Substitute and calculatePlug log10(Diameter)=2 into the regression equation to get the predicted log volume.
Predicted log10(Volume)=−1.2+2.5(2)=−1.2+5.0=3.8
Untransform Y at the endUndo the base-10 logarithm on Volume by raising 10 to the power of 3.8.
Predicted Volume=103.8≈6,310 board feet
So a tree with a 100-inch diameter has a predicted volume of about 6,310 board feet of lumber.
Key concepts
Straightening a curve means matching the scales of the two axes so equal steps in X pair with equal steps in Y. If a scatterplot shoots upward on the right because Y is growing much faster than X (like table area Y=X2), either squish Y down the Ladder of Powers (Y or logY) or stretch X up the ladder (X2); if the graph flattens out on the right because X is growing much faster than Y, do the opposite and squish X down (logX or X) or stretch Y up (Y2).
For growth driven by multiplication, pick your logarithm by asking which variable is adding and which is multiplying. When X adds and Y multiplies (like hours +1 and bacteria ×10), log only Y and plot log(Y) versus X. When X multiplies and Y adds (like income ×10 and happiness +2), log only X and plot Y versus log(X). When both X and Y multiply in a power relationship Y=a⋅Xb (like doubling width X multiplying area Y by 4), log both variables:
log(Y)=log(a)+b⋅log(X)
The exponent b drops down to become the slope of the log(Y) versus log(X) line (so a slope of 0.5 tells you Y=a⋅X0.5). When comparing candidate transformations, always check the residual plot first: a leftover curve in the residuals eliminates a model even if its r2 is over 90%, while r2 breaks the tie between models whose residuals scatter randomly around zero. Finally, when predicting with a transformed equation, let the equation itself tell you what to transform: apply a log or root to X before plugging in only if X has that function in the formula, undo the transformation on Y at the end (Y→(answer)2,log10(Y)→10answer,ln(Y)→eanswer) only if Y has a function on the left side, and leave a variable untouched whenever it has no function on it in the equation (such as Age in Predicted log10(Price)=4.5−0.1(Age) or Happiness in Predicted Happiness=−3+2⋅log10(Income)).
6
Practice
1
A scatterplot starts out rising steeply on the left and then flattens out toward the right, barely growing as X becomes very large. Which variable is growing much faster on the right end, and what are the two ways to straighten this curve using the Ladder of Powers?
Look at the right end of the graph: which axis is covering huge distances while the other axis barely moves?
Don't confuse this flattening curve with an upward-shooting curve, which would lead you to squish Y (logY or Y) or stretch X (X2) and bend the graph even further. Here, X is growing fast to the right while Y is barely growing. Using the Ladder of Powers, you can either move X down the ladder (taking logX or X) to squish the large X values back in, or move Y up the ladder (taking Y2) to stretch the large Y values up to match X.
2
Three datasets follow different growth patterns:
Dataset A: As X increases by 1 at each step (1,2,3,4), Y multiplies by 3 at each step (5,15,45,135).
Dataset B: As X multiplies by 10 at each step (10,100,1,000,10,000), Y increases by 4 at each step (12,16,20,24).
Dataset C: Every time X doubles (1,2,4,8), Y multiplies by 8 (1,8,64,512).
For each dataset, state which variable(s) you should take the logarithm of to get a straight line, and explain why.
For each dataset, ask which variable is already changing by equal additions and which variable is changing by multiplication.
A straight line pairs equal additions in X with equal additions in Y, and a logarithm turns multiplication into addition. Watch out for logging the variable that is already adding (such as logging X in Dataset A or Y in Dataset B), or logging only Y in Dataset C while leaving the ×2 steps in X unlogged:
Dataset ATransform Y to log(Y) and leave X alone (plot log(Y) versus X), because X is already adding (+1) while Y is multiplying (×3).
Dataset BTransform X to log(X) and leave Y alone (plot Y versus log(X)), because Y is already adding (+4) while X is multiplying (×10).
Dataset CTransform both variables (plot log(Y) versus log(X)), because both X (×2) and Y (×8) are multiplying in a power relationship.
3
A biologist studies the relationship between body mass X (in kilograms) and metabolic rate Y (in kilocalories per day) across mammal species. Plotting log10(Y) against log10(X) straightens the data and produces the least-squares regression line:
Predicted log10(Y)=1.85+0.75⋅log10(X)
What does the slope of 0.75 tell you about the relationship between the original variables X and Y? What would the slope of this log-log line be if Y were proportional to the square root of X instead?
The exponent is the slope itself. Don't raise 10 to it the way you undo the logged intercept log10(a)=1.85:100.75≈5.62 is the factor Y multiplies by when X multiplies by 10, not the exponent.
When you take the log of both sides of Y=a⋅Xb, where does the exponent b end up in the linear equation?
When both Y and X are logged, the exponent b of a power relationship (Y=a⋅Xb) drops down in front of log10(X) to become the slope of the line: log10(Y)=log10(a)+b⋅log10(X). (The exponent is the slope itself. Don't raise 10 to it the way you undo the logged intercept log10(a)=1.85:100.75≈5.62 is the factor Y multiplies by when X multiplies by 10, not the exponent.) A slope of 0.75 tells us that metabolic rate follows a power relationship with exponent 0.75, meaning Y=a⋅X0.75. If Y were proportional to the square root of X (X=X0.5, not X2 which would give a slope of 2), the slope of the log10(Y) versus log10(X) line would be 0.5.
4
An agronomist models crop yield Y (in grams) from the amount of fertilizer X (in milligrams) using the transformed regression equation:
Predicted Yield=12+15⋅log10(Fertilizer)
Predict the crop yield when 1,000 milligrams of fertilizer are applied. Explain why you do not raise 10 to your answer at the end.
Plugging 1,000 straight in without logging it first gives the wrong value 12+15(1,000)=15,012 grams.You do not raise 10 to the power of 57 at the end (which would give 1057 grams) because the response variable Yield (Y) on the left side of the equation was never logged, so the output is already in real-world grams.
Check both sides of the equation: which variable is inside log10, and which variable is left in its original units?
Because Fertilizer (X) is inside a base-10 log, transform X before plugging it in: log10(1,000)=3 (plugging 1,000 straight in without logging it first gives the wrong value 12+15(1,000)=15,012 grams). Substitute log10(1,000)=3 into the equation:
Predicted Yield=12+15(3)=12+45=57 grams
You do not raise 10 to the power of 57 at the end (which would give 1057 grams) because the response variable Yield (Y) on the left side of the equation was never logged, so the output is already in real-world grams: 57 grams.
5
An engineer transforms both car speed X (in km/h) and braking distance Y (in meters) using base-10 logarithms. The computer regression output for predicting log10(Braking Distance) gives:
Constant (Intercept): −0.5
log10(Speed):1.5
Write the least-squares regression equation and use it to predict the braking distance for a car traveling at 100 km/h.
Be careful to keep log10 on both variable names and not swap the intercept and slope (which would give 1.5−0.5⋅log10(Speed)).
Write the equation with log10 on both variables, then follow the three steps: transform X before plugging in, calculate, and untransform Y at the end.
Be careful to keep log10 on both variable names and not swap the intercept and slope (which would give 1.5−0.5⋅log10(Speed)):
Transform X before plugging inlog10(100)=2 (plugging 100 straight in without taking the log gives −0.5+1.5(100)=149.5, which leads to 10149.5 meters).
Untransform Y at the endDon't stop at the logged value of 2.5 meters or square it to get 6.25 meters; undo the base-10 log on Braking Distance by raising 10 to the result:
Predicted Braking Distance=102.5≈316.2 meters
6
Find the predicted value of Y in original units for each of the following transformed models: (a) Predicted Time=1.2+0.4(Length), where Time is in seconds and Length is 7 feet. (b) Predicted ln(Cells)=2.0+0.5(Hours), where Cells is the number of cells and Hours is 6 hours.
Don't stop at 4.0 seconds or take the square root again to get 2 seconds; undo the square root on Time by squaring the result.
Neither predictor X has a function on it; once you calculate the left side, use the inverse operation that matches Y in part (a) and ln(Y) in part (b).
(a) Length is not transformed, so plug 7 straight in:
Predicted Time=1.2+0.4(7)=1.2+2.8=4.0
Don't stop at 4.0 seconds or take the square root again to get 2 seconds; undo the square root on Time by squaring the result:
Predicted Time=4.02=16 seconds
(b) Hours is not transformed, so plug 6 straight in:
Predicted ln(Cells)=2.0+0.5(6)=2.0+3.0=5.0
Don't stop at 5.0 cells or use base 10 to get 105.0=100,000 cells; undo the natural log (ln) on Cells by raising e to the result:
Predicted Cells=e5.0≈148.4 cells
7
To straighten a curved relationship between planet distance X and orbital period Y, a student runs three candidate transformations on the computer:
Model 1 (Y versus X): r2=96.5%, and the residual plot shows a clear U-shaped curve.
Model 2 (logY versus X): r2=91.2%, and the residual plot shows random scatter above and below the zero line.
Model 3 (logY versus logX): r2=99.4%, and the residual plot shows random scatter above and below the zero line.
Why is Model 1 eliminated even though its r2 is higher than Model 2's, and which of the three models is the best fit overall? State the complete justification in context.
Check the three candidates using their residual plots first, then use r2 to choose between the remaining models.
Don't compare r2 values before checking the residual plots (which would mistakenly keep Model 1 ahead of Model 2 because 96.5%>91.2%). Always check the residual plot first: Model 1 must be eliminated despite its high r2 of 96.5% because the clear U-shaped curve in its residual plot shows the transformed data is still curved. Between the two models with random residuals, Model 3 (logY versus logX) is the best fit because its residual plot shows random scatter with no leftover curved pattern, and it has a higher r2 than Model 2 (99.4% versus 91.2%), meaning it explains a higher percentage of the variation in log(Orbital Period) (not original Orbital Period).