Direction of difference: confidence interval for independent samples t-test

I am using the function t.test to perform the independent samples t-test in R Studio. I have included the argument 'conf = 0.95' to obtain a 95% CI for the difference in population means. I am surprised to note that the output does not automatically include the difference in means corresponding to the reported CI limits. Could I please have advice on:

a) how R decides which way round, by default, to calculate the difference in sample means and corresponding differences for the CI limits;

b) whether I can include an extra argument in t.test to request that the difference in sample means is included in the output;

and

c) whether I can control which way round the difference is calculated for the CI limits when using the argument "conf=0.95".

It may help to note that the categories for my group variable are included as text names rather than numbers in my dataset.

Also, I can see that in any one case, it is possible to use the t-statistic value generated to deduce which way round the difference in means was calculated. However, I would prefer to have a more general insight in the senses reflected in my above queries.

Many thanks in advance!

Type

stats:::t.test.default

to see the code of the function. This may help.

Thank you for this thoughtful suggestion. I have had a look at the code that is returned on running this request. However, unfortunately, it does not provide an answer to my query. I am running the independent samples t-test from a datafile which already contains the relevant dependent and independent variables and wish to know how R decides which way round to subtract the means represented by the categories of the independent variable, which are currently expressed as text names.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.