Data transformations (log, square root)
When a variable is strongly skewed, applying a mathematical function to every value can make its distribution closer to normal, make relationships more linear, or even out variance across groups. Transformations are useful, but they change what your results mean.
Common transformations
| Transformation | Strength | Typical use |
|---|---|---|
| Square root, √x | Mild | Moderate right skew, counts |
| Log, log(x) | Strong | Strong right skew, multiplicative processes (income, concentrations, prices) |
| Reciprocal, 1/x | Very strong | Extreme right skew, rates such as time per task |
| Square, x² | Mild, opposite direction | Left skew |
Worked example: ozone levels
Daily ozone in R’s airquality data (116 days) is strongly right-skewed:
| Version | Skewness |
|---|---|
| Raw ozone | 1.24 |
| Square root | 0.52 |
| Log | −0.56 |
The square root roughly halves the skew. The log overshoots slightly into left skew. Even after the log, a normality test still flags a departure (p = .010). Transformations help, but they rarely produce a textbook bell curve, and the right choice depends on the data.
Interpreting log-transformed results
- Means: the back-transformed mean of logged data is the geometric mean, not the arithmetic mean.
- Group differences: a difference in log means back-transforms to a ratio (“about 30% higher”), not a difference in raw units.
- Regression with a logged outcome: a coefficient b means roughly a 100 × (eb − 1)% change in the outcome per unit of the predictor.
Before you transform
- Check whether you need to. With moderate samples, t-tests and regression are robust to mild skew (see the central limit theorem), and regression needs normal residuals, not a normal outcome.
- Consider alternatives: rank-based tests (non-parametric tests), robust standard errors, or a model suited to the outcome (Poisson for counts, logistic for yes/no).
- Handle zeros and negatives: log(0) is undefined. Adding a constant (log(x + 1)) works but the result depends on the constant chosen.
- Decide in advance, and report it. Trying transformations until p < .05 is p-hacking.
Reporting
Because ozone concentrations were strongly right-skewed (skewness = 1.24), they were log-transformed before analysis; results are reported as geometric means.
In Analytika you can create a transformed column as a cleaning step. It’s added alongside the original, which is left untouched. See also skewness.
More in Preparing your data
Try it with the free tools
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.