Transforming Data to Meet Normality Assumption
Transforming Data to Achieve Normal Residuals
The regression normality assumption concerns the errors around the conditional mean, not the marginal distribution of Y.
A skewed residual histogram or a curved normal Q-Q plot is evidence to investigate possible non-normal errors, not proof: a finite sample from normal errors can show either pattern.
A residual-versus-fitted plot addresses different questions, such as curvature in the mean or changing spread. Consider these diagnostics together and check them again after fitting any transformed-response model.
Choosing a transformation
Choose a response scale in light of the relationship between the conditional mean and spread, and make sure the transformation is defined for every observed response:
Left: the blue points are the eleven observations in the chart. The dashed curve is the fitted line from the right panel mapped back to the original scale of Y. Right: the same eleven observations after the response transformation, with the solid least-squares line fitted on the transformed scale (intercept 1.5853, slope 0.4835 per hour). The transformed-scale residuals do not alternate in sign; they range from about −0.040 to +0.024 transformed units, with no systematic widening over time.
- For a right-tailed response with Y>0, a log transformation can be a useful first attempt when the conditional standard deviation is approximately proportional to the conditional mean and a multiplicative-error model with a reasonably stable log-scale error distribution is plausible. A long tail or widening spread alone does not guarantee that logging will stabilize variance. Refit and inspect the new residuals.
- For nonnegative counts, Y≥0, the square-root transformation is defined. It can stabilize variance when the variance grows roughly in proportion to the mean, as in a Poisson-style model.
- For proportions strictly between 0 and 1, a logit transformation is one option; exact boundary values require separate, justified handling.
- For a positive response with an unclear transformation shape, the Box–Cox family is one option:
This family requires Y>0 for every observation. A model criterion such as profile likelihood commonly guides the choice of λ; after selecting it, inspect the residual diagnostics rather than treating the criterion as proof that the errors are normal. Here λ=1 gives Y−1, an additive shift; λ=0.5 is an affine rescaling of Y; and λ=0 gives ln(Y).
Worked example
In the displayed bacterial-count series, all responses are positive and the counts rise in an approximately multiplicative pattern over time.
Plotting ln(Y) against time can turn such an exponential-shaped mean trend into a near-linear one. That change in mean shape does not by itself establish normal, constant-variance errors.
Inspect the residual-versus-fitted plot and a Q-Q plot or histogram on the log scale; any skew or curvature is evidence to investigate, not proof of a violated assumption.
Bacterial Count Over Time (Raw Scale)
When predictions are made on the log scale, back-transforming a fitted log value gives a prediction on the original scale, but its interpretation depends on the error distribution and the target (for example, a conditional median versus a conditional mean). A mean prediction may require a correction for log-scale variability.
All observed values of the response Y are positive. The response has a long right tail, and a residual-versus-fitted plot shows spread widening as fitted means increase. The conditional standard deviation is approximately proportional to the conditional mean, which is consistent with multiplicative errors; the distribution of errors on the log scale still needs to be checked. Which response transformation is a reasonable first attempt?
A regression of bacterial count Y on time (the same kind of skewed data shown in the chart) is refitted with Y replaced by a Box–Cox transformation. A model criterion such as profile likelihood selects λ=0.3, after which the residuals are checked. Using Y(λ)=λYλ−1, compute the transformed value of an observation with Y=89 (thousand CFU/mL), to two decimal places.
Give your answer in Box–Cox transformed units, with Y expressed in thousand CFU/mL.
Left: the blue points are the eleven observations in the chart. The dashed curve is the fitted line from the right panel mapped back to the original scale of Y. Right: the same eleven observations after the response transformation, with the solid least-squares line fitted on the transformed scale (intercept 1.5853, slope 0.4835 per hour). The transformed-scale residuals do not alternate in sign; they range from about −0.040 to +0.024 transformed units, with no systematic widening over time.
Bacterial Count Over Time (Raw Scale)