# Hypergeometric-like test for ordinal/interval variables

The problem:

Given an urn with $$N$$ balls of varying weights, with a mean (or median, in case of an ordinal variable) weight of $$x$$. The weights of all of the balls in the urn are known. If we were to draw a sample of $$m$$ balls without replacement (all balls are equally likely to be drawn), what is the probability that the sample will have a mean (or median, in case of an ordinal variable) of $$x$$ or more?

My question:

What would be the appropriate statistical method/test to answer this question?

Given its similarity to the Hypergeometric Test problem (where instead of weighted balls we have balls of different colors, and we measure the probability to draw $$n$$ or more of a specific color out of a sample of $$m$$), is there a known probability distribution that describes the probability of mean/median $$x$$ in $$m$$ draws without replacement?

• This works best if you ask one well-focused question at a time. So I will try to answer one of your questions. – BruceET Jun 1 '20 at 22:26

Suppose an urn has 1000 balls of varying weight. In this population of 2000, the mean weight is 20g. Now you sample $$n = 100$$ balls without replacement.

Because you are sampling less than 10% of the population, the observations will be nearly independent. Then you could use a 95% confidence interval based on mean weight of your 100 balls covers the population mean $$\mu = 20.$$ (If you take out too many of the balls without replacement, the ones chosen toward the end are limited by what has already been taken away, so dependence starts to be an issue.)

The formula for the 95% CI is $$\bar X \pm 1.984S/\sqrt{n}$$, where $$1.984$$ cuts probability $$0.925$$ from the upper tail of Student's t distribution with degrees of freedom $$\nu = n-1 = 99.$$ (Computation in R.)

qt(.975, 99)
[1] 1.984217


Here is a simulation in R statistical software:

set.seed(601)
urn = round(rnorm(2000, 20, 5))  # make population
mean(urn)
[1] 19.9645                      # urn has very nearly mean 20

x = sample(urn, 100)             # sample of 100 from population
mean(x)-1.984*sd(x)/sqrt(100)
[1] 18.60179                     # lower confidence limit
mean(x)+1.984*sd(x)/sqrt(100)
[1] 20.45821                     # upper confidence limit
t.test(x)\$conf.int
[1] 18.60169 20.45831            # 95% CI from t.test procedure
attr(,"conf.level")             #  ... with less rounding
[1] 0.95


There is a 50-50 chance that $$\bar X$$ of the sample will be above (or below) the population mean $$\mu = 20.$$ Among samples of size $$n = 100$$ from this urn over the long run 95% of them will make confidence intervals that contain $$20.$$ Ours was one of the 95% of 'lucky' CIs.

Here are simulation results from $$100\,000$$ samples of size 100 from such urns with 2000 balls averaging 20g. Very nearly half of the samples had averages at or below 20g.

set.seed(2020)
a = replicate(10^5, mean(sample(rnorm(2000, 20, 5), 100)))
mean(a <= 20)
[1] 0.50217