[R] generating a paired t-test with multiple levels of a factor
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Fri Mar 28 00:14:21 CET 2008
Rolf Turner wrote:
>
> 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.
>
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.)
> 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 confidential. If you
> are not theintended recipient please delete the message and notify the
> sender.Any views or opinions presented are solely those of the author.
>
> This e-mail has been scanned and cleared by
> MailMarshalwww.marshalsoftware.com
> ######################################################################
--
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