[R] Permutation columns or boostrapping

david v danova_fr at hotmail.com
Wed Jan 11 18:41:37 CET 2006


Hi,
I want to permutate the following matrix and replace  permutated columns. Is 
it possible to control the number of columns permutated. Let's say I only 
want to permute two columns. Can i do that with the sample method or should 
i any bootstrapping method ??  I'm not sure this is the best statisticaly 
way of doing it...??
So the idea behind is to ramdonly generate 1000 permutated matrices from the 
original data matrix and estimated the significance  of each of the values.
Any help would be extremely apreciated..

Here is the code i have so far... that works

x <- matrix(1:10,nr=5,nc=6)
>x
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    6    1    6    1    6
[2,]    2    7    2    7    2    7
[3,]    3    8    3    8    3    8
[4,]    4    9    4    9    4    9
[5,]    5   10    5   10    5   10

>y<-x[,sample(1:6,replace=TRUE)]
>y
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    6    6    1    6    6
[2,]    2    7    7    2    7    7
[3,]    3    8    8    3    8    8
[4,]    4    9    9    4    9    9
[5,]    5   10   10    5   10   10

best,
david




More information about the R-help mailing list