# Sampling from a fixed population

Here's a real basic question. I'm trying to teach myself a bit of stats with Verzani's Using R for Introductory Statistics.

In question 5.13 he asks: A sample of 100 people is drawn from a population of 600,000. If it is known that 40% of the population has a specific attribute, what is the probability that 35 or fewer in the sample have that attribute.

Now, I guess you're supposed to reason that the population is sufficiently large that assuming independent Bernoulli trials is close enough. Then, you get your answer like this:

> pbinom(35,100,0.4)

 0.1794694


My question is this. How would you go about answering a question like that without assuming independence, say if the population was smaller.

I'm sure it'll become obvious after I read more. Just trying to make sure I'm not missing something. Sorry for the intro level question.

Thanks!

When sampling without replacement, the distribution is a hypergeometric one. The problem is usually presented as follows: in an urn with $n$ (600.000) marbles, $m$ (40% = 240.000) are red, $n-m$ (60% = 360.000) are black. What is the probability of picking $r$ (35) red marbles in a sample of $k$ (100) marbles? The error by assuming sampling with replacement is really small when $n$ is very large, such as in your case (thanks Henry!).

$\begin{array}{r|ll|l} ~ & y_{1} & y_{2} & \Sigma \\\hline x_{1} & r & m-r & m \\ x_{2} & k-r & ~ & n-m \\\hline \Sigma & k & n-k & n \end{array}$

In R: dhyper(r, m, n-m, k). For the total probability of $0, \ldots, r$ marbles: phyper(r, m, n-m, k):

> phyper(35, 240000, 360000, 100)
 0.1794489

# check
> sum(dhyper(0:35, 240000, 360000, 100))
 0.1794489


Google "finite population correction" for correcting the error when computing sample mean and variance with small populations.

• That shows there is only a little difference when the population is big. It is worth noting that there is a large difference when it is small: with 600 [phyper(35, 240, 360, 100)] gives about 0.157 while an even more extreme example of 110 [phyper(35, 44, 66, 100)] gives about 0.001 – Henry Feb 20 '11 at 0:35
• @Henry Good catch, edited my answer to stress the importance of big $n$. – caracal Feb 20 '11 at 0:44
• Thanks caracal and Henry. It's really helpful as a beginner to have a few hints about where you're heading. – cbare Feb 20 '11 at 4:00