[R] Confusion on use of permTS() in 'perm'

Robert A. LaBudde ral at lcfltd.com
Tue Sep 8 19:11:53 CEST 2009


Consider the following simple example using R-2.9.0 and 'perm' 2.9.1:

 > require('perm')
 > p<- c(15,21,26,32,39,45,52,60,70,82)
 > g<- c('y','n','y','y', rep('n',6)) #Patients ranked 1,3,4 receive treatment
 > permTS(p ~ g, alternative = 'two.sided', method='exact.ce') #find 
p-value by complete enumeration

         Exact Permutation Test (complete enumeration)

data:  p by g
p-value = 0.05
alternative hypothesis: true mean of g=n minus mean of g=y is not equal to 0
sample estimates:
mean of g=n minus mean of g=y
                      28.38095

The permutation observed is '134', which has a rank sum of 8. Other 
permutations with rank sums of 8 or less are '123', '124' and '125'. 
So there are a total of 4 out of 4! = 120 possible, or a one-tail 
p-value of 4/120 = 0.0333, or a 2-tail p-value of 2*4/120 = 0.067. 
This is not, however, what permTS() returns. The permTS() value of 
0.05 appears to correspond to 3 patterns, not 4.

I am misunderstanding how to solve this simple problem, or is 
something going on with permTS() that I'm missing.

Thanks.

================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"




More information about the R-help mailing list