# Solved – 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$$

Contents

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.

Rate this post