# How to report t statistic from R

I'm wondering how to report the result of a t-test from R given that the degrees of freedom change when the lengths of the vectors are the same.

For example

set.seed(1)
n = 500
x = rnorm(n, 6, 1)
y = rnorm(n, 6, 2)
t = t.test(x,y)
t
t$parameter  Gives the output > t Welch Two Sample t-test data: x and y t = 1.0924, df = 716.16, p-value = 0.275 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.09130295 0.32035262 sample estimates: mean of x mean of y 6.022644 5.908119 > t$parameter
df
716.156


Whereas

set.seed(2)
n = 500
x = rnorm(n, 6, 1)
y = rnorm(n, 6, 2)
t = t.test(x,y)
t
t$parameter  Gives the output > t Welch Two Sample t-test data: x and y t = -0.62595, df = 748.05, p-value = 0.5315 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.2602459 0.1344099 sample estimates: mean of x mean of y 6.061692 6.124610 > t$parameter
df
748.0475


I'm not sure if it would be typical to report the first as $$t(716.15), p = 0.275$$ and the second as $$t(748.05), p = 0.53$$

## 2 Answers

If you have to report all the details then you should also report the actual t-value, not just degrees of freedom.

About the degrees of freedom: your degrees of freedom changes because you are using t-test with Welch correction for pooling the variances of the two groups. If your context permits to assume equal variances in both groups you could call the t.test() in the following way:

t.test(x, y, var.equal=TRUE)


then you would get the same degrees of freedom for both cases - a whole number dependant on the number of observations. However don't do this just to get a round degrees of freedom value.

And if Welch t-test is more appropriate in your case consider stating that Welch t-test was used in your report as well.

The Student's t-test assumes both samples having the same variance and in this case the degrees of freedom are simply n1 + n2 - 2. On the other hand, the Welch test does mot make this assumption and in this case you have to calculate the degrees of freedom where the variances of the samples are considered and thus you do not always get the same degrees of freedom for the same sample size. The answer is to report the degrees of freedom as you did (reading it up from the R output).

EDIT

I agree with Karolis Koncevičius that you need to report the t value as well, of course. For your first example you would report t(716.16)= 1.09, p= 0.275. Although it depends on the citing format in your discipline how many decimal places you need to report, for example. But I would suggest using the Welch t test as default as it is the case in R "because Welch's t-test performs better than Student's t-test whenever sample sizes and variances are unequal between groups, and gives the same result when sample sizes and variances are equal." (quote from source in link before).