Hi all, I am attempting to write an R fn to produce a random sequence of 8 binaries (4 ordered pairs). I would like to parmeterize the fn so that it takes 2 arguments: 1 that is an overall probability of a 1 vs. 0 and the other which controls the likelihood of 1s on the 1st vs. the 2nd element of the 4 ordered pairs.
Here are some examples: *Voiced Probability Parm* *1st Element Probability Parm* *Average N of 1s * *Average N 1st Element 1s* * * *1* *1.5* *2* *2.5* *3* *3.5* *4* *4.5* 0.5 1 4 4 1 0 1 0 1 0 1 0 0.5 0 4 0 0 1 0 1 0 1 0 1 0.5 0.75 4 3 1 0 0 1 1 0 1 0 0.5 0.25 4 1 0 1 0 1 1 0 0 1 1 1 8 4 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0.5 4 2 1 0 0 1 1 0 0 1 Can anyone suggest an algorithm for this? I have a 1st draft of the fn definition, but my algorithm is not correct as I am not getting the average number of 1s (averaged over 10,000 sequences) correct. Thanks, Dan [[alternative HTML version deleted]] ______________________________________________ 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.