-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibsAndTest.R
327 lines (281 loc) · 11.4 KB
/
libsAndTest.R
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# libraries general
library(tidymodels)
library(tidyverse)
library(rms)
library(MASS)
library(corrplot)
library(lubridate)
library(Amelia)
library(xtable)
library(haven)
library(foreign)
library(broom)
library(psych)
library(Hmisc)
library(expss)
library(rockchalk)
library(effects)
library(modeldata)
library(randomForest)
library(compare)
library(psych)
library(desc)
library(PerformanceAnalytics)
library(reshape2)
library(d3heatmap)
library(kableExtra)
library(gtools)
library(gmodels)
library(summarytools)
library(data.table)
library(ggpubr)
################################################ load required dfs if needed
# ches 19
ches19 <- read_dta(file = "/Users/flo/Desktop/data/ches/19/CHES2019V3.dta")
# ches 19 filtered (2 in 1 and separately)
ches19_f <- ches19 %>% filter(country == 4 | country == 8)
ches19_GRC <- ches19 %>% filter(country == 4)
ches19_ITA <- ches19 %>% filter(country == 8)
# ches 19 ITA, only M5S and LN
ches19_M5S_LN <- ches19_ITA[c(1, 8),]
# ches 14
ches14 <- read_dta(file = "/Users/flo/Desktop/data/ches/14/2014_CHES_dataset_means-2.dta")
# ches 14 filtered (2 in 1 and separately)
ches14_f <- ches14 %>% filter(country == 4 | country == 8)
ches14_GRC <- ches14 %>% filter(country == 4)
ches14_ITA <- ches14 %>% filter(country == 8)
# ches 14 GRC, only SYRIZA and ANEL
ches14_SYRIZA_ANEL <- ches14_GRC[c(3, 6),]
# poppa expert survey
poppa <- read_dta(file = "/Users/flo/Desktop/data/poppa/party_means.dta")
# poppa filtered (2 in 1 and separately)
poppa_f <- poppa %>% filter(country_id == 13 | country_id == 16)
poppa_GRC <- poppa %>% filter(country_id == 13)
poppa_ITA <- poppa %>% filter(country_id == 16)
# poppa filtered: ITA = M5S and LN | GRC = SYRIZA and ANEL
poppa_SYRIZA_ANEL <- poppa_GRC[c(1, 7),]
poppa_M5S_LN <- poppa_ITA[c(2, 4),]
# elnes (should it be required, it can be loaded here)
# elnes <- read_sav(file = "/Users/flo/Desktop/data/elnes/ELNES-2015b-clean-weights.sav")
################################################
# CHES
# EU_POSITION: overall orientation of the party leadership towards european integration
# ## in 2014
# ggplot(data = ches14_f, aes(eu_position, party_name)) +
# geom_point() +
# ggtitle(label = "Position towards EU integration in 2014")
#
# ## in 2019
# ggplot(data = ches19_f, aes(eu_position, party)) +
# geom_point() +
# ggtitle(label = "Position towards EU integration in 2019")
#
# ggplot(data = ches19_f, aes(antielite_salience, party)) +
# geom_point()
#
# ggplot(data = ches19_f, aes(people_vs_elite, party)) +
# geom_point()
# populism-left/right-matrix
# populism and left right scale: GRC - SYRIZA and ANEL
ggplot(data = poppa_GRC, aes(x = lroverall, y = populism)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = lroverall, y = populism), colour = "red", size = 5) +
ggtitle(label = "SYRIZA und ANEL im Raum zwischen Populismus und Links-Rechts-Verortung",
subtitle = "Nach POPPA 2019") +
xlab(label = "Links-Rechts-Verortung") +
ylab(label = "Populismus (ideeller Ansatz)")
# populism and left right scale: ITA - M5S and Lega
ggplot(data = poppa_ITA, aes(x = lroverall, y = populism)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_M5S_LN, aes(x = lroverall, y = populism), colour = "red", size = 5) +
ggtitle(label = "M5S und Lega Nord im Raum zwischen Populismus und Links-Rechts-Verortung",
subtitle = "Nach POPPA 2019") +
xlab(label = "Links-Rechts-Verortung") +
ylab(label = "Populismus (ideeller Ansatz)")
# GRC: testing poppa vars for non congruent party positions of SYRIZA and ANEL
## populist spectrum: ideational approach dimensions (red)
ggplot(data = poppa_GRC, aes(x = populism, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = populism, y = party), colour = "red", size = 5) +
labs(title = "SYRIZA und ANEL: Populismus nach ideellem Ansatz",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Populismus",
y = "Partei")
### antielitism
ggplot(data = poppa_GRC, aes(x = antielitism, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = antielitism, y = party), colour = "red", size = 5) +
labs(title = "SYRIZA und ANEL: (Anti-)Elitismus",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "(Anti-)Elitismus",
y = "Partei")
### manichean worldview
ggplot(data = poppa_GRC, aes(x = manichean, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = manichean, y = party), colour = "red", size = 5) +
labs(title = "SYRIZA und ANEL: Manichäisches Weltbild",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Manichäisches Weltbild",
y = "Partei")
### indivisible people
ggplot(data = poppa_GRC, aes(x = indivisble, y = party)) +
geom_point() +
theme_minimal() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = indivisble, y = party), colour = "red", size = 5) +
labs(title = "SYRIZA und ANEL: Homogenität des Volks",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Homogenität",
y = "Partei")
### general will of the people
ggplot(data = poppa_GRC, aes(x = generalwill, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = generalwill, y = party), colour = "red", size = 5) +
labs(title = "SYRIZA und ANEL: Singulärer Volkswille",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Volkswille",
y = "Partei")
### people centrism
ggplot(data = poppa_GRC, aes(x = peoplecentrism, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = peoplecentrism, y = party), colour = "red", size = 5) +
labs(title = "SYRIZA und ANEL: Volk = alleiniger Souverän",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Volk = alleiniger Souverän",
y = "Partei")
## political style of parties (purple)
### emotions as strategy
ggplot(data = poppa_GRC, aes(x = emotional, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = emotional, y = party), colour = "purple", size = 5) +
labs(title = "SYRIZA und ANEL: Emotionen als Strategie",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Emotionen als Strategie",
y = "Partei")
### complexity of decision making in politics
ggplot(data = poppa_GRC, aes(x = complex, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = complex, y = party), colour = "purple", size = 5) +
labs(title = "SYRIZA und ANEL: Komplexität politischer Entscheidungen",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Komplexität politischer Entscheidungen",
y = "Partei")
########################################### party ideology (green)
### lroverall
ggplot(data = poppa_GRC, aes(x = lroverall, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = lroverall, y = party), colour = "green", size = 5) +
labs(title = "SYRIZA und ANEL: politisch Links vs. Rechts",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Links-Rechts (politisch)",
y = "Partei") +
scale_x_binned(limits = c(0, 10), n.breaks = 10, nice.breaks = T)
### lrecon
ggplot(data = poppa_GRC, aes(x = lrecon, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = lrecon, y = party), colour = "green", size = 5) +
labs(title = "SYRIZA und ANEL: wirtschaftlich Links vs. Rechts",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Links-Rechts (wirtschaftlich)",
y = "Partei")
### immigration
ggplot(data = poppa_GRC, aes(x = immigration, y = party)) +
geom_point() +
theme_minimal() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = immigration, y = party), colour = "green", size = 5) +
labs(title = "SYRIZA und ANEL: Position zur Immigration",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Position zur Immigration",
y = "Partei")
### eu
ggplot(data = poppa_GRC, aes(x = eu, y = party)) +
geom_point() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = eu, y = party), colour = "green", size = 5) +
labs(title = "SYRIZA und ANEL: Position zur EU",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Position zur EU",
y = "Partei")
### nativism
ggplot(data = poppa_GRC, aes(x = nativism, y = party)) +
geom_point() +
theme_minimal() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = nativism, y = party), colour = "green", size = 5) +
labs(title = "SYRIZA und ANEL: Nativismus",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Nativismus",
y = "Partei")
### laworder
ggplot(data = poppa_GRC, aes(x = laworder, y = party)) +
geom_point() +
theme_minimal() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = laworder, y = party), colour = "green", size = 5) +
labs(title = "SYRIZA und ANEL",
subtitle = "Bürgerliche Freiheiten vs. Recht u. Ordnung",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Freiheiten - Recht/Ordnung",
y = "Partei")
### lifestyle
ggplot(data = poppa_GRC, aes(x = lifestyle, y = party)) +
geom_point() +
theme_linedraw() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = lifestyle, y = party), colour = "green", size = 5) +
labs(title = "SYRIZA und ANEL: Auffassung von Lebensstil",
subtitle = "Traditionell vs. Liberal",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Traditionell - Liberal",
y = "Partei")
#################################### party organization (blue)
### intra-party democracy
ggplot(data = poppa_GRC, aes(x = intradem, y = party)) +
geom_point() +
theme_linedraw() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = intradem, y = party), colour = "blue", size = 5) +
labs(title = "SYRIZA und ANEL: Basisdemokratie in der Partei",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Basisdemokratie",
y = "Partei")
### personalised leadership
ggplot(data = poppa_GRC, aes(x = personalised, y = party)) +
geom_point() +
theme_minimal() +
geom_text(aes(label = party), hjust = 0.5, vjust = 1.5) +
geom_point(data = poppa_SYRIZA_ANEL, aes(x = personalised, y = party), colour = "blue", size = 5) +
labs(title = "SYRIZA und ANEL: Führung stark personalisiert",
caption = "Nach POPPA 2019",
tag = "Abbildung 2",
x = "Personalisierung",
y = "Partei") +
scale_x_binned(limits = c(0, 10), n.breaks = 10, nice.breaks = T)