Transforming Data for Non-Linear Relationships
Apply logarithmic transformations to linearize exponential and power function relationships. Interpret the LSRL on transformed data in the original scale. Compare the fit of linear and transformed models using residual plots.
A lesson of AP Statistics, in Exploring Two-Variable Data, about 10 minutes.
Transformations for Nonlinear Relationships
By the end of this lesson, you will be able to apply logarithmic and power transformations to linearize curved data, interpret the resulting regression equation in the original units, and decide which transformation is appropriate.
When Linear Models Fail
If the residual plot shows a curved pattern, the relationship between x and y is nonlinear. Two common nonlinear patterns in AP Statistics:
-
Exponential growth/decay: y grows (or shrinks) by a constant percentage per unit of x → use a log transformation on y
-
Power relationship: y grows proportionally to a power of x → use log transformations on both x and y
Exponential Model: Log Transformation of y
Model: $y = ab^x$ (or equivalently $y = ae^{kx}$)
Transformation: take $\log(y)$ (natural log or log base 10 — be consistent)
$$\log(y) = \log(a) + x\log(b)$$
This is a linear equation in $x$ and $\log(y)$. If you plot $\log(y)$ vs. $x$ and get a linear pattern, an exponential model is appropriate.
Steps:
- Compute $\log(y_i)$ for each observation
- Fit LSRL: $\widehat{\log(y)} = a' + b'x$
- Back-transform to get the prediction in original units: $\hat{y} = 10^{a' + b'x}$
Interpreting the back-transformed equation:
If $\widehat{\log(y)} = 0.5 + 0.2x$, then $\hat{y} = 10^{0.5} \cdot (10^{0.2})^x \approx 3.16 \cdot 1.585^x$
"Each 1-unit increase in x is associated with a multiplicative factor of $10^{0.2} \approx 1.59$ in predicted y." (59% increase in y per unit of x)
Power Model: Log Transformation of Both Variables
Model: $y = ax^b$
Transformation: take $\log(y)$ AND $\log(x)$
$$\log(y) = \log(a) + b\log(x)$$
This is a linear equation in $\log(x)$ and $\log(y)$. If you plot $\log(y)$ vs. $\log(x)$ and get a linear pattern, a power model is appropriate.
Back-transforming: If LSRL gives $\widehat{\log(y)} = a' + b'\log(x)$, then $\hat{y} = 10^{a'} \cdot x^{b'}$