| Yes | No | Total | |
|---|---|---|---|
| Gender | |||
| Male | 21 | 3 | 24 |
| Female | 14 | 10 | 24 |
| Total | |||
| 35 | 13 | 48 | |
Introduction to Statistical Inference
Trent University
🔗 trentu.ca/wellness/cat/notetaking
📧 notetaking@trentu.ca
Sign up through the SAS Portal
At a first glance, does there appear to be a relationship between promotion and gender?
Promoted
|
|||
|---|---|---|---|
| Yes | No | Total | |
| Gender | |||
| Male | 21 | 3 | 24 |
| Female | 14 | 10 | 24 |
| Total | |||
| 35 | 13 | 48 | |
% of males promoted: 21 / 24 * 100 = 87.5
% of females promoted: 14 / 24 * 100 = 58.3
% difference: 87.5-58.3 = 29.2
We saw a difference of almost 30% (29.2% to be exact) between the proportion of male and female files that are promoted. Based on this information, which of the below is true?
We saw a difference of almost 30% (29.2% to be exact) between the proportion of male and female files that are promoted. Based on this information, which of the below is true?
“There is nothing going on.” (Null Hypothesis)
Promotion and gender are independent.
No gender discrimination.
Observed difference in proportions is simply due to chance.
“There is something going on.” (Alternative Hypothesis)
Promotion and gender are dependent.
There is gender discrimination.
Observed difference in proportions is not due to chance.
Hypothesis testing is very much like a court trial.
1
So we want to look at this data: 48 experimental units (bank supervisors) with results (35 promoted, 13 not), and determine whether we think the gender of the applicant is independent of the determination.
How?

We have 48 files: 24 were labelled ‘female’ (bottom 24) and 24 were labelled ‘male’ (top 24). Of these cards, 35 were ‘promoted’ (red) and 13 were ‘not promoted’ (white).
If the decision of the supervisors was independent of the gender of the applicant file, then the results we obtained were entirely due to chance. The files were all identical aside from the declared name/gender of the applicant, so we assume that each supervisor would have made the same decision regardless of the file presented.
We can use randomization to explore this scenario.
We can perform a randomization simulation, where we simulate what could have happened, under the scenario just mentioned. In such a simulation, we shuffle the 48 files (35 labelled as ‘promoted’ and 13 labelled as ‘not promoted’) and deal them out into two stacks: 24 into a pile labelled ‘female’ and 24 into a pile labelled ‘male’.
Even if the two are independent, we won’t expect the difference in the proportions to be exactly 0. For one thing, we have 35 ‘promoted’ cases, which we can’t divide evenly into two groups. So no matter what, there will be some difference in the two arbitrary (gender) groups.
How much variability is a sign of something suspicious going on?
That’s the point of statistics!
Promoted
|
|||
|---|---|---|---|
| Yes | No | Total | |
| Gender | |||
| Male | 18 | 6 | 24 |
| Female | 17 | 7 | 24 |
| Total | |||
| 35 | 13 | 48 | |
Difference: 18/24 - 17/24 = 0.0417.
So we did one simulation, and found a really small difference in promoted proportions, under the assumption that there is independence. Is this evidence?
Do it again!
Figure: Stacked dot plot of differences from 100 simulations under assumption of independence.
What was our observed statistic again? 0.292
The question we can answer, at the end of all of this, is:
How often would we see a result like 0.292, or even bigger?
And the answer is: around 2 times in 100 simulations.
The difference of 29.2% is a rare event if there really is no impact from listing gender in the candidates’ files, which provides us with two possible interpretations of the study results:
If \(H_0\), the Null hypothesis, is true: gender has no effect on promotion decision, and we observed a difference that is so large that it would only happen rarely.
If \(H_A\), the Alternative hypothesis, is true: gender has an effect on promotion decision, and what we observed was actually due to equally qualified female candidates being discriminated against in promotion decisions, which explains the large difference of 29.2%.
In our analysis, we determined that there was only approximately a 0.02 (2%) probability of obtaining a sample where 29.2% or more male candidates than female candidates get promoted under the null hypothesis, so we conclude that the data provide strong evidence of gender discrimination against female candidates by the male supervisors. In this case, we would side with the \(H_A\), alternative hypothesis, as a more plausible outcome.
Statistical inference is the practice of making decisions and conclusions from data in the context of uncertainty. Errors do occur, just like rare events, and the dataset at hand might lead us to the wrong conclusion.
While a given dataset may not always lead us to a correct conclusion, statistical inference gives us tools to control and evaluate how often these errors occur.
Earlier, we “did” a simulation where we just showed you the results. Now we’re going to do the entire simulation, properly, and then add up the results manually (in code). We will use pipes along with a new package, infer, that allows us to build hypothesis tests in the same way that we build ggplots.
Now, let’s pipe the data.frame into a specification, then establish our null hypothesis (independence), and generate permutation results.
Rows: 144
Columns: 3
Groups: replicate [3]
$ decision <fct> promoted, not promoted, not promoted, promoted, promoted, pr…
$ gender <fct> male, male, male, male, male, male, male, male, male, male, …
$ replicate <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
(why 144 rows? \(48 \times 3\))
We can then group these by replicate, and count the results:
# A tibble: 12 × 4
# Groups: replicate [3]
replicate gender decision n
<int> <fct> <fct> <int>
1 1 male promoted 17
2 1 male not promoted 7
3 1 female promoted 18
4 1 female not promoted 6
5 2 male promoted 19
6 2 male not promoted 5
7 2 female promoted 16
8 2 female not promoted 8
9 3 male promoted 19
10 3 male not promoted 5
11 3 female promoted 16
12 3 female not promoted 8
Finally, calculate the difference in proportion, male - female
Then our observed statistic used the breakdown of 21 / 24 and 14 / 24. How often do we see a result this big, or bigger?
[1] -0.04166667 0.12500000 0.12500000
[1] FALSE FALSE FALSE
[1] 0
Response: decision (factor)
Explanatory: gender (factor)
Null Hypothesis: ind...
# A tibble: 2 × 2
as_extreme n
<lgl> <int>
1 FALSE 99
2 TRUE 1
Response: decision (factor)
Explanatory: gender (factor)
Null Hypothesis: ind...
# A tibble: 2 × 2
as_extreme n
<lgl> <int>
1 FALSE 9745
2 TRUE 255
So in 10,000 replicates of this shuffling simulation, we saw a result like our observed statistic around 2.55% of the time. Not very likely!
Today’s topic was drawn from Chapter 11 of Introduction to Modern Statistics (2e).
