[R] Split a matrix for mixture distribution
Evgenia
evgts at aueb.gr
Sun Feb 24 12:33:52 CET 2008
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.
More information about the R-help
mailing list