Setup
rm(list = ls(all.names = TRUE))
require(pacman)
p_load(tidyverse, readxl)
df_geger <- read.csv("geschlechtergerechter_data.csv", na.strings = "")
df_codebook <- read_xlsx("geschlechtergerechter_codebook.xlsx")
Recoding
# Dummy-Variable für sexuelle Orientierung (heterosexuell - nicht-heterosexuell)
df_geger <- df_geger %>%
mutate(sexOrientation =
ifelse(sexOrientation == "A6", NA, sexOrientation)) %>%
mutate(sexorientqueer =
case_when(sexOrientation %in% c("A1", "A3", "A4", "A5") ~ 1,
sexOrientation == "A2" ~ 0))
table(df_geger$sexorientqueer)[2]/(sum(table(df_geger$sexorientqueer)))
# Anteil nicht-heterosexuell ca. 10.6%
# Variable für Zugehörigkeit zu einer der 4 Gruppen
df_geger <- df_geger %>%
mutate(group = as.factor(case_when(
gender == "M" & sexorientqueer == 0 ~ "Männer, heterosexuell",
gender == "M" & sexorientqueer == 1 ~ "Männer, nicht-heterosexuell",
gender == "W" & sexorientqueer == 0 ~ "Frauen, heterosexuell",
gender == "W" & sexorientqueer == 1 ~ "Frauen, nicht-heterosexuell")))
# "partei", "linksrechts": 1 links, 4 mitte, 7 rechts, "edu"
df_geger <- df_geger %>%
mutate(partei = ifelse(partei %in% c("svp", "sp", "fdp", "mitte",
"gps", "glp", "evp", NA), partei, "-oth-"),
linksrechts = ifelse(linksrechts %in% c("lire1", "lire2", "lire3",
"lire4", "lire5", "lire6",
"lire7"), linksrechts, NA),
edu = recode_factor(edu,
"A1" = "kein Bildungsabschluss, obligatorische Schule",
"A2" = "Berufliche Grundausbildung (Berufslehre/Berufsschule/Handelsschule)",
"A3" = "Gymnasium, Berufsmatura, FMS, DMS",
"A4" = "Höhere Fach- und Berufsausbildung (HF, HFP, HTL usw.)",
"A5" = "ETH, Universität, PH, Fachhochschule")) %>%
mutate(
linksrechts = recode(linksrechts,
"lire1" = 1, "lire2" = 2, "lire3" = 3,
"lire4" = 4, "lire5" = 5, "lire6" = 6, "lire7" = 7),
partei = recode_factor(partei,
"svp" = "SVP", "sp" = "SP", "fdp" = "FDP",
"mitte" = "Mitte", "gps" = "GPS", "glp" = "GLP",
"evp" = "EVP", "-oth-" = "Other")
)
# "kanton"
df_geger <- df_codebook %>%
filter(Fragecode == "kanton") %>%
select(c(Antwortcode, Antwortlabel)) %>%
mutate(kanton = as.integer(Antwortcode)) %>%
right_join(df_geger, by = "kanton", multiple = "all") %>%
select(-c(Antwortcode, kanton)) %>%
rename(kanton = Antwortlabel)
# Variable für Altersgruppe => "age_group"
df_geger <- df_geger %>%
mutate(age_group = case_when(
age %in% seq(18,29) ~ "18-29", age %in% seq(30,49) ~ "30-49",
age %in% seq(50,64) ~ "50-64", age %in% seq(65,max(df_geger$age)) ~ "65+"))
# "engagementForMale", "engagementForFemale", "feminist", "dienstpflicht",
# "quoten", "register", "childcareSalary", "careSalary", "elternurlaub"
df_geger <- df_geger %>%
mutate(across(c(engagementForMale, engagementForFemale, feminist, dienstpflicht,
quoten, register, childcareSalary, careSalary, elternurlaub),
recode_factor, "A1" = "Ja", "A2" = "Eher ja",
"A3" = "Eher nein", "A4" = "Nein"))
# "gendergap"
df_geger <- df_geger %>%
mutate(gendergap = recode_factor(gendergap,
"A1" = "Ja", "A2" = "Eher ja",
"A3" = "Eher nein", "A4" = "Nein",
"A5" = "Es gibt keine Lohnlücke"))
Plot 1
c <- "Daten: Forschungsstelle Sotomo (geschlechtergerechter, Oktober 2021)"
group_levels <- c("Männer, nicht-heterosexuell", "Männer, heterosexuell",
"Frauen, nicht-heterosexuell")
# Data frame für plot
df_lire <- df_geger %>%
filter(!is.na(group)) %>%
group_by(gender, sexorientqueer) %>%
summarize(Dlire = weighted.mean(linksrechts, weight, na.rm = TRUE)) %>%
mutate(sexorientqueer = recode_factor(sexorientqueer, "0" = "heterosexuell",
"1" = "nicht-heterosexuell"),
gender = recode(gender, "M" = "Männer", "W" = "Frauen"))
# Plot
plot1 <- ggplot(df_lire , aes(x = gender, y = Dlire)) +
geom_col(aes(fill = sexorientqueer), width = .3, position = "dodge") +
coord_flip(ylim = c(1,7)) +
scale_fill_manual(
"sexorientqueer",
values = c("nicht-heterosexuell" = "pink", "heterosexuell" = "darkblue"),
breaks = c("nicht-heterosexuell", "heterosexuell")) +
scale_y_continuous(breaks = seq(1,7,1.5)) +
theme_light() +
theme(axis.text.x = element_text(size = 10), axis.text.y = element_text(size = 11),
strip.text.x = element_text(size = 11),
plot.caption = element_text(size = 10, face = "italic")) +
labs(title = "Queers schätzen sich im Durchschnitt linker ein als Heterosexuelle",
subtitle =
"Durchschnittliche Selbsteinstufung auf einer Skala von 1 (links) bis 7 (rechts)",
caption = c, x = "", y = "") +
guides(fill = guide_legend(title = "sexuelle Orientierung"))
plot1
ggsave("plot1.1.png", plot1)
# Verteilung von "age group" für nicht-heterosexuelle
table(df_geger[which(df_geger$group == "Frauen, nicht-heterosexuell"),371])
## age_group
## 18-29 30-49 50-64 65+
## 34 55 24 11
# etwas wenige Beobachtungen für 65+ (n = 11)
table(df_geger[which(df_geger$group == "Männer, nicht-heterosexuell"),371])
## age_group
## 18-29 30-49 50-64 65+
## 18 52 38 37
# etwas wenige Beobachtungen für 18-29 (n = 18)
# Durchschnittliche links-rechts Selbsteinschätzung über alle Altersgruppen
df_geger %>%
filter(!is.na(group)) %>%
group_by(group) %>%
summarize(Dlire = weighted.mean(linksrechts, weight, na.rm = TRUE)) %>%
mutate(DelDlire = Dlire - lead(Dlire))
## # A tibble: 4 × 3
## group Dlire DelDlire
## <fct> <dbl> <dbl>
## 1 Frauen, heterosexuell 3.69 0.422
## 2 Frauen, nicht-heterosexuell 3.27 -0.825
## 3 Männer, heterosexuell 4.10 0.237
## 4 Männer, nicht-heterosexuell 3.86 NA
Plot 2
# Data frame für Plot
df_partei <- df_geger %>%
filter(!is.na(partei), !is.na(group)) %>%
group_by(partei, group) %>%
count(wt = weight) %>%
group_by(group) %>%
mutate(Anteil = n / sum(n)) %>%
filter(partei %in% c("SVP","FDP","Mitte","GLP","SP","GPS")) %>%
mutate(partei = fct_relevel(partei, c("GPS","SP","GLP","Mitte","FDP","SVP"))) %>%
group_by(partei) %>%
mutate(DelAnt = Anteil - lag(Anteil),
Delgroup = c(rep("Frauen", 2), rep("Männer", 2)),
sign = ifelse(DelAnt > 0, TRUE, FALSE)) %>%
filter(row_number() %% 2 != 1) %>%
select(-c(group, n, Anteil))
# Plot
plot2 <- ggplot(df_partei, aes(x = partei, y = DelAnt)) +
geom_point(aes(color = sign), size = 3) +
geom_segment(
aes(x = partei, xend = partei, y = 0, yend = DelAnt, color = sign)) +
geom_text(aes(label = sprintf("%.0f%%", 100*DelAnt), vjust = .5,
hjust = ifelse(DelAnt > 0, -1, 2)),
size = 3, color = "black") +
scale_color_manual(name = "sign", values = c("FALSE" = "red", "TRUE" = "blue")) +
coord_flip(ylim = c(-.15,.15)) +
facet_wrap(~Delgroup) +
scale_y_continuous(labels = scales::percent) +
theme_light() +
theme(legend.position = "none", axis.text.x = element_text(size = 10),
axis.text.y = element_text(size = 11), strip.text = element_text(size = 11),
plot.caption = element_text(size = 10, face = "italic")) +
labs(title = "Keine Sympathieverluste für die SVP bei queeren Frauen",
subtitle = "Parteisympathie von Queers im Vergleich zu Heterosexuellen",
caption = c, x = "", y = "")
plot2
ggsave("plot2.1.png", plot2)
Plot 3
# Parteien
p <- c("SVP","FDP","Mitte","GLP","SP","GPS")
# Frauenquoten
Fr_quoten <-
unique(df_codebook[which(df_codebook$Fragecode == "quoten"),2])$Frage
df_quoten <- df_geger %>%
filter(!is.na(quoten), !is.na(sexorientqueer),
gender != "-oth", partei %in% p) %>%
group_by(quoten, gender, sexorientqueer) %>%
count(wt = weight) %>%
group_by(gender, sexorientqueer) %>%
mutate(Anteil = n / sum(n),
Dquoten = ifelse(quoten %in% c("Ja", "Eher ja"), "JA", "NEIN")) %>%
group_by(gender, sexorientqueer, Dquoten) %>%
mutate(DAnteil = sum(Anteil)) %>%
filter(quoten == "Ja") %>%
select(-quoten) %>%
mutate(opinion = "Frauenquoten")
# Registereintrag weiteres Geschlecht
Fr_register <-
unique(df_codebook[which(df_codebook$Fragecode == "register"),2])$Frage
df_register <- df_geger %>%
filter(!is.na(register), !is.na(sexorientqueer),
gender != "-oth-", partei %in% p) %>%
group_by(register, gender, sexorientqueer) %>%
count(wt = weight) %>%
group_by(gender, sexorientqueer) %>%
mutate(Anteil = n / sum(n),
Dregister = ifelse(register %in% c("Ja", "Eher ja"), "JA", "NEIN")) %>%
group_by(gender, sexorientqueer, Dregister) %>%
mutate(DAnteil = sum(Anteil)) %>%
filter(register == "Ja") %>%
select(-register) %>%
mutate(opinion = "Zusätzlicher Eintrag")
# Kinderbetreuung
Fr_childcare <-
unique(df_codebook[which(df_codebook$Fragecode == "childcareSalary"),2])$Frage
df_childcare <- df_geger %>%
filter(!is.na(childcareSalary), !is.na(sexorientqueer),
gender != "-oth-", partei %in% p) %>%
group_by(childcareSalary, gender, sexorientqueer) %>%
count(wt = weight) %>%
group_by(gender, sexorientqueer) %>%
mutate(Anteil = n / sum(n),
Dchildcare = ifelse(childcareSalary %in% c("Ja", "Eher ja"), "JA", "NEIN")) %>%
group_by(gender, sexorientqueer, Dchildcare) %>%
mutate(DAnteil = sum(Anteil)) %>%
filter(childcareSalary == "Ja") %>%
select(-childcareSalary) %>%
mutate(opinion = "Finanzierung Kinderbetreuung")
# Gendergap
Fr_gendergap <-
unique(df_codebook[which(df_codebook$Fragecode == "gendergap"),2])$Frage
df_gendergap <- df_geger %>%
filter(!is.na(gendergap), !is.na(group),
gender != "-oth-", partei %in% p) %>%
group_by(gendergap, gender, sexorientqueer) %>%
count(wt = weight) %>%
group_by(gender, sexorientqueer) %>%
mutate(Anteil = n / sum(n),
Dgendergap = ifelse(gendergap %in% c("Ja", "Eher ja"), "JA", "NEIN")) %>%
group_by(gender, sexorientqueer, Dgendergap) %>%
mutate(DAnteil = sum(Anteil)) %>%
filter(gendergap == "Ja") %>%
select(-gendergap) %>%
mutate(opinion = "Lohnlücke schliessen")
# Data frame für alle Meinungen
df_opinion <- rbind(df_quoten, df_register, df_childcare, df_gendergap)
df_opinion <- df_opinion[,-c(4,8:10)]
df_opinion$opinion <- as.factor(df_opinion$opinion)
df_opinion <- df_opinion %>%
mutate(opinion = fct_relevel(
opinion, c("Frauenquoten", "Lohnlücke schliessen",
"Finanzierung Kinderbetreuung", "Zusätzlicher Eintrag")),
sexorientqueer = recode_factor(sexorientqueer, "0" = "heterosexuell",
"1" = "nicht-heterosexuell"),
gender = recode(gender, "M" = "Männer", "W" = "Frauen"))
# Plot
plot3 <- ggplot(df_opinion, aes(x = gender, y = DAnteil)) +
geom_col(aes(fill = sexorientqueer), width = .3, position = "dodge") +
coord_flip() +
scale_fill_manual(
"sexorientqueer", values = c("heterosexuell" = "darkblue", "nicht-heterosexuell" = "pink"),
breaks = c("nicht-heterosexuell", "heterosexuell")) +
facet_wrap(~opinion) +
scale_y_continuous(labels = scales::percent) +
theme_light() +
theme(strip.text = element_text(size = 11), legend.title = element_text(size = 12),
plot.caption = element_text(size = 10, face = "italic"),
axis.text.x = element_text(size = 8), axis.text.y = element_text(size = 10),
legend.text = element_text(size = 11)) +
labs(title = "Kaum Unterstützung für Frauenquoten bei queeren Männern",
subtitle = "Anteil der Personen, die folgende Politikmassnahmen unterstützen",
caption = c, x = "", y = "") +
guides(fill = guide_legend(title = "sexuelle Orientierung"))
plot3
ggsave("plot3.1.png", plot3)