ess_gb %>%
select(hinctnta) %>%
freq() %>%
as.data.frame() %>%
ggplot(aes(x=factor(rownames(.),
levels= c(1:10)),
y=`%`)) +
geom_col() +
labs(title = "Distribution of Household Income Deciles",
x = "Household Income Decile")
It is important to note that a greater proportion of the individuals
surveyed have relatively high household income; rich people are
over-represented while poor people are under-represented in the ESS
dataset.
This table provides some interesting information; we can see people’s
inclination to find partners who have similar or the same education
level as them.
Mission 7
eduincome <- datasummary_crosstab(hinctnta ~ eisced, data = ess_gb)
eduincome
hinctnta
1
2
3
4
5
6
7
All
1
N
72
24
26
31
19
21
10
203
% row
35.5
11.8
12.8
15.3
9.4
10.3
4.9
100.0
2
N
157
41
44
41
50
15
20
368
% row
42.7
11.1
12.0
11.1
13.6
4.1
5.4
100.0
3
N
134
50
55
58
60
27
15
399
% row
33.6
12.5
13.8
14.5
15.0
6.8
3.8
100.0
4
N
107
50
46
52
84
33
36
408
% row
26.2
12.3
11.3
12.7
20.6
8.1
8.8
100.0
5
N
70
72
66
66
80
57
49
460
% row
15.2
15.7
14.3
14.3
17.4
12.4
10.7
100.0
6
N
64
77
66
77
115
77
56
532
% row
12.0
14.5
12.4
14.5
21.6
14.5
10.5
100.0
7
N
42
74
63
82
132
99
88
580
% row
7.2
12.8
10.9
14.1
22.8
17.1
15.2
100.0
8
N
33
75
59
106
130
136
111
650
% row
5.1
11.5
9.1
16.3
20.0
20.9
17.1
100.0
9
N
17
51
42
65
108
151
155
589
% row
2.9
8.7
7.1
11.0
18.3
25.6
26.3
100.0
10
N
21
48
31
79
113
211
245
748
% row
2.8
6.4
4.1
10.6
15.1
28.2
32.8
100.0
All
N
717
562
498
657
891
827
785
4937
% row
14.5
11.4
10.1
13.3
18.0
16.8
15.9
100.0
The correlation between educational level and household income decile
is evident. Higher income deciles consist of more highly educated
individuals.
Mission 9
edu_levels <- c(1:7)
incomes <- c()
for (i in1:7) {
nmsl <- ess_gb %>% filter(eisced == i)
incomes <- c(incomes, mean(nmsl$hinctnta))
}
df <- data.frame(
inc = incomes,
edu = edu_levels
)
graph <- ggplot(df, aes(x = edu_levels, y = incomes)) +
geom_line() + labs(title = "Relationship Between Income Decile and Highest Edu",
x = "Highest Level of Education, ES-ISCED",
y = "Total Household Income Decile")
print(graph)
## `summarise()` has grouped output by 'eiscedp'. You can override using the
## `.groups` argument.
# Plot
ggplot(df_summary, aes(x = eiscedp, y = Proportion, fill = hinctnta)) +
geom_bar(stat = "identity", position = "dodge") +
labs(title = "Proportion of Income Decile by Partner Edu",
y = "Proportion",
x = "Partner's Highest Level of Education") +
theme_minimal()