dimanche 28 novembre 2021

How can I sample removing some groups randomly and some individuals within group randomly?

a= [1 2 3 1;5 6 7 1;1 2 3 1;1 2 4 1;1 2 3 2;1 2 3 2;1 2 4 2;1 2 4 2;1 3 4 3;1 3 4 3;1 3 4 3;1 2 3 3 ]

It gives; 1 2 3 1 5 6 7 1 1 2 3 1 1 2 4 1 1 2 3 2 1 2 3 2 1 2 4 2 1 2 4 2 1 3 4 3 1 3 4 3 1 3 4 3 1 2 3 3

a[:,4] represent group. I want randomly selected two groups each with two randomly selected individuals. Is there any easier and concise way to do it?




Aucun commentaire:

Enregistrer un commentaire