Jeremy Wang
2011-Nov-04 20:59 UTC
[R] Creating a sequence from two samples with several constraints (frequency and repeats)
I'm attempting to create a sequence for an experiment and am hoping I can use R to create it. It has several constraints: (1) It is made up of two sequences (red and green) that have 4 different repeating triplets (e.g. T1=ABC T2=DEF T3=GHI JKL) (2) Each sequence has the following constraints: (a) there cannot be repeating triplets (e.g. T1 T1), (b) there cannot be repeating triplet pairs (e.g. T1 T2 T1 T2) (3) Triplets occur with the following frequency: T1=20, T2=23, T3=26, T4=36 (same for red and green sequences) (4) Red and green sequences are then interleaved, such that you never get more than 6 in a row of one color. (For those that are interested, I'm trying to replicate Turke-Browne, Junge, & Scholl, 2005, *JEP*, but with frequency manipulations to the triplets) Thanks in advance for any help. [[alternative HTML version deleted]]
R. Michael Weylandt
2011-Nov-04 23:56 UTC
[R] Creating a sequence from two samples with several constraints (frequency and repeats)
I believe the permute package is set up to generate restricted permutations. Michael On Fri, Nov 4, 2011 at 4:59 PM, Jeremy Wang <wang0501 at umn.edu> wrote:> I'm attempting to create a sequence for an experiment and am hoping I can > use R to create it. It has several constraints: > > (1) It is made up of two sequences (red and green) that have 4 different > repeating triplets (e.g. T1=ABC T2=DEF T3=GHI JKL) > (2) Each sequence has the following constraints: (a) there cannot be > repeating triplets (e.g. T1 T1), (b) there cannot be repeating triplet > pairs (e.g. T1 T2 T1 T2) > (3) Triplets occur with the following frequency: T1=20, T2=23, T3=26, T4=36 > (same for red and green sequences) > (4) Red and green sequences are then interleaved, such that you never get > more than 6 in a row of one color. > > (For those that are interested, I'm trying to replicate Turke-Browne, > Junge, & Scholl, 2005, *JEP*, but with frequency manipulations to the > triplets) > > Thanks in advance for any help. > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >