0
$\begingroup$

I am performing paired t-test as following:

t.test(h1$pureinf_hvar, h1$pureinf_lvar, alternative="greater", Paired=T)

having each column of h1 (pureinf_hvar and pureinf_lvar) consisting of 43 observations each (43 subjects, data on 2 different treatments). Interestingly, the result shows a degree of freedom of 84 (or 83.925 due to Welch adjustment for the degrees of freedom).

I've performed some internet researches and found out that for 2-samples t-tests the df is typically defined as df = 2(n-1). However, for paired t-tests like mine there is just 1 group of subjects getting all treatments, so the df should be n-1, shouldn't it? Why does (Welsh-)t-test show a df of 84 (2*43-2) for paired samples intead of 42 (43-1) with my test?

Thank you in advance!

$\endgroup$
1
  • $\begingroup$ In R, capitalization matters; paired and Paired are not the same thing. Also, you should use TRUE rather than T because T is a variable, and it's easy for code to write over it. Imagine a session in which you (or some code you ran) has innocently used T to hold some information. Imagine T got set to 0. Now paired=T and paired=TRUE produce different results! In fact now the first thing actually says the same as paired=FALSE. That's too dangerous. Spell it out as TRUE (you can't accidentally overwrite TRUE). Being sure it's right is better than saving 3 characters. $\endgroup$
    – Glen_b
    Jan 16, 2016 at 0:41

1 Answer 1

2
$\begingroup$

First, are you sure that you want to conduct Welch $t$-test? You used parameter Paired=T, so I assume that you wanted to conduct $t$-test for paired samples, however t.test in R does not have such parameter, it should be paired=T (lowercase), so it got ignored and you conducted $t$-test for independent samples.

As about Welch $t$-tests degrees of freedom, they are calculated differently, i.e. Welch–Satterthwaite equation is used. Check Wikipedia article on $t$-test, it described the different ways how df's are calculated for different kinds of $t$-tests. So if you conducted $t$-test for paired samples, than yes, degrees of freedom are calculated as $n - 1$, where $n$ is a number of pairs.

$\endgroup$
2
  • $\begingroup$ oh ... well when I read Welch-Test I thought it would be kind of the "standard" t-test in R. But you're completely right, I want(ed) to conduct a paired t-test. As you mentioned the problem was the capitalization of "paired". Thank you very much for you help! $\endgroup$
    – martl
    Jan 15, 2016 at 21:07
  • $\begingroup$ @martl no, it is not "standard", it is used in certain cases. If the answer was helpful you can always accept it (the "v" button) or upvote it (the up-arrow). $\endgroup$
    – Tim
    Jan 15, 2016 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.