kassambara / rstatix

Pipe-friendly Framework for Basic Statistical Tests in R
https://rpkgs.datanovia.com/rstatix/
440 stars 50 forks source link

Order of group data in paired = T (t_test, cohens_d) and interpretation of negative t-value & effect size #161

Open c-hoffmann opened 1 year ago

c-hoffmann commented 1 year ago

I have an issue with the lack of clarity concerning the group order in t_test and cohens_d. The description doesn't seem to mention if group1 is tested against group2 or the other way around and thus interpretation of result signs is confusing.

In my case, I have a repeated measurement with the same participants (i.e. paired = T), with two different interventions. I want to perform a t-test and evaluate effect size concerning the difference of both interventions. I'd apply it as follows:

rstatix::t_test(value ~ group, data = mydata, paired = T)
rstatix::cohens_d(value ~ group, data = mydata, paired = T)

My "group" variable is a sorted factor with the control intervention first.

The output of both functions shows "group1" and "group2" (which is great!). However, it is unclear which order they were tested against each other. Is group1 tested against group2 or the other way around? This changes the sign of the t-value ("statistic") and effect size ("effsize"). Testing it with multiple test data, it seems that group1 is tested against group2, i.e. when I expect a higher value for an intervention, I need to input the intervention group as group1 and the control group as group2 - otherwise I get a confusing negative t-value / effect size. Is this correct?

I couldn't find any description concerning this in the help pages of both t_test and cohens_d, but I think it would be useful. Thank you!