Which Test?

Draft: This page has not been reviewed by a statistician yet. Use it as a starting point and check important choices with a statistician.

Unpaired t-test on log-transformed data

Compares two independent groups on the log scale for right-skewed data, and reports a ratio of geometric means.

Clinical example

Comparing triglyceride levels between two treatment groups. The values are strongly right-skewed, but look roughly normal after taking the logarithm.

When to use it

Assumptions to check

Roughly normal on the log scale

Look at a histogram of the log values, not of the raw values.

Similar spread on the log scale

Check this on the log scale too.

Only positive values

If there are zeros, use log(x + 1).

Check first

  • Zeros in the data: use log(x + 1)
  • Normality and equal spread on the log scale

What to report

  • Geometric mean per group
  • Ratio of geometric means with 95% CI

Common mistakes

Using the log scale when it doesn't improve normality; then use Mann–Whitney on the raw data

Reporting back-transformed results as if they were arithmetic means

Alternatives

If your situation is…Use
The data are still clearly skewed after the log transform, or the samples are smallMann-Whitney U test
The data are roughly normal without a transform, or the samples are largeWelch's t-test

In your software

R
# R
fit <- t.test(log(triglycerides) ~ arm, data = d)
exp(fit$estimate[1] - fit$estimate[2])   # ratio of geometric means (first / second group)
exp(fit$conf.int)                        # 95% CI of the ratio
SPSS
COMPUTE log_tg = LN(triglycerides).
EXECUTE.
T-TEST GROUPS=arm(1 2)
  /VARIABLES=log_tg
  /CRITERIA=CI(.95).

Sources

One group against a reference value

The same idea works for one group. Take the logarithm of every value, run a one-sample t-test against the logarithm of the reference value, and transform the result back. You then compare the geometric mean of your group with the reference.

  • It is not the ordinary mean. For right-skewed data the geometric mean is lower than the arithmetic mean. The reference value must be a geometric mean too, or at least a value on the same scale. Comparing with a published arithmetic mean answers a different question.
  • If the arithmetic mean is what you need, for example the average cost per patient, the log transform does not give you that. A bootstrap confidence interval for the mean is an option.
  • Only positive values. Zeros and negative values cannot be log-transformed. Adding 1 changes the quantity you compare, so state it, or choose another approach.
  • Report it as a ratio: the geometric mean divided by the reference, with its 95% CI. Do not call it a difference in means.
R
# R: one group against a reference value (here 5)
fit <- t.test(log(d$length_of_stay), mu = log(5))
exp(fit$estimate)            # geometric mean of your group
exp(fit$estimate - log(5))   # ratio: geometric mean / reference
exp(fit$conf.int - log(5))   # 95% CI of the ratio
SPSS
* SPSS: LN(5) = 1.6094, so the test value is 1.6094.
COMPUTE log_los = LN(length_of_stay).
EXECUTE.
T-TEST
/TESTVAL=1.6094
/VARIABLES=log_los
/CRITERIA=CI(.95).
* Back-transform the mean difference and its CI with EXP().