I need to generate randomly 1000 2x2 contingency tables and sum of numbers per 1 table cannot be higher than 100,000. But they have to be various tables, some with small total sums, some with very high. Then I need to cover the entire 4-dimensional space - creating all kinds of value combinations (small, mid, high values) for each of the 2x2 cells. E.g once I have 4 values that add up to 100,000, I should make 24 different "tables" assigning them in any of the 24 permutation orders. All tables have to be unique. Then I need to output 5 tables with highest support, highest confidence and highest support+confidence.
I am using rbinom() to generate random numbers
while (i<=1000){
v1=rbinom(100000/2,2,p1)
v2=rbinom(100000/2,2,p2)
# contin.table
t=table(v1,v2)
S[i]=t[2,2]/sum(t)
i = i + 1
}
but it is not work correctly. Please help out. Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire