I guess this is a trivial concern but I can't figure it out... When performing an independent t-test I always get slightly different results for the mean of group 1 when comparing it to the calculated mean with the simple mean(x, ...) function. Is there a simple explanation for this?
Here's my code:
dummy=ifelse(df$age>=median(df$age,na.rm = TRUE),1,0)
t.test(Meaningfulness~dummy, var.equal=TRUE, na.rm=TRUE)
mean(Meaningfulness[df$age<=median(df$age,na.rm = TRUE)], na.rm = TRUE)
The mean for group 1 as in the output of the t-test is: 4.948307 When calculated with the mean function it is: 4.979567
Interestingly the mean for the second group doesn't differ between the t-test function and the mean function...
Also which mean should I report then? I assumed the mean from the t-test output as significance levels trace back to that one. On the other hand, when calculating effect size (Cohen's d) I use the mean from the mean function. So which number do you recommend to report in the tables and text?
Thanks in advance! :)