[R] Permutations with samr

2007-04-25 Thread Isabelle Rivals
I have a question regarding the samr package. For a 2 class unpaired problem, with sample 1 of size N1 and sample 2 of size N2, samr computes at most (N1+N2)! permutations of the two samples (if the user-supplied parameter nperms allows it). However, there are only (N1+N2)/(N1!*N2!) DISTINCT

[R] permutations of a binary matrix with fixed margins

2007-04-05 Thread Mathieu Jérôme
Dear R Users, How can I randomize a matrix (with contains only 0 and 1) with the constraint that margin totals (columns and rows sums) are kept constant? Some have called this swap permutation or something like that. The principle is to find bloc of 10 01 and change it for 01 10 there can be

Re: [R] Permutations with replacement (final final final)

2006-08-21 Thread Jesse Albert Canchola
by: [EMAIL PROTECTED] 08/18/2006 05:16 PM To 'Jesse Albert Canchola' [EMAIL PROTECTED], 'r-help' r-help@stat.math.ethz.ch cc Subject Re: [R] Permutations with replacement -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jesse Albert Canchola Sent

Re: [R] Permutations with replacement

2006-08-20 Thread Jesse Albert Canchola
] [mailto:[EMAIL PROTECTED] On Behalf Of Jesse Albert Canchola Sent: Friday, August 18, 2006 3:26 PM To: r-help Subject: [R] Permutations with replacement Is there a simple function or process that will create a matrix of permutations with replacement? I know that using the combinat package

[R] Permutations with replacement

2006-08-18 Thread Jesse Albert Canchola
Is there a simple function or process that will create permutations with replacement? I know that using the combinat package ## begin R code ## library(combinat) m - t(array(unlist(permn(3)), dim = c(3, 6))) # we can get the permutations, for example 3!=6 # gives us m [,1]

[R] Permutations with replacement

2006-08-18 Thread Jesse Albert Canchola
Is there a simple function or process that will create a matrix of permutations with replacement? I know that using the combinat package ## begin R code ## library(combinat) m - t(array(unlist(permn(3)), dim = c(3, 6))) # we can get the permutations, for example 3!=6 # gives us m

Re: [R] Permutations with replacement

2006-08-18 Thread davidr
Of Jesse Albert Canchola Sent: Friday, August 18, 2006 3:26 PM To: r-help Subject: [R] Permutations with replacement Is there a simple function or process that will create a matrix of permutations with replacement? I know that using the combinat package ## begin R code ## library

Re: [R] Permutations with replacement

2006-08-18 Thread Daniel Nordlund
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jesse Albert Canchola Sent: Friday, August 18, 2006 1:02 PM To: r-help Subject: [R] Permutations with replacement Is there a simple function or process that will create permutations with replacement

RE: [R] Permutations (summary)

2004-07-16 Thread Jordi Altirriba Gutiérrez
Dear R users, This is a second summary of the permutation problem I previously posted. This summary restates the problem as well as the solution. First of all thanks to everyone including Erich, Robin, Gabor, Christian, Ingmar and others for your suggestions. With the help of an off-list

Re: [R] Permutations

2004-07-15 Thread Christian T. Steigies
On Wed, Jul 14, 2004 at 07:42:49PM +0200, Jordi Altirriba Gutiérrez wrote: I’ve 12 elements in blocks of 3 elements and I want only to make permutations inter-blocks (no intra-blocks) (sorry if the terminology is not accurate) I am not a mathematician, but this sounds to me a little bit

RE: [R] Permutations

2004-07-15 Thread Robin Hankin
hi again what a stimulating R discussion! This is R-help at its very best! I think I understand why you don't want pure inter-block permutations. My solution would be to realize that weeding out forbidden permutations is quite difficult and time-consuming (also as several people have pointed out

RE: [R] Permutations

2004-07-15 Thread Jordi Altirriba Gutiérrez
Dear R users, First of all, I want to thank the algorithms , time and suggestions to Rolf, Robert, Marc, Gabor, Adaikalavan, Cliff, Robin, Erich and Fernando. I want to sum up a little bit all the e-mails, the algorithms and the results of a test for 1000 permutations (in my last e-mail is

Re: [R] Permutations

2004-07-15 Thread Ingmar Visser
On 7/14/04 7:42 PM, Jordi Altirriba Gutiérrez [EMAIL PROTECTED] wrote: 4 5 6 | 2 1 3 | 7 8 9 | 10 11 12 NO because it's an intra-block permutation of permutation 3 - - 10 1 7 | 4 8 7 | 5 6 12 | 3 2 9YES---Xth permutation 1 10 7 | 4 8 7 | 5 6 12 | 3 2 9NO because

Re: [R] Permutations

2004-07-14 Thread F. Tusell
Jordi: If I understand you well, the function below may do what you asked for. It is not clear to me from your posting wether e.g. 1 2 4 3 5 6 7 8 910 11 12 and 1 4 2 3 5 6 7 8 910 11 12 should count as differente permutations, i.e., wether once one pair of elements

Re: [R] Permutations

2004-07-14 Thread Erich Neuwirth
Perhaps what you want might better be described as ordered partitions? Is what you want the following: We study sequences of length 12 and divide them in 4 segments position 1 2 3, position 4 5 6, position 7 8 9, position 10 11 12, Find all permutation sequences of the numbers 1 to 12 with the

Re: [R] Permutations

2004-07-14 Thread Jordi Altirriba Gutiérrez
Dear R users, First of all, thanks to Rolf, Brad, Robin, Erich, Fernando and Adaikalavan for your time and suggestions. I’ve been testing some algorithms (sorry for the delay, I’m very slow, and I’m a completely beginner in R’s world). First, the Robin algorithm. I think that there is a

Re: [R] Permutations

2004-07-14 Thread Gabor Grothendieck
As Erich points out, there is some question as to what the original problem really is but lets assume its as Erich describes. Then, to get a random ordered permutation we just get a random permutation of 12 elements and sort the intra-block elements like this:

Re: [R] Permutations

2004-07-14 Thread Adaikalavan Ramasamy
I think the issue here is in the two keywords - permutations or sample. AFAIK, permutations should return all admissible (by some rule) combinations. If this is a large number, as some have pointed out, then one essentially takes a _sample_ of all admissible combinations. Since you earlier

Re: [R] Permutations

2004-07-14 Thread Jordi Altirriba Gutiérrez
Ramasamy [EMAIL PROTECTED] To: Jordi Altirriba Gutiérrez [EMAIL PROTECTED] CC: [EMAIL PROTECTED], R-help [EMAIL PROTECTED] Subject: Re: [R] Permutations Date: Wed, 14 Jul 2004 18:00:49 +0100 I think the issue here is in the two keywords - permutations or sample. AFAIK, permutations should return all

Re: [R] Permutations

2004-07-14 Thread Marc Schwartz
On Wed, 2004-07-14 at 08:06, Rolf Turner wrote: In respect of generating random ``restricted'' permutations, it occurred to me as I was driving home last night If one is going to invoke some kind of ``try again if it doesn't work procedure'' then one might as well keep it simple:

Re: [R] Permutations

2004-07-14 Thread Gabor Grothendieck
Gutirrez altirriba at hotmail.com : CC: rksh at soc.soton.ac.uk, R-help r-help at stat.math.ethz.ch : Subject: Re: [R] Permutations : Date: Wed, 14 Jul 2004 18:00:49 +0100 : : I think the issue here is in the two keywords - permutations or sample. : : AFAIK, permutations should return all admissible

Re: [R] Permutations

2004-07-14 Thread Gabor Grothendieck
Ramasamy ramasamy at cancer.org.uk : : To: Jordi Altirriba Gutirrez altirriba at hotmail.com : : CC: rksh at soc.soton.ac.uk, R-help r-help at stat.math.ethz.ch : : Subject: Re: [R] Permutations : : Date: Wed, 14 Jul 2004 18:00:49 +0100 : : : : I think the issue here is in the two keywords

[R] Permutations

2004-07-13 Thread Jordi Altirriba Gutiérrez
Dear R users, I’m a beginner user of R and I’ve a problem with permutations that I don’t know how to solve. I’ve 12 elements in blocks of 3 elements and I want only to make permutations inter-blocks (no intra-blocks) (sorry if the terminology is not accurate), something similar to: 1 2 3 | 4 5

Re: [R] Permutations

2004-07-13 Thread Marc Schwartz
On Tue, 2004-07-13 at 14:07, Jordi Altirriba Gutirrez wrote: Dear R users, Im a beginner user of R and Ive a problem with permutations that I dont know how to solve. Ive 12 elements in blocks of 3 elements and I want only to make permutations inter-blocks (no intra-blocks) (sorry if the

Re: [R] Permutations

2004-07-13 Thread Marc Schwartz
On Tue, 2004-07-13 at 14:29, Marc Schwartz wrote: On Tue, 2004-07-13 at 14:07, Jordi Altirriba Gutirrez wrote: Dear R users, Im a beginner user of R and Ive a problem with permutations that I dont know how to solve. Ive 12 elements in blocks of 3 elements and I want only to make

Re: [R] Permutations

2004-07-13 Thread Rolf Turner
Marc Schwartz wrote (in response to a question from Jordi Altirriba): You can use the permutations() function in the 'gregmisc' package on CRAN: # Assuming you installed 'gregmisc' and used library(gregmisc) # First create 'groups' consisting of the four blocks groups - c(1 2 3, 4 5 6, 7

RE: [R] Permutations

2004-07-13 Thread Baskin, Robert
PROTECTED] Sent: Tuesday, July 13, 2004 3:07 PM To: [EMAIL PROTECTED] Subject: [R] Permutations Dear R users, I'm a beginner user of R and I've a problem with permutations that I don't know how to solve. I've 12 elements in blocks of 3 elements and I want only to make permutations inter-blocks

Re: [R] Permutations

2004-07-13 Thread Rolf Turner
! http://www.R-project.org/posting-guide.html From [EMAIL PROTECTED] Tue Jul 13 17:19:55 2004 From: Baskin, Robert [EMAIL PROTECTED] To: =?iso-8859-1?Q?=27Jordi_Altirriba_Guti=E9rrez=27?= [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [R] Permutations Date: Tue, 13 Jul 2004 16:12:46

Re: [R] Permutations

2004-07-13 Thread Marc Schwartz
On Tue, 2004-07-13 at 15:02, Rolf Turner wrote: Marc Schwartz wrote (in response to a question from Jordi Altirriba): snip This does not solve the problem that was posed. It only permutes the blocks, and does not allow for swapping between blocks. For instance it does produce the

Re: [R] Permutations

2004-07-13 Thread Rolf Turner
Dang!!! Forget it. My random restricted permutation generator doesn't ``quite'' work. Further testing --- which I should've done before posting (sigh) --- reveals that it can get into a situation in which there's nothing left to sample from, and it still needs to fill out the permutation. I.e.

For what it's worth (was Re: [R] Permutations).

2004-07-13 Thread Rolf Turner
For what it's worth, here is a mild revision of my restr.perm() function, which seems NOT to fall over. I.e. it appears to ``reliably'' generate restricted permutations. Whether these are genuinely ***random*** restricted permutations (i.e. does each restricted permutation of 1:12 have the same

[R] permutations function

2003-09-20 Thread lamack lamack
Dear all If I consider d- c(1,2,3,4) N- 4 n- 2 out1- matrix(0,N^n,n) z-1 for(i in 1:N) { for(j in 1:N) { out1[z,1] = d[i] out1[z,2] = d[j] z- z+1 } } library(gregmisc) out2- permutations(N,n,d,T,T) I have that out1==out2. Ok Now, if I consider d- c(1,2,3,4) N- 4 n- 3 out1-

Re: [R] permutations function

2003-09-20 Thread Uwe Ligges
lamack lamack wrote: Dear all If I consider d- c(1,2,3,4) N- 4 n- 2 out1- matrix(0,N^n,n) z-1 for(i in 1:N) { for(j in 1:N) { out1[z,1] = d[i] out1[z,2] = d[j] z- z+1 } } library(gregmisc) out2- permutations(N,n,d,T,T) I have that out1==out2. Ok Now, if