# How can I calculate the continuous cumulitive density function for a hypergeometric distribution?

I have a sample from a large population where it is possible to select either a 1 or a 5. I want to find the probability that the average in any sample is greater than 4.76, and I want to chart the probability of selecting a sample with average greater than 4.76 as the sample size increases. I assume the probability starts off higher, and decreases.

I have here the PMF: https://en.wikipedia.org/wiki/Hypergeometric_distribution

The problem here is that the PMF only really works with integer values, and I would like to find a continuous theoretical function to show that the probability of getting an average of 4.76 or greater decreases as the sample size gets larger.

For example, with a sample size of 2, you would basically have to select 2 fives to get an average of 4.76 or greater, the average in that case being five. What I would like to be able to get is the theoretical probability that would be estimated if it were possible to select 1.X or one and a fraction of a five.

The population, however large, is assumed to have a mean of 4.76.

Am I just overcomplicating this? Would the answer really just be 50% if it could be done that way?

• The average is definitely discrete, not continuous. You can either deal with it by working with the sum (n times the average, taking you back to integers, making it a bit easier to work with), or you can attempt continuous approximation (which is sometimes suitable and sometimes not -- under suitable conditions you may be able to use a Gaussian approximation). Commented Sep 1, 2019 at 0:36
• I'm trying to chart the probability of scoring over 4.76 as the sample size increases with an arbitrarily large population of the same proportions. My goal (hypothesis) is to show that the odds of scoring over 4.76 go down as sample size increases. With the discrete version, I get a chart that goes down and then shoots up every so often, and it is not 100% clear that I am right. I was thinking of running a regression through it, but that's not quite satisfying. Commented Sep 1, 2019 at 12:15
• I looked up the stirling approximation and was able to apply that to the PMF for integer values, but I was just stuck on whether it was possible to do a similar approximation for the CDF. Is that not possible? Commented Sep 1, 2019 at 12:15
• Why do you need the Stirling approximation? Computers can evaluate these things to high accuracy. They can evaluate common discrete pmfs and cdfs Commented Sep 2, 2019 at 4:32

This seems pretty straight forward to me. The average is given as

$$\overline{x}=\frac{n_1+5n_5}{n}=5-4\frac{n_1}{n}$$

where $$n_1$$ is the number of samples equal to 1, and $$n_5=n-n_1$$ is the number of samples equal to 5. So, your problem now boils down to $$\frac{n_1}{n}\leq 0.06$$ or $$n_1\leq 0.06n$$. The probability for this is given by the cdf, which is given on your linked Wikipedia page. The population values satisfy $$N_1=0.06N$$ and $$N_5=0.94N$$ (by your assumption). The normal approximation should work well here for large $$n$$ (you already assume $$N$$ is large), where $$E(n_1)=0.06n$$ and $$var(n_1)=0.06(0.94)n\frac{N-n}{N-1}\approx 0.06(0.94)n(1-\frac{n}{N})$$. This means the "z-value" is actually $$z=\frac{0.06n-E(n_1)}{\sqrt{var(n_1)}}=0$$ which as you can see, does not depend on $$n$$ or $$N$$. As the z-value is zero, the probability is $$Pr(n_1\leq 0.06n)\approx 0.5$$.

looking at your case, if $$n\leq 16$$ then to get the average over $$4.76$$ you need all the samples to be equal to 5. Using the binomial approximation the probability is $$0.94^n$$. This starts out at $$0.94$$ for $$n=1$$ and then decrease down to $$0.37$$ for $$n=16$$. Then when $$n=17$$ you can have a single 1 in the sample, because $$\frac{1\times 1+16\times 5}{17}=4.765>4.76$$. This means the probability changes to $$0.94^n+n\times 0.94^{n-1}0.06$$ which is $$0.728$$ for $$n=17$$. as before it decreases to $$0.403$$ for $$n=33$$. Then, when $$n=34$$ we can now have two samples of 1, so that we have $$0.94^n+n\times 0.94^{n-1}0.06+\frac{n(n-1)}{2}\times 0.94^{n-2}0.06^2$$. This is equal to $$0.666$$ for $$n=34$$ and decreases down to $$0.43$$ for $$n=49$$. Then it can be 3 ones in the sample (assuming it can be exactly 4.76). If you plot this, you will see a zig-zag pattern around 0.5, with the gap becoming smaller and smaller.

The Wikipedia page also contains some bounds for the probability $$Pr(n_1\leq (0.06-t)n)\leq \exp(-2t^2n)$$. obviously $$0 for the equation to make sense. A more tight bound is given by replacing $$2t^2$$ with $$(0.06-t)\log\left(1-\frac{t}{0.06}\right)+(0.94+t)\log\left(1+\frac{t}{0.94}\right)$$.

Hypergeometric distribution does not have continuous cumulative distribution function, nor probability density function, because it is a distribution for a discrete random variables. It's support are only the non-negative integers.

Moreover from your description I don't see why exactly would you like to use hypergeometric distribution for this data. If your data consists only of "ones and fives", then it's certainly not hypergeometric. It has only two possible states, so if your variable is $$X$$, then $$(X-1)/4$$ follows Bernoulli distribution.

From your description however it seems that you're not interested in the distribution of the random variable, but the distribution of the mean of large number of independent and identically distributed samples, and this by central limit theorem follows normal distribution.

• I looked up the stirling approximation and was able to apply that to the PMF for non-integer values, but I was just stuck on whether it was possible to do a similar approximation for the CDF. Is that not possible? Commented Sep 1, 2019 at 12:16
• @Mr.A see my edit.
– Tim
Commented Sep 1, 2019 at 15:07