I have a simple question. I've seen this behaviour in R for both t-tests and correlations.
I do a simple paired t-test (in this case, two vectors of length 100). So the df of the paired t-test should be 99. However this is not what appears in the t-test result output.
dataforTtest.x <- rnorm(100,3,1)
dataforTtest.y <- rnorm(100,1,1)
t.test(dataforTtest.x, dataforTtest.y,paired=TRUE)
the output of this is:
Paired t-test
data: dataforTtest.x and dataforTtest.y
t = 10, df = 100, p-value <2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
1.6 2.1
sample estimates:
mean of the differences
1.8
BUT, if I actually look into the resulting object, the df are correct.
> t.test(dataforTtest.x, dataforTtest.y,paired=TRUE)[["parameter"]]
df
99
Am I missing something very stupid? I'm running R version 3.3.0 (2016-05-03)
options(digits=2)
that I was using to get better output. That was the stupid thing I was missing. – Farllibrary(broom); tidy(t.test(dataforTtest.x, dataforTtest.y,paired=TRUE))
and you get your previous output as a data frame. You can change/round each variable independently of the others. Also very useful if you want to store many t-test outputs in one data frame. – Swatch