[R] Expected pairwise.student.t and TukeyHSD behavior?
Rolf Turner
r.turner at auckland.ac.nz
Thu Mar 25 04:49:17 CET 2010
On 25/03/2010, at 4:03 PM, Walmes Zeviani wrote:
>
> This is because pairwise.student.t and TukeyHSD use differents estimates for
> error term. TukeyHSD use the parameters covariance matrix and t use sample
> variance. In this case a treatment with only one value doesn't have sample
> variance but has a estimated standard error in a covariance matrix. The
> lines below will illustrate the point:
>
> # toy data
> da <- data.frame(A=factor(rep(c("a","b","c"), c(1,5,7))))
> da$y <- rnorm(da$A)
>
> # sample variance
> tapply(da$y, da$A, var)
> pairwise.t.test(da$y, da$A, p.adj="none") # problem!
The problem could be avoided if pairwise.t.test() were just a little
bit cleverer about how it calculated the pooled standard deviation.
I think that
pooled.sd <- sqrt(sum(s^2 * degf,na.rm=TRUE)/total.degf)
would do the trick.
It's probably not worth the effort, but.
cheers,
Rolf Turner
######################################################################
Attention:
This e-mail message is privileged and confidential. If you are not the
intended 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 MailMarshal
www.marshalsoftware.com
######################################################################
More information about the R-help
mailing list