thmsfuller066 at gmail.com
2010-Aug-01 04:22 UTC
[R] Permutation of a sequence to without changing local distribution
Hello All, Suppose that I have a sequence of letters (e.g., A..Z). I want to permute the sequence to generate random sequences, such that the local density of any letter with a window (say of length L) doesn't change much before and after permutation. One way that I can thing of is to require that the position of any letter in the original sequence and the position of the same letter in the new sequence should be smaller than L. Suppose that v is the original sequence of letters. The following R code random generates the sequence but without the distance constraint as mentioned above. sample(v, length(v)) To generate a random sequence, an intuitive idea is to break the sequence into chunks of length L, then permute freely within each chunk. The chunks are then slided 1 letter each time (until L-1 times) and more sequence are generated. My method may be crude. I'm wondering if there is a well established method to generate a sequence satisfying the same local distribution. -- Tom
Wu Gong
2010-Aug-01 18:24 UTC
[R] Permutation of a sequence to without changing local distribution
It would be helpful if you give a sample data to illustrate the problem. I really can't understand what you want:) ----- A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Permutation-of-a-sequence-to-without-changing-local-distribution-tp2309283p2309616.html Sent from the R help mailing list archive at Nabble.com.