Hello,
 I have a matrix with 4000 rows and 8 columns with 1 and zeros 
Every 1000 rows comes for a different rule, f1,f2,f3,f4.

1 1 1 1 0 0 0 0
1 1 1 1 0 0 0 0 
....
0 0 0 0 1 1 1 1
0 0 0 0 1 1 1 1
...
1 1 0 0 1 1 0 0
1 1 0 0 1 1 0 0
...
0 0 1 1 0 0 1 1 
0 0 1 1 0 0 1 1

How can I extract 4 matrices each one containes 1000 elements from a certain
rule,since i want to 
a) choose between f1, f2, f3 and f4 at random according to the
   probabilities p1, p2, p3 ,p4 (it is assumed p1+p2+p3=1).
b) sample 1 value from whichever of f1, f2, f3 ,f4 was chosen

Thanks a lot
Evgenia
 
-- 
View this message in context: 
http://www.nabble.com/Split-a-matrix-for-mixture-distribution-tp15663106p15663106.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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