Hypergeometric testing I have a large container with 
21505 toys, **14,038 action figures (5,397 brands)** and 7,467 barbies (1 brand).
Sample:
37 toys consisting of 22 action figures (21 brands) and 15 barbies.

My question is not regarding the ratio of barbies to action figures but about the number of action figure brands sampled given a number of action figures.
I want to test if there is a significant increase in the number of brands obtained per action figure sampled  in the draw relative to the number of brands per action figure in the container. 
If : 
   q = the number of white balls drawn without replacement 
    m = number of white balls in the container.
    n = number of black balls in the container.
    k = number of balls drawn from the container.

Is this the correct? :
phyper(q=21,m=5397,n=(14038-5397),k=22,lower.tail=F)

Or maybe this:
phyper(q=21,m=5397,n=(21505-5397),k=37,lower.tail=F)

or 
phyper(q=21,m=5397,n=(21505-14038),k=37,lower.tail=F)

which (if any) is correct?
 A: Interesting question. I agree with @whuber's comment that you need to know more about the distribution of the number of action figures per brand. Accordingly, there would be two solutions. But before we delve into that, we have to realize that the hypothesis test is about the number of brands per action figure given the number of action figures. Thus, this test shouldn't have anything to do with a hypergeometric distribution or the number of barbies. Your p-value and test result would only depend on the number of action figures = 22 and number of brands = 21
Case 1: If you have the exact data for 14,038 action figures (i.e. which action figure is from which brand), then the correct way to do this would be a permutation test. Repeat the experiment multiple times (which you can since you have the population data) and record the number of brands per action figure (call this statistic $T$). This will give you the null distribution of $T$. You can use that to find the percentile of your sample ($=21/22=0.98$ in this case). That should give you the p-value (=1-percentile). [Do not multiply by two since this is a one sided test]
Case 2: If you do NOT have the entire data for the 14,038 action figures, then you should assume that they are equal for each brand (i.e. $5397/14038=0.38$). In this case, this essentially becomes a hypothesis test for binomial probability $H_O: p=0.38$ versus $H_a:p>0.38$. And your sample point is $21/22=0.98$ in this case. That should give you a p-value
