Hi R-users,
I have a question related to permutations in R. 
I started learning something about the permutation/randomization tests using 
Edgington and Onghena (2007) and i tried replicating some of the examples in 
the book (i have seen also the packages from R that concern permutation ), but 
at some point i got stuck.

If i have 3 treatments, 7 subjects in an experiment, and a 2 of them take 
treatment A, 2 take treatment B and 3 take treatment C then there are 7!/2!2!3! 
=210 ways in which they can be assigned. So how can i create sequences in R 
that are of the form


  A     B    C
1 2 | 3 4 | 5 6 7
1 2 | 3 5 | 4 6 7
1 2 | 3 6 | 4 5 7
1 2 | 3 7 | 4 5 6
1 2 | 4 5 | 3 6 7
.........
6 7 | 3 4 | 1 2 5
6 7 | 3 5 | 1 2 4
6 7 | 4 5 | 1 2 3



The list is generated taking into account that in each treatment the sequence 
is always ascending, and so this way it can be avoided listing 7!=5040, but 
only 7!/2!2!3! =210 sequences will be listed.

Can anyone  please, offer some guidance, or some advice on how to generate this 
permutations with this constraint that the order within the treatment is 
ascending.
My hope is that using only this relevant set can greatly improve the time 
needed for the computation, when i have a larger sample.

I have seen also the recommendations to sample a lot of permutations, and i 
have no problem in doing that, everything goes smoothly and fast, but i want 
also to be able to do this.

Thank you very much and have a great day ahead!

 




Eugen Pircalabelu
(0032)471 842 140
(0040)727 839 293

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to