[R] pairwise.t.test for paired data
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Fri Apr 4 19:39:15 CEST 2008
francogrex wrote:
> Dear R-help, I have a question about pairwise.t.test and adjustment for
> multiple comparisons for paired data points.
> I have the following data:
>
> n=c("x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "y", "y",
> "y", "y", "y", "y", "y", "y", "y", "y", "z", "z", "z", "z", "z",
> "z", "z", "z", "z", "z")
>
> and
>
> d=c(3.38501220258169, 0.732526675324789, -0.638736410843593,
> 7.87414894080545,
> 3.6341475242877, -2.80762187242111, 14.1405912463741, -9.29904247482419,
> 9.8636915453275, 5.43287495347734, 12.2804612051493, 7.83975161028828,
> 15.2200332220459, 6.72953902619773, 9.11557944514228, 9.79268012944973,
> 7.6112143261283, 10.3912598689021, 8.04934992955112, 13.3935024789408,
> 12.1276080143311, 11.2987640203845, 2.05386456839974, 12.8386335687123,
> 3.84418682233211, 17.4626505871045, 6.5947625121599, -10.6664750811034,
> 21.3346023277454, 4.99216977422232)
>
> Then I do the tests
>
>
>> pairwise.t.test(d,n,p.adjust="bonf",paired=F)
>>
>
> Pairwise comparisons using t tests with pooled SD
>
> data: d and n
>
> x y
> y 0.092 -
> z 0.326 1.000
>
> P value adjustment method: bonferroni
>
> Assuming the data are paired:
>
>
>> pairwise.t.test(d,n,p.adjust="bonf",paired=T)
>>
>
> Pairwise comparisons using t tests with pooled SD
>
> data: d and n
>
> x y
> y 0.092 -
> z 0.326 1.000
>
> P value adjustment method: bonferroni
>
> I have no indication that the test is taking into account that the data are
> paired! Is it possible to do a pairwise t test with adjustement for multiple
> comparisons using pairwise.t.test? If not any other function for that?
> Thanks
Get rid of the pooled SD, and pairwise.t.test() will actually do the
paired tests, although that is not what the function was designed to do.
(Oddly enough, this issue hasn't come up in the 6+ years that the
function has existed, and then it pops up twice with little over a week
between, see the thread started by James Root on March 26.)
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list