# Probability of the deviation from the expected value of hypergeometric distribution

We have 40 people from city A and 60 people from city B. In total we have $N=100$

Now we take a random sample $n=20$. In this sample we got 5 people from city A and 15 people from city B.

But if we calculate the expected value from people which are from city A then we get

$$E[X]=n\cdot\frac{M}{N}$$ $$E[X]=20\cdot\frac{40}{100}=8$$

$M$ are the people from city A

No we want to calculate the probability of the deviation from the expected value

$$\mathbb{P}(|X-8|\ge3)$$

I just searched a little bit in the web and I found the Chebyshev's inequality

$$\mathbb{P}(|X-\mu|\ge\epsilon)\le \frac{\sigma^2}{\epsilon^2}$$

I calculated the variance ${\sigma^2}$ of the hypergeometric distribution

$$n\cdot\frac{M}{N}\left(1-\frac{M}{N}\right)\cdot\frac{N-n}{N-1}$$

$$n\cdot\frac{40}{100}\left(1-\frac{40}{100}\right)\cdot\frac{100-n}{100-1}=\frac{128}{33}$$

Now we can use this values for the Chebyshev's inequality

$$\mathbb{P}(|X-8|\ge 3)\le \frac{\frac{128}{33}}{3^2}=\frac{128}{297}\approx 0,4309$$

Is my approach correct and are there better ways to get the probability instead of using the Chebyshev's inequality?

• You might get a better bound by using the fact that $$\mathbb{P}(|X - \mu| \geq \lambda ) \leq z^{-\lambda}\mathbb{E}[z^{|X-\mu|}], \quad \forall z >1.$$ – ChargeShivers Nov 15 '17 at 19:16 You'd then sum this over all integer values of y that meet the criteria. Some computer algebra programs can calculate this directly. Here it is done both ways in Mathematica.

{
Probability[Abs[x-8]>=3,x\[Distributed]HypergeometricDistribution[20,40,100]],

1-Sum[(Binomial[M,y] Binomial[-M+NN,n-y])/Binomial[NN,n],{y,6,10}]/.{n->20,M->40,NN->100}
}



Try it online!

The closed form solution below appears to be much more complex than the summation. • Thank you this helped me a lot. But how do I write this formally correct. This is just some code. – Anil Nov 15 '17 at 16:11