[R] non-parametric permutation and signed paired-difference distributions

Michael Friendly friendly at yorku.ca
Fri Oct 14 21:42:44 CEST 2011


On 10/14/2011 1:20 PM, Weidong Gu wrote:
> On Fri, Oct 14, 2011 at 11:38 AM, Michael Friendly<friendly at yorku.ca>  wrote:
>> Hi all
>> Consider the classic data below from Darwin on the heights of 15 pairs of
>> zea mays (corn) plants
>> either cross-fertilized or self-fertilized, where the goal is to see if it
>> makes a difference.
>>
>>> head(ZeaMays)
>>   pair pot  cross   self   diff
>> 1    1   1 23.500 17.375  6.125
>> 2    2   1 12.000 20.375 -8.375
>> 3    3   1 21.000 20.000  1.000
>> 4    4   2 22.000 20.000  2.000
>> 5    5   2 19.125 18.375  0.750
>> 6    6   2 21.500 18.625  2.875
>> ...
>>
>> I'd like to illustrate two types of non-parametric tests of whether the
>> mean(diff) = 0.
>>
>> (a) Permutation test, where the values of, say self are permuted and
>> diff=cross - self
>> is calculated for each permutation.  There are 15! permutations, but a
>> reasonably
>> large number of random permutations would suffice.
>>
>> (b) Test based on assigning each abs(diff) a + or - sign, and calculating
>> the mean(diff).
>> There are 2^15 such possible values, but again, a reasonably large number of
>> random
>> samples would do.
>>
> What do you mean by 'assigning each abs(diff) a + or - sign, and
> calculating the mean(diff)'?
> abs(diff) should be all positive, right?
>
>
I mean to calculate
mean (sign * abs(diff))
where sign is a vector of length 15 composed of some combination of (-1, 
+1).

This is actually what Fisher did.  It corresponds to assigning one 
member of each pair to cross / self

-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list