# Is a t-test suitable to compare the difference between the mean z-scores of two groups

I have a group, people, and have converted their heights into z-scores.

I separated the groups into male and female and wanted to test whether there is a statistically significant difference between the groups. Is a t-test suitable for this purpose?

The means and SDs of the groups are not identical because the z-score was calculated on the whole group.

• Wouldn't a t-test on the z-scores come out the same as a t-test on the original data ? Feb 1 at 16:48
• A z-score is equal to the observed value minus the population mean, divided by the population standard deviation. Thus, it requires you to know $\mu$ and $\sigma$. Is that in fact the case? Feb 2 at 1:11
• @SalMangiafico if the z-scores are with respect to the individual populations (male.scores - male.mean)/male.sd then a t-test based on that (i.e. with the gender differences removed) is no use at all. So it's important to find out exactly what sort of z-scores we're talking about. Feb 2 at 6:24
• @Glen_b , just for clarity, the question indicates that the z-scores were calculated on the whole of the dependent variable, before separating it into groups. Feb 2 at 15:00
• @Sal thanks, I somehow missed that, my apologies to you. I'd delete the comment, but I wonder if it might be a useful thing to leave for later readers who would be inclined to do it by group (I see such issues come up surprisingly often!). Feb 2 at 23:16

In short, yes. As long as you converted the heights to z-scores before splitting them into groups, then it is valid to perform a t-test. Z-scoring as you have described it is sometimes referred to as "standardizing" data, and it is a common preprocessing step in many analysis pipelines. This is because the calculated effect size will be in units of SD, instead of inches, which can sometimes be useful.

#### Explanation

As Dave and Sal already mentioned, this can certainly be achieved with essentially the same results, but it will slightly change the interpretation of the results. I will provide a worked example to show you why.

I demonstrate with an example in R with some simulated data of what you ask.

#### Set Random Seed ####
set.seed(123)

#### Simulate Data ####
heights <- rnorm(n = 1000,
mean = 70,
sd = 10)

scale.heights <- scale(heights)

gender <- factor(
rbinom(n = 1000,
size = 1,
prob = .5),
labels = c("Male","Female")
)

#### Merge into Data Frame ####
df <- data.frame(gender,
heights,
scale.heights)


The data frame looks like this: gender is of course the gender of the participant, heights are the raw scores of heights, and scale.heights are the z scores of these heights.

  gender  heights scale.heights
1 Female 79.43680     0.9846165
2   Male 76.62722     0.7006528
3 Female 81.99202     1.2428724
4   Male 65.67338    -0.4064489
5   Male 66.83609    -0.2889342
6   Male 80.62366     1.1045720


#### T-Tests on Data

If we run a t test on the raw scores of heights such as t.test(heights ~ gender, df), you get this typical summary (by default R usually uses the Welch t-test):

    Welch Two Sample t-test

data:  heights by gender
t = -1.5244, df = 991.43, p-value = 0.1277
alternative hypothesis: true difference in means between group Male and group Female is not equal to 0
95 percent confidence interval:
-2.1822607  0.2741266
sample estimates:
mean in group Male mean in group Female
69.22450             70.17856


Here you can see that $$t = -1.5244$$, $$df = 991.43$$, and $$p = 0.1277$$. It also lists the means of each group. Males have a mean of 69.23 and the females have a mean of 70.18. If you then run the same t-test on z-scores with t.test(scale.heights ~ gender, df):

    Welch Two Sample t-test

data:  scale.heights by gender
t = -1.5244, df = 991.43, p-value = 0.1277
alternative hypothesis: true difference in means between group Male and group Female is not equal to 0
95 percent confidence interval:
-0.22056057  0.02770591
sample estimates:
mean in group Male mean in group Female
-0.04753867           0.04888866


You will notice that most of the output is the same, but probably the most obvious difference is that the means of the groups are different because they are now scaled scores. In this case, the raw score version is more easily interpretable, but the outcome is essentially the same.

• Totally tangential but just as a small side point: in biological analyses comparing males and females the generally agreed upon scientific terminology seems to be sex and not gender. See, e.g., medicine.yale.edu/news-article/… Feb 2 at 14:25
• Ah yes I apologize if I used the wrong nomenclature. Feb 2 at 14:28