-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDI.qmd
More file actions
230 lines (169 loc) · 8.76 KB
/
DI.qmd
File metadata and controls
230 lines (169 loc) · 8.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
---
format: html
editor: visual
theme: default
---
```{r setup, include=FALSE}
# Load required packages
library(dplyr)
library(ggplot2)
library(png)
library(ggimage)
library(ggwaffle) #devtools::install_github("liamgilbey/ggwaffle")
library(emojifont)
library(MetBrewer)
library(tidyverse)
```
::: {.content-visible when-profile="english"}
# About the Disproportionality Index
## Estimating Median Salary
[Median salaries](https://employment-equity.github.io/Visualizations.html#median-salary-tables) for each group were estimated using the following formula:
$$median = L + \frac{ (\frac{n}{2} – F) }{f} * w$$
## Calculating DI
In this analysis, Disproportionality Index (DI) is used as a measure of equitable representation. It is calculated as below.
$$\frac{\%_{Group\: X; \:salary\: range \: i}}{\% _{All \:Employees; \:salary\: range \: i}} = DI _{Group\:X; \:salary\:range\:i}$$
For example, 23.51% of Black employees and 16.70% of all employees are are within the \<60K salary range. This gives us a DI of 1.41.
$$ DI_{Black \: employees; <60K } =\frac{23.51\%}{16.70\%} = 1.41$$
For a table of DI's per year, [please see here](https://employment-equity.github.io/Visualizations.html#disproportionality-tables).
## Understanding DI - An Example
Suppose that we have a department of 500 employees. There are two groups of self-identifying minority employees, A and B. Group C is composed of the majority at 460 employees. Groups A and B make up 4% of employees at 20 employees each, which happens to mirror the Canadian population. At a glance, representation seems equal.
```{r Plot-1, echo = FALSE}
# Create dataframe with group numbers repeated
Dept_data <- tibble(Group_count = rep("A", 20) %>%
c(rep("B", 20)) %>%
c(rep("C", 460)) )
# Move data to waffle object for plotting
Dept_data_waffle <- waffle_iron(Dept_data,
aes_d(group = Group_count),
rows = 20) %>%
mutate(label = fontawesome('fa-male'))
## Plot symbols -----------------------------------------------
# Create color palette
colors <- c(met.brewer("Johnson", 5)[c(1,5)], "#808080")
# Plot as waffle
ggplot(Dept_data_waffle, aes(x, y, colour = group)) +
geom_text(aes(label=label),
family = 'fontawesome-webfont',
size = 5) +
coord_equal() +
scale_colour_manual(values = c(colors)) +
theme_waffle() +
theme(axis.title.x = element_blank(),
axis.title.y = element_blank(),
text = element_text(size = 12)) +
guides(color = guide_legend(title="Group"))
```
However, if you take a closer look at how the 20 employees from group A and B are distributed across salary levels, a different story appears. Group A is equally distributed among salary level, but the majority of group B employees remain at the lowest salary levels.

Calculating DI further illustrates the differences in salary distribution. Above a DI of 1, a group's representation at a salary level is higher than the average of all employees. Below a DI of 1, a group's representation at a salary level is lower than the average of all employees.
```{r Plot 2-DI Example, echo = FALSE, message = FALSE, warning = FALSE}
Group <- c(rep("A", 5), rep("B", 5))
Salary <- c("<60.0K", "60.0-69.9K", "70.0-84.9K", "85.0-99.9K", "100.0K+", "<60.0K", "60.0-69.9K", "70.0-84.9K", "85.0-99.9K", "100.0K+")
DI <- c(.75, 1, 1.25, 1, 1, 1.5, 1.5, 1, .75, .25)
Salary_di <- data.frame(Group, Salary, DI)
Salary_di$Salary <- factor(Salary_di$Salary, levels = c("<60.0K", "60.0-69.9K", "70.0-84.9K", "85.0-99.9K", "100.0K+"))
colors <- c(met.brewer("Johnson", 5)[c(1,5)])
ggplot(Salary_di) +
geom_bar(stat = "identity",
position = "dodge",
aes(x = Group,
y = DI,
fill = Group,
alpha = Salary)) +
theme_minimal() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"),
text = element_text(size = 15),
legend.text = element_text(size = 12)
) +
scale_fill_manual (values = colors,
) +
labs(title = NULL,
x = "Group",
y = "Disproportionality Index",
fill = NULL) +
guides(fill="none") +
geom_hline(yintercept = 1,
linetype = "dashed")
```
:::
::: {.content-visible when-profile="french"}
# Sur l'indice de disproportionnalité
## Estimation du salaire médian
[Les salaires médians](https://employment-equity.github.io/Visualizations.html#median-salary-tables) pour chaque groupe ont été estimées à l'aide de la formule suivante:
$$médian = L + \frac{ (\frac{n}{2} – F) }{f} * w$$
## Calcul de l'ID
Dans cette analyse, l'indice de disproportionnalité (ID) est utilisé comme mesure de la représentation équitable. Il est calculé comme suit.
$$\frac{\%_{Groupe\: X; \:échelle\: des \:salaires \: i}}{\% _{Tous \:les \:Employees; \:échelle\: des \:salaires \: i}} = DI _{Groupe\:X; \:échelle\: des \:salaires\:i}$$
Par exemple, 23,51 % des employés noirs et 16,70 % de l'ensemble des employés se situent dans la fourchette salariale \<60K. Cela nous donne un DI de 1,41.
$$ DI_{Employés \:de \:race \:noire \:<60K } =\frac{23.51\%}{16.70\%} = 1.41$$
Pour un tableau des DI par année, [voir ici](https://employment-equity.github.io/fr/Visualizations.html#tableau-des-salaires-m%C3%A9dians).
## Comprendre l'ID - Un exemple
Supposons que nous ayons un département de 500 employés. Il y a deux groupes d'employés s'identifiant comme des minorités, A et B. Le groupe C est composé de la majorité, soit 460 employés. Les groupes A et B représentent 4 % des employés, soit 20 employés chacun, ce qui correspond à la population canadienne. À première vue, la représentation semble égale.
```{r, echo = FALSE}
# Create dataframe with group numbers repeated
Dept_data <- tibble(Group_count = rep("A", 20) %>%
c(rep("B", 20)) %>%
c(rep("C", 460)) )
# Move data to waffle object for plotting
Dept_data_waffle <- waffle_iron(Dept_data,
aes_d(group = Group_count),
rows = 20) %>%
mutate(label = fontawesome('fa-male'))
## Plot symbols -----------------------------------------------
# Create color palette
colors <- c(met.brewer("Johnson", 5)[c(1,5)], "#808080")
# Plot as waffle
ggplot(Dept_data_waffle, aes(x, y, colour = group)) +
geom_text(aes(label=label),
family = 'fontawesome-webfont',
size = 5) +
coord_equal() +
scale_colour_manual(values = c(colors)) +
theme_waffle() +
theme(axis.title.x = element_blank(),
axis.title.y = element_blank(),
text = element_text(size = 12)) +
guides(color = guide_legend(title="Groupe"))
```
Toutefois, si l'on examine de plus près la répartition des 20 salariés des groupes A et B entre les différents niveaux de salaire, la situation est différente. Le groupe A est également réparti entre les niveaux de salaire, mais la majorité des salariés du groupe B restent aux niveaux de salaire les plus bas.

Le calcul de l'ID illustre davantage les différences dans la répartition des salaires. Au-dessus d'un ID de 1, la représentation d'un groupe à un niveau de salaire est supérieure à la moyenne de l'ensemble des salariés. En dessous de 1, la représentation d'un groupe à un niveau de salaire est inférieure à la moyenne de l'ensemble des salariés.
```{r, echo = FALSE, message = FALSE, warning = FALSE}
Group <- c(rep("A", 5), rep("B", 5))
Salary <- c("<60.0K", "60.0-69.9K", "70.0-84.9K", "85.0-99.9K", "100.0K+", "<60.0K", "60.0-69.9K", "70.0-84.9K", "85.0-99.9K", "100.0K+")
DI <- c(.75, 1, 1.25, 1, 1, 1.5, 1.5, 1, .75, .25)
Salary_di <- data.frame(Group, Salary, DI)
Salary_di$Salary <- factor(Salary_di$Salary, levels = c("<60.0K", "60.0-69.9K", "70.0-84.9K", "85.0-99.9K", "100.0K+"))
colors <- c(met.brewer("Johnson", 5)[c(1,5)])
ggplot(Salary_di) +
geom_bar(stat = "identity",
position = "dodge",
aes(x = Group,
y = DI,
fill = Group,
alpha = Salary)) +
theme_minimal() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"),
text = element_text(size = 15),
legend.text = element_text(size = 12)
) +
scale_fill_manual(values = colors,
) +
labs(title = NULL,
x = "Groupe",
y = "Indice de disproportionnalité",
fill = NULL,
alpha = "Salaire") +
guides(fill="none") +
geom_hline(yintercept = 1,
linetype = "dashed")
```
:::