Skip to content

generating a paired t-test with multiple levels of a factor

7 messages · James Root, Michael A. Miller, Peter Dalgaard +1 more

1 day later
#
> 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...

Mike
#
On 28/03/2008, at 8:42 AM, Michael A. Miller wrote:

            
Don't forget to pass along the argument ``paired=TRUE''
	(in the ``...'' arguments)!!!

		cheers,

			Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
#
Michael A. Miller wrote:
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 comparisons using t tests with non-pooled SD 

data:  a and col(a) 

  1       2       3       4       5       6      
2 1.4e-08 -       -       -       -       -      
3 1.2e-06 0.65530 -       -       -       -      
4 1.7e-07 0.05903 0.09535 -       -       -      
5 6.1e-08 0.02352 0.17532 0.53276 -       -      
6 0.00355 0.29816 0.10283 0.04843 0.07627 -
7 0.00077 0.14419 0.06035 0.00691 0.02340 0.51667
P value adjustment method: none
c0  c3  c6  c9 c12 c18 c24
24 150 122 103 109 103  87 109
25 173 127 117 124 143 123 144
26 191 174 165 160 177 184  NA
27 191 159 157 161 150 187 215
28 230 150 144 153 125 124 152
29 145 134 167 141 112 212 194
30 128  92  89  78  83  78  80
31 102  86  80  76  82  79  68
32 180 124 116 117 124  NA  NA
33 153  96  97  96  93 156 110
34 115  79  79  79  73  69  72
35 150 113 124 102 100 109 101
36 182 147 156  79 135  NA 162
37 175 146 157 140 143 158 162
38 146  86  81  80  87  89  95
39  92  80  95  95  86 119  NA
40 228 177 185 181 190 182 192
41 178 119 107  NA 102 110  94
42 213 185 152 142 158 178 194
43 161 107 104 107  NA 118 129

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

            
<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}}
#
Rolf Turner wrote:
It's not a bug that something works strangely outside its intended domain...
The documentation says:

Description:

     Calculate pairwise comparisons between group levels with
     corrections for multiple testing

which does not imply that paired tests should work. Had that been the 
intention, it would have been documented (and presumably, more thought 
would have gone into figuring out whether it makes sense to pool the SD, 
and if so, how to do it.)