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.
Simulating Your Data
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)
head(df)
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.