RE: Permutation test with small number of possible permutations

From: Andreas Krause Date: December 02, 2004 technical Source: cognigencorp.com
From: andreas.krause@pharma.novartis.com Subject: RE: [NMusers] Permutation test with small number of possible permutations Date: Thu, December 2, 2004 5:12 am The approach looks reasonable. Using all possible permutations or sampling with a sample size similar to the number of possible permutations does not make much difference in practice going by my experience. If you want to go down that road and as you say you use S-Plus anyway, you can generate all permutations of a given set of values there. I don't think there is a canned function for it, but this one will do: # Create all possible subsets of a given vector for a given sample size. # This function generates a matrix with each row containing one of the possible combinations. # Andreas Krause, May 2002 all.combinations <- function(values=c("one", "two", "three"), samples=2) { nvalues <- length(values) out <- matrix(NA, nvalues^samples, samples) for(i in 1:ncol(out)) out[, i] <- rep(values, rep(nvalues^(i-1), nvalues)) return(out) } You could eliminate from the result the redundant combinations as has been suggested. If computation time is small, you might as well ignore it though. If you want to go for it, develop a code to characterize each combination of values. That code must be identical for redundant combinations and non-identical otherwise. Derive that code for each row of the matrix obtained from the above and eliminate the rows corresponding to non-unique codes. S-Plus functions to use are apply and duplicated. Hope this helps. Andreas Dr. Andreas Krause Novartis Pharma AG Biostatistics Modeling and Simulation WSJ-27.1.073 4002 Basel Switzerland
Nov 25, 2004 Mouksassi Mohamad-Samer Permutation test with small number of possible permutations
Nov 26, 2004 Nick Holford RE: Permutation test with small number of possible permutations
Nov 26, 2004 Leonid Gibiansky RE: Permutation test with small number of possible permutations
Nov 26, 2004 Mouksassi Mohamad-Samer RE: Permutation test with small number of possible permutations
Nov 27, 2004 Leonid Gibiansky RE: Permutation test with small number of possible permutations
Nov 27, 2004 Mouksassi Mohamad-Samer RE: Permutation test with small number of possible permutations
Dec 02, 2004 Andreas Krause RE: Permutation test with small number of possible permutations
Dec 02, 2004 Kevin Dykstra RE: Permutation test with small number of possible permutations