Binomial distribution for gender discrimination?

I could be on the wrong path, but I'm trying to use binomial distribution to identify gender discrimination and am having issues getting consistent results based on trial size(?)... I think. Small numbers work as expected, large numbers do not.

An example that works: 16 people are hired. 2 are women. What is the chance this happened randomly? (x)=2, (n)=16, (p)=.5. Example below [from R] show what I expected.

pbinom(2, size=16, prob=0.5)
#0.0021 -> .2% chance that there is no gender discrimination


An example that doesn't work: 1150 people are hired. 350 are women. What is the chance this happened randomly? (x)=350, (n)=1150, (p)=.5. Example below [from R] does not show what I expected.

pbinom(350, size=1150, prob=0.5)
# 2.388788e-41 -> ?!


• What did you expect in the second case? Oct 6 '21 at 21:12
• Your examples are not relevant to questions concerning gender discrimination, so your initial premise looks valid: this is not the right path. There is a lot of accessible literature on applying statistics to discrimination disputes--it's well worth researching. EEOC guidance is helpful, too (in the US).
– whuber
Oct 6 '21 at 21:21
• @Ryan Where does the gender distribution of the applicants figure into this? The presented approach only yields usefull answers if the gender distribution among teh applicants is roughly 50:50. If only 2 women applied in your first example and all 2 were hired, than there is no bias against women, 100% of those that applied were hired. Oct 8 '21 at 12:43
• ".2% chance that there is no gender discrimination" - this is a misinterpretation of a p-value. The p-value does not give the "chance that the H0 is true", rather the probability of an event assuming that it is true. Oct 9 '21 at 9:37
• @Accumulation The reason you cannot assume a process that is as equally likely to result in a man being hired as a woman is because that doesn't account for the probability of an applicant being female in the first place (a priori probability). So with your assumption, even if 0 women applied (i.e. probability_applicant_female = 0), there should still be 50 % chance of a hired person being female. That is obviously absurd. Oct 9 '21 at 10:00

Bruce's answer is great. I'd like to provide another way of interrogating whether the results you've observed are reasonable. It's easy to look at a p-value and think it's "wrong" with respect to our intuitions about the observed data and our model.

It might help to reframe this by thinking about what data our model would generate under the null hypothesis. As whuber pointed out, gender bias in hiring is a complex topic, so I'm referring here to "number of heads", as in the number of coin flips that come up heads. However in principle the same issues would apply to any binomial model given appropriate assumptions are met.

First, let's simulate what number of heads we get if we flip 16 coins in a row, and repeat that simulation 10,000 times. What's the distribution of results, and where does 2 lie on that distribution?

a <- replicate(10000, rbinom(1, size = 16, prob = 0.5))
hist(a,
breaks = "FD",
main = "Histogram of number of heads when n=16, p=0.5"
)
abline(v = 2, lty = "dashed")


2 is present in our simulated data but at a pretty low frequency. Therefore .2% seems at least in the right ballpark. Bear in mind, we're only doing 10,000 replicates, so there will of course be error.

Now, let's simulate what number of heads we get when simulating 1150 flips, repeat that process 10,000 times, and visualise the distribution along with your observed value of 350:

b <- replicate(10000, rbinom(1, size = 1150, prob = 0.5))
hist(b,
breaks = "FD",
main = "Histogram of number of heads when n=1150, p=0.5"
)
abline(v = 350, lty = "dashed")


Huh. 350 isn't even visible on the distribution unless we manually adjust the x-axis!

## in fact 350 isn't visible unless we set xlim
hist(b, breaks = "FD",
xlab = "Number of heads", xlim = c(340, max(b) * 1.1),
main = "Histogram of number of heads when n=1150, p=0.5"
)
abline(v = 350, lty = "dashed")


This shows that for a binomial distribution with $$p=0.5$$ and $$n=1150$$, $$x=350$$ is a really weird result! Therefore an extremely small p-value isn't surprising. I think you would need in the range of 1e40 simulations to observe one value that extreme, in fact...

• Nice graphs (+1) Oct 7 '21 at 2:11
• fwiw, replicate(10000, rbinom(1, size = 1150, prob = 0.5)) could be rbinom(10000, size = 1150, prob = 0.5). Not sure why I went with the former, I think for clarity Oct 7 '21 at 11:11
• Thank you for these graphs. They're really useful for understanding the p-values (how extreme the value is compared to the simulations).
– Ryan
Oct 7 '21 at 21:13

Assume that one is hiring from a large pool of equally qualified applicants of whom half are women and half are men. The number of women hired out of $$n$$ is $$X.$$ Suppose that $$p$$ is the probability that any one hire will be a women.

Perhaps you want to test The null hypothesis $$H_0: p = 1/2$$ against $$H_a: p < 1/2.$$

For $$n = 16, x = 2$$ the P-value of this test is given in R as follows:

binom.test(2, 16, .5, alt="less")

Exact binomial test

data:  2 and 16
number of successes = 2, number of trials = 16, p-value = 0.00209
alternative hypothesis:
true probability of success is less than 0.5
95 percent confidence interval:
0.0000000 0.3438252
sample estimates:
probability of success
0.125


The P-value can also be found as follows:

pbinom(2, 16, .5)
[1] 0.002090454


Perhaps a more even-handed approach would be to test $$H_0: p= 1/2$$ against $$H_a: p\ne 1/2,$$ perhaps allowing for the possibility that the hiring process might be biased in either direction. It turns out that the P-value of this 2-sided test is twice the P-value of the 1-sided test.

binom.test(2, 16, .5)

Exact binomial test

data:  2 and 16
number of successes = 2, number of trials = 16, p-value = 0.004181
alternative hypothesis:
true probability of success is not equal to 0.5
95 percent confidence interval:
0.0155136 0.3834762
sample estimates:
probability of success
0.125


A major difficulty in interpreting results of these tests arises in justifying the assumption that "a large pool of equally qualified applicants of whom half are women and half are men" was used--or is available. Without addressing such much more difficult issues, counts of women hired may lead to 'statistical significance', but not likely to persuasion. @whuber's Comment provides useful advice.

For data with 350 women hired out of 1150, the P-values of one- and two-sided tests are shown below. Both of the P-values are very nearly $$0,$$ indicating that the observed $$\hat p =X/n = 350/1150 = 0.304$$ is inconsistent with $$p = 1/2.$$

binom.test(350, 1150, .5, alt="less")$$p.val [1] 2.388788e-41 binom.test(350, 1150, .5)$$p.val
[1] 4.777577e-41

• Thank-you this is incredibly helpful to consider one and two sided tests as well as the other approaches.
– Ryan
Oct 7 '21 at 20:56

Before you get to the statistical mechanics this this type of test, you need to step back and make sure you remember the injunction that "correlation is not cause". Gender discrimination is one possible cause of non-equal hiring probabilities but there are many other possible causes, most commonly involving correlation between gender and relevant skills or qualifications for the position. Moreover, for the data in your question, we don't even have the number of applicants of each gender, so the probabilities we can estimate are not even conditional on applying for the position --- i.e., they are not "hiring probabilities" at all; they are joint probabilities of applying and then being hired. If males and females have unequal probabilities, that does not prove gender discrimination.

For this reason, it is best to do this type of analysis by first framing it in purely statistical terms where you are testing whether or not the probability of applying-and-being-hired is the same for a male or a female. For the data you have this would typically be done using a two-sided binomial test.$$^\dagger$$ Using the smaller dataset you can see from the test below that there is evidence of a non-equal joint probability for this event. (For the larger dataset the evidence for an unequal probability is much stronger).

#Perform test for equal probability
binom.test(2, 16, conf.level = 0.99, alt = "two.sided")

Exact binomial test

data:  2 and 16
number of successes = 2, number of trials = 16, p-value = 0.004181
alternative hypothesis: true probability of success is not equal to 0.5
99 percent confidence interval:
0.006658398 0.462758698
sample estimates:
probability of success
0.125


Now that you have established evidence of non-equal probabilies you can have a think about what, if any, causal inferences you can make. In particular, you will need to think about whether there is anything in the experimental setup that would allow you to reject other causal explanations for unequal probabilities (e.g., men more likely to apply, men more likely to have required skills for the position, etc.). Without more, it would be extremely dubious to use this statistical evidence to conclude that gender discrimination has occurred.

If you would like to read more about this topic, I recommend reading some studies on gender discrimination in hiring in labour economics. Studies on this topic typically either conduct randomised controlled trials (RCTs) using fake CVs with randomised sex assignment, or they use observational data and attempt to filter out confounding variables using regression methods. Another method is to look at skill and qualification metrics of people within the organisation, filtering for their organisational level and other covariates, and then see if there is any residual correlation between the skills/qualifications and gender; if there is, this can suggest gender discrimination against the group with higher residual skill values (i.e., these are higher because the discrimination causes a more strict filter for hiring/promotion for people in that group). This is quite a complicated field, and it involves much more than the kinds of gross statistical comparisons in output that are being compared here. It generally involves deeper thinking about relationships between cause and statistical association.

$$^\dagger$$ Some analysts will recommend a one-sided test, since you with to test the alternative that women have a lower probability of applying-and-being-hired. My view is that two-sided tests should be performed, so as not to bias the testing in favour of a hypothesis that might have been influenced by the data.

• This. Especially the first couple paragraphs. It is left to one's imagination how many articles and statistics, the authors of which fail to understand the basics of causes & correlations outlined in your answer, are published regularly. Oct 8 '21 at 16:35

The results are consistent.

The differences in p-values that you get with trial size is as expected.

The dependency of the result on the parameter $$n$$ occurs because the distribution becomes more narrow.

The same relative deviation becomes less probable when $$n$$ increases.

See the below example (adapted from here) for the distribution of the observed number of women $$k$$ and the fraction of women $$f$$ as a function of the number of workers $$n$$.

Related question is How to estimate a probability of an event to occur based on its count?

Consistency

The fact that the same effect size (e.g ratio of women) becomes more significant is a good thing.

This relates to 'statistical consistency'*, and this is a desirable property. It means that we can make estimates better (as much as we want) by collecting larger samples.

So that is what you did with your sample of 1150, it is a more accurate estimate of the ratio of women than the sample of 16.

*An estimator is consistent if 'The probability for the estimator to differ by a certain quantity from the true value approaches zero, when we increase the sample size'.

Sidenote: Strictly speaking you only observed that the ratio of women is different from 0.5. But is this also discrimination?

Sidenote: This comparison of the 'deviation from the middle' is at the origin of p-values and the normal distribution. In 1710 similar comparisons were made by Arbuthnot comparing ratios in the birth of boys and girls. It is one of the first cases of expressing a p-value.

In basic hypothesis testing, we articulate a null hypothesis, choose an ordering of results, collect data, and then find the probability, given the null hypothesis, of getting results that are, according to the ordering we chose, as extreme or more extreme as the results that we found.

That's it. We find the probability of the results given the hypothesis. Nothing else.

We do not find the probability of the hypothesis given results. We do not find the probability of some hypothesis other than the null hypothesis.

In your case, the null hypothesis is that each hiring decision is a Bernoulli trial, each one is independent of the others, and the probability for each is 0.5. Your ordering is "more men is more extreme". The number 0.0021 you found is the probability of getting as many men or more, given those premises. It is not the probability of there being no gender discrimination. Not only are you confusing $$P(E|H)$$ and $$P(H|E)$$, there are many alternative hypotheses other than "there in gender discrimination". For instance, there could be fewer qualified female candidates, or the hirings could be not independent.

As for the effect of larger sample size, the number of standard deviations scales with the square root of the sample size. That is, in the examples you gave, the sample size was multiplied by 71.875, and square root of that is 8.48, so deviations from the expected mean of 0.50 represent 8.48 as many standard deviations.