Calculating the odds of selecting a group, then a specific element of a group

145 Views Asked by At

It's been a while since I took probabilities and statistics in school, so I wouldn't be too surprised if this is simpler than I thought but I haven't had much luck figuring it out so far. Lets say you have N groups, and each group has M sub-groups, and each sub-group has X elements. Is there a way to calculate the odds of any induvial element being chosen, given even weights on each step (so N_1 has equal chance of being selected as N_2, N_3... N_n)?

Additionally, is there a formula that works recursively? So it would work regardless of the number of sub-group layers there are? Thanks for any help

Edit: Here's an example to help explain - I have 50 elements, split into 2 sets of 30 and 20. Those sets are then split into sets of 10. I want to find the odds of selecting any element, given that there's a 50/50 chance of picking either the 30 or 20 set, then a even chance of picking any of the 10-sized subsets and same for the single element.

Basically I have a table for a programming project set up like so:

{
  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
  { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }
},
{
  { 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 },
  { 31, 32, 33, 34, 35, 36, 37, 38, 39, 30 },
  { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 }
}

Where a random top level table is selected, then one of the sub-tables, then finally one of the values. I want to figure out what the chances of selecting a value would be, say 13 and 45 or whatever.