# How to transform to normal distribution?

When using T-test to compare two group means, say group A and group B, I usually transform data to normal distribution if possible.

Before doing that, if the sample size is enough, I usually use Q-Q plot to see if the data set is normally distributed. Maybe I've been doing this wrong for many years, but what I usually do (and have been taught) is draw Q-Q plot for the whole variable (ignoring group A or group B). But what T-test assumes is that A and B are from normal distribution separately. And it is true that even when both A and B is from normal distribution with different means, the Q-Q plot of whole variable is not on the straight line.

My question is that what do you usually do to test normality? Q-Q plot together or separately? shapiro wilk test together or separately? Anderson Darling test together or separately?

If together, then two normal distribution will result a non-normal distribution. If separate, what would you do to transform them? Transform them using one method together? Thank you!

Maybe I've been doing this wrong for many years, but what I usually do (and have been taught) is draw Q-Q plot for the whole variable (ignoring group A or group B).

As you suggest in your question, if the means (or variances) differ, this combined (/marginal) variable won't be normal and it doesn't relate to what is assumed.

Q-Q plot together or separately?

You've already explained why you can't just take the raw data and do that.

You could look at residuals if you want to do them together (as long as equality of variance is a reasonable assumption).

shapiro wilk test together or separately? Anderson Darling test together or separately?

I wouldn't formally test goodness of fit at all; it answers the wrong question for what you need.

If separate, what would you do to transform them?

I probably wouldn't transform them at all*; I'd think about the question I want to answer and a reasonable way to answer that question. If my sample sizes are large non-normality may not matter and if my sample sizes are not large, I might not assume normality in the first place, unless I had some reason (outside my data) to think it might be a reasonable, if approximate, choice.

In some cases thinking about the variable being sampled might lead me to a different parametric assumption, in some cases I might consider a robustified parametric procedure, and in some cases I might lean toward not making a specific parametric assumption at all, but to simply use nonparametric procedures, depending on how these relate to the questions I want to answer.

* with some exceptions; for example there are cases where I expect (a priori) the distribution the data are drawn from to be reasonably close to lognormally distributed, and may well take logs and assume normality in that case.