Combinations/probability calculations using ball/bag analogy I'm wondering how to approach this question? I'm analysing data for a research project, but I feel like it falls into the category of choosing combinations of balls in a bag. Any help would be much appreciated.
So - say I have 5 types (A-E) of balls, with a total of 457 in a bag
A - 127;
B - 100;
C - 61;
D - 52;
E - 117;
In a simple approach, each handful of balls I choose contains 4 balls, of some combination (a type of ball can only be repeated up to twice; ie. AABC can happen, but AAAC cannot).
1) How would I find the probability of grabbing, say, ABCE? ABCD? ABEE?
2) Now, to complicate things a bit, each handful can contain 4 OR 5 balls. What do I do now? 
3) If I know test 101 handfuls, and find that A is grabbed twice (eg AAXX or AAXXX) 17 times, how can I see if that is statistically significant?
Thank you so much for your time!
 A: We assume that if there are more than $2$ of a given type, then the items are replaced and we draw again. Imagine that each ball has a student number, so they are all distinguishable.   Then all "legal" selections  of $4$ balls are equally likely. 
We need to count the legal selections, and for any pattern, count the "favourables" that yield that pattern. 
Counting the legal selections is messy. There are $\binom{457}{4}$ choices with no restrictions.  We remove the bad ones. There are two types of bad: (i) all of the same type and (iii) $3$ of one type, and $1$ of another.
For (i), the number is $\binom{127}{4}+\binom{100}{4}+\cdots$.
For (ii), consider for example $3$ of Type A and $1$ of Type B. The $3$ Type A can be chosen in $\binom{127}{3}$ ways, the type B in $\binom{100}{1}$ ways, for a total of $\binom{127}{3}\binom{100}{1}$. There are nine other similar terms. 
So assume now we have our count. We now count favourables.
The easiest to count is a pattern like ABCD. the number is $\binom{127}{1}\binom{100}{1}\binom{61}{1}\binom{52}{1}$.
For the pattern AABC, we use $\binom{127}{2}\binom{100}{1}\binom{61}{1}$.
The remaining type of pattern is exemplified by AABB. The number of favourables is $\binom{127}{2}\binom{100}{2}$.   
A: The first thing you need to do is to get a handle on the sample space. Let's start with the simple case first. 
Assume we are grabbing 4 things from 5 piles with no more than 2 things from any one pile. So we are basically asking how many different ways can this happen. We can partition 4 in five different ways: $4, 3+1, 2+2, 2+1+1,$ and $1+1+1+1$. Since we aren't allowed to grab more than 2 from a pile, we can rule out the first two partitions. This leaves us with $2+2, 2+1+1,$ and $1+1+1+1$ as possible ways to pick from a pile.
There are $\binom{5}{2}=10$ ways to pick 2 from one pile and 2 from another pile.
There are $\binom{5}{1}\binom{4}{2}=30$ ways to pick 2 from one pile, 1 from another pile, and 1 more from yet a different pile.
There are $\binom{5}{4}=5$ ways to pick 1 from each pile.
So altogether you have $10+30+5=45$ ways to select any combination from the piles and so the probability is $\dfrac{1}{45}$.
For your more complicated answer for when you can have 4 or 5 balls, you need to repeat this kind analysis by considering how to partition 5.
