Statistical test for comparing two frequencies with R i have this situation. A set of 5000 objects, 4950 blue and 50 green. From this set two people (person A and person B) fish separately 100 objects each and i would like to know if one of the two people has tricked me (not fishing blinded).


*

*person A fished one set of 100 objects, 90 blue and 10 green.

*person B fished one set of 100 objects, 99 blue and 1 green (that would be expected by chance)


Which test should i use? Could someone point me to a R example/solution about it?
Thanks in advance
 A: The first idea that comes to mind would be to compute the likelihood of fishing each set of 100 objects, and using a threshold on this likelihood to detect cheaters.
If you know what cheaters would be inclined to do (for example, green objects are more desirable and they would boost their number of green objects fished), then you can look for that directly.
In the example you gave, it seems like you have a 0.01 probability of fishing a green object. This is a Bernoulli trial, and the distribution for the number of green objects in 100 trials follows a binomial distribution $X \sim B(100, 0.01)$. You can use the cumulative distribution function for the binomial distribution to determine at how many green objects you should start worrying (essentially, find the $x$ for which $P(X \geq x) < p$ where $p$ is how unlikely a result must be for it to be worrisome)
A: Edit: Fisher's exact is the wrong test, but a hypergeometric test is appropriate.
Following the answer to a similar question, you can test how "unlikely" either proportion is using Fisher's exact test or a hypergeometric test. From your question, you're interested in whether the proportion of blue:green for either person (90:10 person A, 99:1 person B) significantly differs from the true proportion (4950:50). In that case you have two contingency tables:
$$
\array{& \text{Blue} & \text{Green} \\\text{Person A} & 90 & 10 & 100\\\text{Truth} & 4950 & 50 & 5000 \\ & 5040 & 60}
$$
$$
\array{& \text{Blue} & \text{Green} \\\text{Person B} & 99 & 1 & 100\\\text{Truth} & 4950 & 50 & 5000 \\ & 5049 & 51}
$$
and you'd want to test both tables. Since the hypergeometric distribution models the probability of getting a certain number of draws without replacement, i.e. your situation, you can use phyper in R to run a hypergeometric test:
pA = phyper(10-1,50,4950,100, lower.tail=F)
pB = phyper(1-1,50,4950,100, lower.tail=F)

Which gives pA=3.4e-08 and pB=0.64. (The -1 in phyper(10-1,...) because we want the probability of getting greater than or equal to that number of green draws.)
So, by the logic of the hypergeometric test, Person A's basket of fish is highly unlikely to have occurred by chance, while person B's basket is totally reasonable.
A: This answer was corrected according to the comment of phuber.
You need to use the hypergeometric distribution. In contrary to the binary distribution, the hypergeometric distribution is for drawing without replacement.
https://en.wikipedia.org/wiki/Hypergeometric_distribution
In R, the hypergeometric test of the hypergeometric distribution is implemented using phyper.
phyper(x, m, n, k)

x are the drawn green objects, 
m are the total green objects in the set,
n are the total blue objects in the set,
k are the total number of objects drawn
With your numbers, this results in
pA = phyper(10-1,50,4950,100, lower.tail=F)
pB = phyper(1-1,50,4950,100, lower.tail=F)
The -1 in phyper(10-1,...) is there because we want the probability of getting greater than or equal to that number of green draws.
