[R] generating a paired t-test with multiple levels of a factor

Rolf Turner r.turner at auckland.ac.nz
Thu Mar 27 23:47:26 CET 2008


On 28/03/2008, at 11:14 AM, Peter Dalgaard wrote:

> Michael A. Miller wrote:
>>>>>>> "James" == James Root <jcroot at gmail.com> writes:
>>>>>>>
>>
>>> Is there a way to run all paired t-tests where a paired
>>> t-test is run for every possible combination?
>>
>> Sounds like pairwise.t.test is the sort of thing you are looking
>> for...
>>
>>
> Yes, except that it was designed for independent samples t-tests,  
> so you
> need to be careful about not mixing up the pairs. This appears to  
> do the
> trick:
>
>> pairwise.t.test(a,col(a),paired=T,pool=F,p.adj="none")
>
>         Pairwise comparisons using t tests with non-pooled SD

	<snip>

I would very strongly call this a bug in pairwise.t.test.  One should
*not* have to specify pool=FALSE if one is doing a paired t-test.  For
a paired t-test there is actually only *one* sample (the sample of  
pairwise
differences) and hence only one standard deviation, and hence nothing  
to pool.

My reading of the code is that if pool.sd is TRUE (the default) then the
pairwise.t.test function does two-independent-sample t-tests willy- 
nilly,
and ignores the ``paired=TRUE'' argument.  (It doesn't call upon  
t.test()
which is the only bit which considers the ``paired'' argument.)

This is a dangerous trap, and should be fixed.  (Which is not hard.)

			cheers,

				Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list