[R] T statistic exactRankTests package

Peter Ehlers ehlers at ucalgary.ca
Fri May 31 00:25:34 CEST 2013


On 2013-05-30 04:20, Al Zou wrote:
> I understand this might be a silly question, but I have problems
> understanding the statistic term returned in most permutation packages.
> for example:
>
> x<-c(8,4,6)
> y<-c(5,3,4)
>   res<-exactRankTests::perm.test(x,y,paired=TRUE)
>           1-sample Permutation Test
> data:  x and y
> T = 6, p-value = 0.25
> alternative hypothesis: true mu is not equal to 0
>
> attributes(res)
> $names
> [1] "statistic"   "p.value"     "pointprob"   "null.value"  "alternative"
> "method"      "data.name"
> $class
> [1] "htest"
>
> res$statistic
> T
> 6
>
> I cannot figure out what the T stands for. I understand it is "T statistic"
> but it is not the t-score.
> Can some one tell me what formula is used for the T statistic.

The formula is simple: T is the sum of the positive paired differences.
You could check Wikipedia for "permutation test". There must be plenty
of online info but I'm too lazy to check.

> In general is there some way to look for what function is used to calculate
> the statistics?
>

Just look at the code of perm.test.default (it's not complicated).
Type

   perm.test.default

to see the code or get the package source and study the code.


Peter Ehlers



More information about the R-help mailing list