kassambara / rstatix

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

cohens d calculation incorect for indipedent sample t test, when test value is not 0. #200

Open statisticsguru1 opened 7 months ago

statisticsguru1 commented 7 months ago

Sometimes we we want to test if the difference is in population means is equal to a value(not necessarily 0). for instance when testing for population mean difference equal to 3: rstatix gives same answer for the effect size. ``

rstatix::cohens_d(data=sleep,extra~group)

A tibble: 1 × 7

.y. group1 group2 effsize n1 n2 magnitude

  • 1 extra 1 2 -0.832 10 10 large rstatix::cohens_d(data=sleep,extra~group,mu=3) # A tibble: 1 × 7 .y. group1 group2 effsize n1 n2 magnitude
  • 1 extra 1 2 -0.832 10 10 large `` # using effectsize package

``

effectsize::cohens_d(data=sleep,extra~group) Cohen's d | 95% CI

-0.83 | [-1.74, 0.10]

clearly rstatix is not taking care of the population mean difference