Forschungsfrage 1: Wurde Extremimus über die Zeit digitaler? Welcher Extremismus ist am digitalsten?
1.1 Vergleich aller Straftatmittel in absoluten Zahlen und über Zeitverlauf getrennt nach Online und Offline
1.2 Absoluter Vergleich nach PMK über Zeit nur mit Straftatmittel Online
1.3 Welcher Phänomenbereich ist am digitalsten?
1.4 Härtegrad (Deliktsqualität) mit Internetbezug nach PMK
Forschungsfrage 2: Wie sieht digitaler Extremismus Kategorie aus und wie verteilt es sich?
2.1 Aufteilung der Obertatmittel mit Internetbezug in Ihre Kategorien in absoluten Zahlen und Verlauf
2.2 Aufteilung Internet PHB nach Zähldelikt
Forschungsfrage 3: Wer wird online attackiert?
3.1 Oberthema bei Online Straftaten nach PMK
3.2 Oberangriffsziel bei Online Straftaten nach PMK
To discuss, work further down the Road:
3.2 Einflüsse externer Krisen (Flüchtlingskrise, Pandemie)
Forschungsfrage 4: Korreliert digitaler Extremismus mit Offline Faktoren?
4.1 Stadt-Land Gefälle?
4.2 Zusammenhang mit Demos?
Installierung und Laden von Paketen
packages <- c("dplyr", "ggplot2", "tidyr", "readr", "stringr", "lubridate", "vcd", "knitr", "lmtest", "broom", "forcats", "anytime", "ggpubr", "reshape2", "FactoMineR", "TTR", "factoextra") # Add your packages here
for (pkg in packages) {
if (!require(pkg, character.only = TRUE)) {
install.packages(pkg)
library(pkg, character.only = TRUE)
} else {
message(paste("Package", pkg, "is already installed and loaded."))
}
}
R.Version()
## $platform
## [1] "x86_64-pc-linux-gnu"
##
## $arch
## [1] "x86_64"
##
## $os
## [1] "linux-gnu"
##
## $system
## [1] "x86_64, linux-gnu"
##
## $status
## [1] ""
##
## $major
## [1] "4"
##
## $minor
## [1] "3.2"
##
## $year
## [1] "2023"
##
## $month
## [1] "10"
##
## $day
## [1] "31"
##
## $`svn rev`
## [1] "85441"
##
## $language
## [1] "R"
##
## $version.string
## [1] "R version 4.3.2 (2023-10-31)"
##
## $nickname
## [1] "Eye Holes"
Laden des Datensatzes
data <- read_delim("2023-01-20_df_pmk_fall_fake.csv",
delim = ";",
locale = locale(encoding = "UTF-8"))
Encoding identifizieren
guess_encoding("2023-01-20_df_pmk_fall_fake.csv", n_max = 1000)
## # A tibble: 2 × 2
## encoding confidence
## <chr> <dbl>
## 1 UTF-8 1
## 2 windows-1252 0.46
Encoding-Problem mit Umlauten auflösen
replacement_table <- c("ä" = "ä",
"ö" = "ö",
"ü" = "ü",
"Ä" = "Ä",
"Ö" = "Ö",
"Ü" = "Ü",
"ß" = "ß")
fix_encoding <- function(x) {
for (incorrect in names(replacement_table)) {
correct <- replacement_table[incorrect]
x <- str_replace_all(x, incorrect, correct)
}
x
}
data <- data %>%
mutate_if(is.character, fix_encoding)
Faktorisierung der String-Variablen, Date Variable erstellen
data <- data %>%
mutate(
tatmittel_factor = case_when(
obertatmittel == "Internet" ~ 1,
obertatmittel == "Hassposting" ~ 2, # Hier weiterführen wenn alle Tatmittel enthalten sind.
TRUE ~ NA_integer_),
tatmittel_factor = as.factor(tatmittel_factor),
delikt_factor = case_when(
deliktsqualitaet == "ohne explizite Motivation" ~ 1,
deliktsqualitaet == "Politisch motivierte Kriminalität" ~ 2,
deliktsqualitaet == "Politisch motivierte Gewaltkriminalität" ~ 3,
deliktsqualitaet == "Terrorismus" ~ 4,
TRUE ~ NA_integer_),
delikt_factor = as.factor(delikt_factor),
phb_factor = case_when(
phb == "Links" ~ 1,
phb == "Rechts" ~ 2,
phb == "Religiöse Ideologie" ~ 3,
phb == "Nicht zuzuordnen" ~ 4,
phb == "Ausländer" ~ 5, # Ausländer? Diese Kategorie existiert im öffentlich verfügbaren Dokument nicht.
phb == "Ausländische Ideologie" ~ 6,
TRUE ~ NA_integer_),
phb_factor = as.factor(phb_factor),
offon = case_when(
obertatmittel %in% c("Internet", "Hassposting") ~ 1,
TRUE ~ 0),
offon = as.factor(offon),
zaehldelikt_factor = case_when(
zaehldelikt == "Bedrohung" ~ 1,
zaehldelikt == "Kennzeichen verfassungswidriger Organisationen" ~2,
zaehldelikt == "Volksverhetzung" ~ 3,
TRUE ~ 4 ), # Alles andere vermutlich alles Offline? Vorher tatsächliche Ausprägrungen nochmal checken!
zaehldelikt_factor = as.factor(zaehldelikt_factor))
data$tatzeit <- as.Date(data$tatzeit, format="%d.%m.%Y")
# Extract year and month
data$year <- year(data$tatzeit)
data$month <- month(data$tatzeit)
str(data)
## tibble [10,000 × 26] (S3: tbl_df/tbl/data.frame)
## $ ordnungsnummer : num [1:10000] 1 2 3 4 5 6 7 8 9 10 ...
## $ tatort_plz : num [1:10000] 4550 26532 34167 82003 37791 ...
## $ tatort_kkz : num [1:10000] 7111 9672 5374 13072 9672 ...
## $ phb : chr [1:10000] "Rechts" "Ausländische Ideologie" "Religiöse Ideologie" "Rechts" ...
## $ deliktsqualitaet : chr [1:10000] "Politisch motivierte Kriminalität" "Politisch motivierte Kriminalität" "Politisch motivierte Kriminalität" "Terrorismus" ...
## $ versuch : num [1:10000] 0 1 1 1 1 0 0 1 1 0 ...
## $ extremismus : num [1:10000] 1 1 0 1 1 1 1 1 1 1 ...
## $ tatzeit : Date[1:10000], format: "2018-05-31" "2010-12-19" ...
## $ zaehldelikt : chr [1:10000] "Kennzeichen verfassungswidriger Organisationen" "Kennzeichen verfassungswidriger Organisationen" "Sachbeschädigung" "Bedrohung" ...
## $ zusammenhang_mit_demo : num [1:10000] 1 1 1 0 1 0 1 0 0 1 ...
## $ anzahl_tatverdaechtige: num [1:10000] 5 2 2 5 2 5 2 2 2 3 ...
## $ oberthema : chr [1:10000] "Christenfeindlich" "Fremdenfeindlich" "Ausländerfeindlich" "Sexuelle Orientierung" ...
## $ unterthema : chr [1:10000] "Gesundheitswesen" "Gesundheitswesen" "Polizei" "gegen sonstige politische Gegner" ...
## $ unterangriffsziel : chr [1:10000] "Polizeiangehörige" "Kirche" "Mandatsträger" "Mandatsträger" ...
## $ oberangriffsziel : chr [1:10000] "Moschee" "Religionsgemeinschaft" "Moschee" "Religiöser Repräsentant" ...
## $ obertatmittel : chr [1:10000] "Hassposting" "Hassposting" "Internet" "Hassposting" ...
## $ kkz : num [1:10000] 12071 11000 8216 8111 8117 ...
## $ covid19_bezug : num [1:10000] 0 1 0 1 0 1 0 1 0 0 ...
## $ tatjahr : num [1:10000] 2018 2010 2010 2010 2019 ...
## $ tatmittel_factor : Factor w/ 2 levels "1","2": 2 2 1 2 2 2 1 2 2 1 ...
## $ delikt_factor : Factor w/ 4 levels "1","2","3","4": 2 2 2 4 1 3 4 2 2 2 ...
## $ phb_factor : Factor w/ 6 levels "1","2","3","4",..: 2 6 3 2 3 1 6 4 1 4 ...
## $ offon : Factor w/ 1 level "1": 1 1 1 1 1 1 1 1 1 1 ...
## $ zaehldelikt_factor : Factor w/ 4 levels "1","2","3","4": 2 2 4 1 1 4 4 4 1 4 ...
## $ year : num [1:10000] 2018 2010 2010 2010 2019 ...
## $ month : num [1:10000] 5 12 11 8 6 7 3 8 2 5 ...
Weitere Ausführungen zum Datensatz: https://www.bmi.bund.de/SharedDocs/downloads/DE/veroeffentlichungen/themen/sicherheit/definitionssystem-pmk.pdf?__blob=publicationFile&v=2
PMK -ausländische Ideologie- (Definitionssystem PMK, Nr. 2.5.3) Hiervon sind aus dem Ausland stammende separatistische, rechte und linke Ideologien, also sämtliche ausländische nichtreligiöse Ideologien, umfass: Politisch motivierter Kriminalität -ausländische Ideologie- werden Straftaten zugeordnet, wenn in Würdigung der Umstände der Tat und/oder der Einstellung des Täters Anhaltspunkte dafür vorliegen, dass eine aus dem Ausland stammende, nichtreligiöse Ideologie entscheidend für die Tatbegehung war, insbesondere wenn sie darauf gerichtet ist, Verhältnisse und Entwicklungen im In- und Ausland zu beeinflussen. Gleiches gilt, wenn aus dem Ausland heraus Verhältnisse und Entwicklungen in der Bundesrepublik Deutschland beeinflusst werden sollen. Die Staatsangehörigkeit des Täters ist hierbei unerheblich.
PMK -religiöse Ideologie- (Definitionssystem PMK, Nr. 2.5.4) ist nicht gleich Islamismus, sondern umfasst alle religiöse Extremismen: Politisch motivierter Kriminalität -religiöse Ideologie- werden Straftaten zugeordnet, wenn in Würdigung der Umstände der Tat und/oder der Einstellung des Täters Anhaltspunkte dafür vorliegen, dass eine religiöse Ideologie entscheidend für die Tatbegehung war.
Reichsbürger häufig bei nicht zuordnungsbar eingeteilt, senkt Zahl rechter PMK
variables_of_interest <- c("phb", "deliktsqualitaet", "zaehldelikt", "oberthema", "unterthema", "oberangriffsziel", "unterangriffsziel", "obertatmittel")
for (var in variables_of_interest) {
cat("Einzigartige Werte der Variable '", var, "':\n")
print(unique(data[[var]]))
cat("\n")
}
## Einzigartige Werte der Variable ' phb ':
## [1] "Rechts" "Ausländische Ideologie" "Religiöse Ideologie"
## [4] "Links" "Nicht zuzuordnen" "Ausländer"
##
## Einzigartige Werte der Variable ' deliktsqualitaet ':
## [1] "Politisch motivierte Kriminalität"
## [2] "Terrorismus"
## [3] "ohne explizite Motivation"
## [4] "Politisch motivierte Gewaltkriminalität"
##
## Einzigartige Werte der Variable ' zaehldelikt ':
## [1] "Kennzeichen verfassungswidriger Organisationen"
## [2] "Sachbeschädigung"
## [3] "Bedrohung"
## [4] "Körperverletzung"
## [5] "Brandstiftung"
## [6] "Volksverhetzung"
##
## Einzigartige Werte der Variable ' oberthema ':
## [1] "Christenfeindlich" "Fremdenfeindlich"
## [3] "Ausländerfeindlich" "Sexuelle Orientierung"
## [5] "Hasskriminalität" "Antisemitisch"
## [7] "Rassismus" "Sonstige ethn. Zugehörigkeit"
## [9] "Deutschfeindlich " "Behinderung"
## [11] "Islamfeindlich" "Antiziganistisch"
## [13] "Geschlecht/Sex. Identität" "Gesellschaftlicher Status"
##
## Einzigartige Werte der Variable ' unterthema ':
## [1] "Gesundheitswesen" "Polizei"
## [3] "gegen sonstige politische Gegner" "Sexuelle Orientierung"
## [5] "Frauenfeindlich" "fremdenfeindlich"
## [7] "Islamfeindlich" "gegen den Staat"
## [9] "Antisemitisch"
##
## Einzigartige Werte der Variable ' oberangriffsziel ':
## [1] "Moschee" "Religionsgemeinschaft"
## [3] "Religiöser Repräsentant" "Staat"
## [5] "Polizei" "Partei"
## [7] "Kirche" "Synagoge"
##
## Einzigartige Werte der Variable ' unterangriffsziel ':
## [1] "Polizeiangehörige" "Kirche"
## [3] "Mandatsträger" "Staat"
## [5] "Religiöser Repräsentant" "Moschee"
## [7] "Synagoge" "Amtsträger"
## [9] "Religionsgemeinschaft"
##
## Einzigartige Werte der Variable ' obertatmittel ':
## [1] "Hassposting" "Internet"
Variable Tatmittel:
Relevante Ausprägungen
Insbesondere Definition von Hass-Posting:
Hassposting (UM der AG Kripo wirksam zum 05.06.18, redaktionell geändert nach der 258. Sitzung des AK II am 16./17.10.19, TOP 7) Unter einem Posting wird ein Beitrag verstanden, der im oder über das Internet mehreren Nutzern gleichzeitig zugänglich gemacht wird. Politisch motivierten Hasspostings werden solche Straftaten zugerechnet, die in Würdigung der Umstände der Tat oder der Einstellung des Täters Anhaltspunkte dafür geben, dass diese gegen eine Person, Personengruppe oder Institution wegen ihrer/ihres zugeschriebenen oder tatsächlichen politischen Haltung, Einstellung und/oder Engagements gerichtet sind bzw. aufgrund von Vorurteilen des Täters bezogen auf Nationalität, ethnische Zugehörigkeit, Hautfarbe, Religionszugehörigkeit, Weltanschauung, sozialen Status, physischen und/oder psychische Behinderung oder Beeinträchtigung, Geschlecht/sexuelle Identität, sexuelle Orientierung oder äußeres Erscheinungsbildes begangen werden.
Achtung
Mehrfachauswahl möglich: Probelem für Zählvariable. Ausprägungen werden wie in einer string variable mit Leerzeichen getrennt eingetragen. Ich schaue mir alle Kombinationsmöglichkeiten vor Ort an und versuche die “unterste Ebene zu finden”: Mobiltelefon / Telefon > Internet / Direktnachricht im Internet > Soziales Netzwerk > Hassposting / Video
Nur relevant für absoluten Verlauf der einzelnen Variablen F1.1, ansonsten schauen wir uns die binäre Variant Online Tatmittel vs. Offline Tatmittel an.
-> Anmerkung für mich: Mit David nochmal Rücksprache halten wie die Variablen exakt abgespeichert sind vor Ort.
Erstellen einer monatlichen-Achse
# Filter for 'tatmittel_factor' == 1 and count occurrences by year and month
int_count <- data %>%
filter(tatmittel_factor == 1) %>%
group_by(year, month) %>%
summarise(count = n())
int_count$tatzeit <- as.POSIXct(make_date(int_count$year, int_count$month))
origin <- anytime(0)
internet <- ggplot(int_count, aes(x=tatzeit, y=count)) + geom_line(alpha = 0.3) + theme_minimal()
dat <- layer_data(internet)
summary_x<-summary(dat$x)
position_x<-c(summary_x["1st Qu."], summary_x["3rd Qu."])
position_y<-0-(max(dat$y)-min(dat$y))*0.05
spline_int <- as.data.frame(spline(dat$x, dat$y, method = "fmm", ties="mean"))
spline_int_internet <- as.data.frame(spline(dat$x, dat$y, method = "fmm", ties="mean"))
internet_plot <- internet +
geom_line(data = spline_int, aes(x = as.POSIXct(x, origin = origin), y = y), linewidth = 1.2) +
geom_smooth(data = spline_int, aes(as.POSIXct(x, origin = origin), y)
, linetype="longdash", color="black", linewidth=0.6
) +
#geom_text(x = position_x[1], y=position_y, label=paste("linear trend?:",linear_trend)) +
#geom_text(x = position_x[2], y=position_y, label=paste("any trend?:",any_trend)) +
labs(x = "", y = "") + ggtitle(paste ("Internet-Straftaten")) + #ylim(main_plot_limits) +
scale_x_datetime(date_breaks = "3 month" , date_minor_breaks = "3 month", date_labels = "%b-%y") +
theme(axis.text.x = element_text(angle = 35, hjust = 0.8)) + expand_limits(y = position_y)+
scale_y_continuous(limits = c(0, 100)) # Adjust scale here
#scale_y_continuous(breaks = function(x) seq(ceiling(x[1]), floor(x[2]), by = 1))
# Filter for 'tatmittel_factor' == 1 and count occurrences by year and month
hass_count <- data %>%
filter(tatmittel_factor == 2) %>%
group_by(year, month) %>%
summarise(count = n())
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
hass_count$tatzeit <- as.POSIXct(make_date(hass_count$year, hass_count$month))
origin <- anytime(0)
hass <- ggplot(hass_count, aes(x=tatzeit, y=count)) + geom_line(alpha = 0.3) + theme_minimal()
#geom_freqpoly(binwidth = 60*60*24*7, alpha = 0.3) + theme_minimal()
dat <- layer_data(hass)
summary_x<-summary(dat$x)
position_x<-c(summary_x["1st Qu."], summary_x["3rd Qu."])
position_y<-0-(max(dat$y)-min(dat$y))*0.05
spline_int <- as.data.frame(spline(dat$x, dat$y, method = "fmm", ties="mean"))
spline_int_hass <- as.data.frame(spline(dat$x, dat$y, method = "fmm", ties="mean"))
hass_plot <- hass +
geom_line(data = spline_int, aes(x = as.POSIXct(x, origin = origin), y = y), linewidth = 1.2) +
geom_smooth(data = spline_int, aes(as.POSIXct(x, origin = origin), y)
, linetype="longdash", color="black", linewidth=0.6
) +
#geom_text(x = position_x[1], y=position_y, label=paste("linear trend?:",linear_trend)) +
#geom_text(x = position_x[2], y=position_y, label=paste("any trend?:",any_trend)) +
labs(x = "", y = "") + ggtitle(paste ("Hasspostings")) + #ylim(main_plot_limits) +
scale_x_datetime(date_breaks = "3 month" , date_minor_breaks = "3 month", date_labels = "%b-%y") +
theme(axis.text.x = element_text(angle = 35, hjust = 0.8)) + expand_limits(y = position_y)+
scale_y_continuous(limits = c(0, 100)) # Adjust scale here
#scale_y_continuous(breaks = function(x) seq(ceiling(x[1]), floor(x[2]), by = 1))
ggarrange(internet_plot, hass_plot, ncol = 2, nrow = 1)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
Das kann ignoriert werden, ich habe es nur eingefügt um auf etwaige saisonale Effekte zu kontrollieren.
Time Series Objekt erstellen
online_count <- data %>%
filter (offon == 1) %>%
group_by(year,month) %>%
summarise(count = n())
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
online_count <- online_count$count
online_count_ts <- ts(online_count,
start = c(2010, 1),
frequency = 12)
online_count_ts
## Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
## 2010 82 65 90 71 83 82 86 81 68 90 73 86
## 2011 77 70 71 74 76 51 72 78 67 92 81 77
## 2012 74 70 87 71 68 64 79 89 66 70 75 80
## 2013 69 68 100 55 75 78 92 83 64 77 63 68
## 2014 78 75 73 75 78 75 75 68 63 93 79 88
## 2015 82 58 76 79 88 82 78 80 84 88 73 70
## 2016 73 74 89 78 75 80 85 90 67 82 84 93
## 2017 54 67 67 67 77 64 91 69 66 86 66 75
## 2018 68 78 72 69 58 74 85 75 85 68 71 79
## 2019 84 64 85 78 101 73 71 92 67 63 76 63
## 2020 86 61 75 79 60 78 69 74 81 69 79 85
Additives oder multiplikatives Modell?
Additiv = Variation zufällig und nicht trend-folgend
Multiplikativ = Variation ist saisonal, konstant ansteigend or saisonal konstant ansteigend
plot.ts(online_count_ts)
Im Falle eines additivem Komponente mit saisonalem
Trend
Smoothed Moving Average (SMA) berechen
online_count_SMA <- SMA(online_count_ts, n=2)
plot.ts(online_count_SMA)
Noch zu viel Variation, deshalb Erhöhung der Rangsumme
online_count_SMA <- SMA(online_count_ts, n=10)
plot.ts(online_count_SMA)
Im Falle eines saisonalen Komponente
Decomposing in trend, saisonale und irreguläre Komponenten.
online_components <- decompose(online_count_ts)
plot(online_components)
Gewichten des absoluten Verlaufs durch saisonale Trends:
online_adjusted <- online_count_ts - online_components$seasonal
plot(online_count_ts) # Ausgangsgraph mit saisonalen shifts
plot(online_adjusted)
offon_count <- data %>%
filter(offon == 1) %>%
group_by(year, month) %>%
summarise(count = n())
offon_count$group <- 1
# Add the same here for offline_count. Right now I'm adding simulated data.
start_date <- as.Date("2010-01-01")
end_date <- as.Date("2020-12-31")
all_dates <- seq(start_date, end_date, by="month")
set.seed(0)
simulated_counts <- sample(20:120, length(all_dates), replace = TRUE)
simulated_data <- data.frame(
year = as.numeric(format(all_dates, "%Y")),
month = as.numeric(format(all_dates, "%m")),
count = simulated_counts,
group = 2
)
offon_count <- rbind(offon_count, simulated_data)
offon_count$tatzeit <- as.POSIXct(make_date(offon_count$year, offon_count$month))
offon <- ggplot(offon_count, aes(x=tatzeit, y=count, group=group, color=as.factor(group))) +
geom_line(alpha = 0.3) +
theme_minimal()
origin <- anytime(0) # Define a reference origin time, if required
for (grp in unique(offon_count$group)) {
# Subset the data for the group
group_data <- subset(offon_count, group == grp)
# Calculate the spline
spline_data <- as.data.frame(spline(group_data$tatzeit,
group_data$count,
method = "fmm", ties="mean"))
# Convert the x values to POSIXct
spline_data$x <- anytime(spline_data$x)
spline_data$group <- grp
spline_int[[grp]] <- spline_data
}
# Combine the splines into one data frame
spline_int_combined <- do.call(rbind, spline_int)
# Now you can proceed with your ggplot code
offon_plot <- ggplot(offon_count, aes(x=tatzeit, y=count, group=group, color=as.factor(group))) +
geom_line(alpha = 0.3) +
theme_minimal() +
geom_line(data = spline_int_combined, aes(x = x, y = y, group=as.factor(group), color=as.factor(group)), size = 1.2) +
geom_smooth(data = spline_int_combined, aes(x = x, y = y, group=as.factor(group), color=as.factor(group)),
linetype="longdash", size=0.6) +
labs(x = "", y = "") +
ggtitle("Internet PMK vs Offline PMK") +
scale_x_datetime(date_breaks = "3 month", date_minor_breaks = "3 month", date_labels = "%b-%y") +
theme(axis.text.x = element_text(angle = 90, hjust = 0.8),
legend.title = element_blank()) +
scale_y_continuous(limits = c(0, 150)) # Adjust Scale here
# Plot the graph
print(offon_plot)
Simulieren der Offline Daten: Muss vor Ort angepasst werden!!!
offon_count <- data %>%
filter(offon == 1) %>%
group_by(year, month, phb_factor) %>%
summarise(count = n(), .groups = "drop")
offon_count$group <- 1
# Generierung der Simulierten Daten da
start_date <- as.Date("2010-01-01")
end_date <- as.Date("2020-12-31")
all_dates <- seq(start_date, end_date, by="month")
set.seed(0)
simulated_counts <- sample(1:15, length(all_dates) * 6, replace = TRUE)
simulated_phb_factors <- rep(1:6, times = length(all_dates))
simulated_data <- data.frame(
year = rep(as.numeric(format(all_dates, "%Y")), each = 6),
month = rep(as.numeric(format(all_dates, "%m")), each = 6),
phb_factor = simulated_phb_factors,
count = simulated_counts,
group = 2
)
# Mergen der simulierten Daten
offon_count <- rbind(offon_count, simulated_data)
# Zeitvariable erstellen
offon_count$tatzeit <- make_date(offon_count$year, offon_count$month)
# Summencount berechnen
totals <- offon_count %>%
group_by(year, month, phb_factor) %>%
summarise(
total_group1 = sum(count[group == 1]),
total_group2 = sum(count[group == 2]),
.groups = "drop"
)
totals$total <- totals$total_group1 + totals$total_group2
# Merge der Summencounts
offon_count <- offon_count %>%
left_join(totals, by = c("year", "month", "phb_factor"))
# Freq
offon_count <- offon_count %>%
mutate(freq = count/total)
offon_count$tatzeit <- as.POSIXct(make_date(offon_count$year, offon_count$month))
# Wichtig: Jetzt simulierten Datensatz wieder löschen!
offon_count <- offon_count %>% filter(group == 1 & (phb_factor == 1 | phb_factor == 2 | phb_factor == 3))
offon_count$phb_factor <- as.integer(offon_count$phb_factor)
offon_count$phb_factor <- as_factor(offon_count$phb_factor)
digi_freq <- ggplot(offon_count, aes(x=tatzeit, y=freq, group=phb_factor, color=as.factor(phb_factor))) +
geom_line(alpha = 0.3) +
theme_minimal()
origin <- anytime(0) # Define a reference origin time, if required
spline_int <- list() # Make sure this is defined before the loop
for (grp in unique(offon_count$phb_factor)) {
# Subset the data for the group
group_data <- subset(offon_count, phb_factor == grp)
# Ensure that there is data to work with
if (nrow(group_data) > 0) {
# Calculate the spline
spline_data <- as.data.frame(spline(group_data$tatzeit,
group_data$freq,
method = "fmm", ties="mean"))
# Convert the x values to POSIXct, assuming spline_data$x is in a format that anytime() can handle
spline_data$x <- anytime(spline_data$x)
# Add a column for group, ensuring it matches the type of phb_factor
spline_data$phb_factor <- as.factor(grp)
# Assign the data to the list using a character index
spline_int[[as.character(grp)]] <- spline_data
} else {
warning(paste("No data for phb_factor level", grp))
}
}
# Combine the splines into one data frame
spline_int_combined <- do.call(rbind, spline_int)
offon_plot <- ggplot(offon_count, aes(x=tatzeit, y=freq, group=phb_factor, color=as.factor(phb_factor))) +
geom_line(alpha = 0.7) +
theme_minimal() +
geom_line(data = spline_int_combined, aes(x = x, y = y, group=as.factor(phb_factor), color=as.factor(phb_factor)), size = 1.2) +
geom_smooth(data = spline_int_combined, aes(x = x, y = y, group=as.factor(phb_factor), color=as.factor(phb_factor)),
linetype="longdash", size=0.6) +
labs(x = "", y = "") +
ggtitle("Relative Share of Online to Offline PMK by PHB") +
scale_x_datetime(date_breaks = "6 month", date_minor_breaks = "6 month", date_labels = "%b-%y") +
theme(axis.text.x = element_text(angle = 90, hjust = 0.8),
legend.title = element_blank()) +
scale_y_continuous(limits = c(0, 1)) +
scale_color_manual(name = "PHB",
labels = c("Links", "Rechts", "Religiös"),
values = c("#3F88C5", "#83BCA9", "#8E6C88"))
# Plot the graph
print(offon_plot)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 2 rows containing non-finite values (`stat_smooth()`).
mean_freq_per_year <- offon_count %>%
group_by(year, phb_factor) %>%
summarise(mean_freq = mean(freq, na.rm = TRUE))
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
print(mean_freq_per_year)
## # A tibble: 33 × 3
## # Groups: year [11]
## year phb_factor mean_freq
## <dbl> <fct> <dbl>
## 1 2010 1 0.728
## 2 2010 2 0.797
## 3 2010 3 0.519
## 4 2011 1 0.725
## 5 2011 2 0.768
## 6 2011 3 0.529
## 7 2012 1 0.729
## 8 2012 2 0.802
## 9 2012 3 0.576
## 10 2013 1 0.699
## # ℹ 23 more rows
Three months alternative
# Create a date column to help with grouping by quarters
offon_count <- offon_count %>%
mutate(date = make_date(year, month, 1))
# Group by 'phb' and each 3-month period, then summarise the mean of 'freq'
offon_count3 <- offon_count %>%
group_by(phb_factor, quarter = floor_date(date, "quarter")) %>%
summarise(mean_freq = mean(freq, na.rm = TRUE)) %>%
ungroup() # remove the grouping
## `summarise()` has grouped output by 'phb_factor'. You can override using the
## `.groups` argument.
# Optionally, you might want to clean up and create a year-quarter variable
offon_count3 <- offon_count3 %>%
mutate(year_quarter = paste(year(quarter), quarter(quarter), sep = "-Q"))
offon_count3$quarter <- as.POSIXct(offon_count3$quarter)
digi_freq3 <- ggplot(offon_count3, aes(x=tatzeit, y=freq, group=phb_factor, color=as.factor(phb_factor))) +
geom_line(alpha = 0.3) +
theme_minimal()
origin <- anytime(0) # Define a reference origin time, if required
spline_int <- list() # Make sure this is defined before the loop
for (grp in unique(offon_count3$phb_factor)) {
# Subset the data for the group
group_data <- subset(offon_count3, phb_factor == grp)
# Ensure that there is data to work with
if (nrow(group_data) > 0) {
# Calculate the spline
spline_data <- as.data.frame(spline(group_data$quarter,
group_data$mean_freq,
method = "fmm", ties="mean"))
# Convert the x values to POSIXct, assuming spline_data$x is in a format that anytime() can handle
spline_data$x <- anytime(spline_data$x)
# Add a column for group, ensuring it matches the type of phb_factor
spline_data$phb_factor <- as.factor(grp)
# Assign the data to the list using a character index
spline_int[[as.character(grp)]] <- spline_data
} else {
warning(paste("No data for phb_factor level", grp))
}
}
# Combine the splines into one data frame
spline_int_combined <- do.call(rbind, spline_int)
offon3_plot <- ggplot(offon_count3, aes(x=quarter, y=mean_freq, group=phb_factor, color=as.factor(phb_factor))) +
geom_line(alpha = 0.7) +
theme_minimal() +
geom_line(data = spline_int_combined, aes(x = x, y = y, group=as.factor(phb_factor), color=as.factor(phb_factor)), size = 1.2) +
geom_smooth(data = spline_int_combined, aes(x = x, y = y, group=as.factor(phb_factor), color=as.factor(phb_factor)),
linetype="longdash", size=0.6) +
labs(x = "", y = "") +
ggtitle("Relative Share of Online to Offline PMK by PHB") +
scale_x_datetime(date_breaks = "6 month", date_minor_breaks = "6 month", date_labels = "%b-%y") +
theme(axis.text.x = element_text(angle = 90, hjust = 0.8),
legend.title = element_blank()) +
scale_y_continuous(limits = c(0, 1)) +
scale_color_manual(name = "PHB",
labels = c("Links", "Rechts", "Religiös"),
values = c("#3F88C5", "#83BCA9", "#8E6C88"))
# Plot the graph
print(offon3_plot)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
Anmerkung: Falls zu volatil, Zeitintervalle höher setzen (Halbjahresscheiben)
Statistical Tests
Alternative: Regression
data_online <- data %>% filter(offon == 1 & (phb_factor == 1 | phb_factor == 2 | phb_factor == 3))
data_online_sum <- data_online %>%
mutate(year = year(ymd(tatzeit)),
month = month(ymd(tatzeit)),
year_month = (year - 2010) * 12 + month) %>% # Calculate per month to rise N
group_by(year, month, phb_factor) %>%
summarize(count = n(), .groups = 'drop')
results <- data_online_sum %>%
group_by(phb_factor) %>%
do(model = lm(count ~ year, data = .))
results$model %>% purrr::map(summary)
## [[1]]
##
## Call:
## lm(formula = count ~ year, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.8068 -2.8409 0.1477 2.4063 9.1477
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 41.76136 221.59769 0.188 0.851
## year -0.01136 0.10997 -0.103 0.918
##
## Residual standard error: 3.996 on 130 degrees of freedom
## Multiple R-squared: 8.213e-05, Adjusted R-squared: -0.00761
## F-statistic: 0.01068 on 1 and 130 DF, p-value: 0.9179
##
##
## [[2]]
##
## Call:
## lm(formula = count ~ year, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -15.6174 -3.3383 -0.4011 3.6939 18.9439
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 406.7311 314.2787 1.294 0.198
## year -0.1871 0.1560 -1.200 0.232
##
## Residual standard error: 5.667 on 130 degrees of freedom
## Multiple R-squared: 0.01095, Adjusted R-squared: 0.003343
## F-statistic: 1.439 on 1 and 130 DF, p-value: 0.2324
##
##
## [[3]]
##
## Call:
## lm(formula = count ~ year, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.7285 -1.7285 0.1472 2.0602 5.4704
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -92.44671 144.90935 -0.638 0.525
## year 0.04971 0.07191 0.691 0.491
##
## Residual standard error: 2.593 on 128 degrees of freedom
## Multiple R-squared: 0.00372, Adjusted R-squared: -0.004064
## F-statistic: 0.4779 on 1 and 128 DF, p-value: 0.4906
Mean Digital Extremism Count
mean_counts <- data_online_sum %>%
group_by(phb_factor) %>%
summarize(mean_count = mean(count))
# View the mean counts
print(mean_counts)
## # A tibble: 3 × 2
## phb_factor mean_count
## <fct> <dbl>
## 1 1 18.9
## 2 2 29.7
## 3 3 7.73
anova_test <- aov(count ~ phb_factor, data = data_online_sum)
summary(anova_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## phb_factor 2 31560 15780 861.8 <2e-16 ***
## Residuals 391 7160 18
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
shapiro.test(data_online_sum$count)
##
## Shapiro-Wilk normality test
##
## data: data_online_sum$count
## W = 0.96498, p-value = 4.255e-08
# Test for homogeneity of variances
bartlett.test(count ~ phb_factor, data = data_online_sum)
##
## Bartlett test of homogeneity of variances
##
## data: count by phb_factor
## Bartlett's K-squared = 74.496, df = 2, p-value < 2.2e-16
Absolutes Vorkommen Online
data_online <- data %>% filter(offon == 1 & (phb_factor == 1 | phb_factor == 2 | phb_factor == 3))
data_online$phb_factor <- as.numeric(data_online$phb_factor)
table(data_online$phb_factor)
##
## 1 2 3
## 2490 3918 1005
data_count <- data_online %>%
group_by(phb_factor, delikt_factor) %>%
summarize(count = n())
## `summarise()` has grouped output by 'phb_factor'. You can override using the
## `.groups` argument.
data_count <- data_count %>%
arrange(phb_factor, desc(count))
data_count$phb_factor <- as_factor(data_count$phb_factor)
data_count$delikt_factor <- as_factor(data_count$delikt_factor)
# Convert delikt_factor into an ordered factor with levels ordered by count within each phb_factor
data_count$delikt_factor <- with(data_count, forcats::fct_inorder(delikt_factor))
# Calculate the relative share within each phb_factor group
data_count <- data_count %>%
group_by(phb_factor) %>%
mutate(total = sum(count),
relative_share = count / total * 100) %>%
ungroup()
# Plotting
ggplot(data_count, aes(x = count, y = as_factor(phb_factor), fill = as_factor(delikt_factor))) +
geom_bar(stat = "identity", position = position_dodge(width = 0.9)) +
scale_fill_manual(values = c("1" = "#CCCCCC", "2" = "#999999", "3" = "#666666", "4" = "#333333"),
labels = c("1" = "ohne explizite Motivation",
"2" = "Politisch motivierte Kriminalität",
"3" = "Politisch motivierte Gewaltkriminalität",
"4" = "Terrorismus")) +
labs(x = "Absolute Zahl", y = "Phänomenbereich", fill = "Deliktsqualität") +
scale_y_discrete(labels = c("1" = "Links", "2" = "Rechts", "3" = "Religiös")) +
theme_minimal() +
geom_text(aes(label = paste0(round(relative_share, 1), "%")),
position = position_dodge(width = 0.7),
hjust = -0.1,
vjust = 0.5) +
theme(legend.position="bottom")
head(data_count)
## # A tibble: 6 × 5
## phb_factor delikt_factor count total relative_share
## <fct> <fct> <int> <int> <dbl>
## 1 1 2 1986 2490 79.8
## 2 1 3 245 2490 9.84
## 3 1 1 234 2490 9.40
## 4 1 4 25 2490 1.00
## 5 2 2 3101 3918 79.1
## 6 2 3 402 3918 10.3
Zusatz: Noch relativen Anteil zu jedem PHB und jeden Balken einfügen!
Anmerkung Julian: Vermutlich eher als Kontrolle und nicht fürs Paper/Spotlight weil die Kategorien sehr schwammig sind und die PolizistInnen vermutlich eh unterschiedliche Sache ankreuzten je nach Bundesland.
data_count <- data_online %>%
group_by(tatmittel_factor,delikt_factor) %>%
summarize(count = n())
## `summarise()` has grouped output by 'tatmittel_factor'. You can override using
## the `.groups` argument.
data_count <- data_count %>%
arrange(desc(count))
# Convert factors
data_count$delikt_factor <- as_factor(data_count$delikt_factor)
data_count$delikt_factor <- with(data_count, fct_inorder(delikt_factor))
# Calculate the relative share within each phb_factor group
data_count <- data_count %>%
group_by(tatmittel_factor) %>%
mutate(total = sum(count),
relative_share = count / total * 100) %>%
ungroup()
ggplot(data_count, aes(x = count, y = as_factor(tatmittel_factor), fill = as_factor(delikt_factor))) +
geom_bar(stat = "identity", position = position_dodge(width = 0.9)) +
scale_fill_manual(values = c("1" = "#CCCCCC", "2" = "#999999", "3" = "#666666", "4" = "#333333"),
labels = c("1" = "ohne explizite Motivation",
"2" = "Politisch motivierte Kriminalität",
"3" = "Politisch motivierte Gewaltkriminalität",
"4" = "Terrorismus")) +
labs(x = "Absolute Zahl", y = "Tatmittel", fill = "Deliktsqualität") +
theme_minimal() +
theme(legend.position = "right") +
geom_text(aes(label = paste0(round(relative_share, 1), "%")),
position = position_dodge(width = 0.7),
hjust = -0.1,
vjust = 0.5)
Achtung hier: Mit David nach anderen Zähldelikten durchforsten
data_count <- data_online %>%
group_by(phb_factor, zaehldelikt_factor) %>%
summarize(count = n())
## `summarise()` has grouped output by 'phb_factor'. You can override using the
## `.groups` argument.
data_count <- data_count %>%
arrange(phb_factor, desc(count))
# Convert factors
data_count$phb_factor <- as_factor(data_count$phb_factor)
data_count$zaehldelikt_factor <- as_factor(data_count$zaehldelikt_factor)
data_count$zaehldelikt_factor <- with(data_count, fct_inorder(zaehldelikt_factor))
# Calculate the relative share within each phb_factor group
data_count <- data_count %>%
group_by(phb_factor) %>%
mutate(total = sum(count),
relative_share = count / total * 100) %>%
ungroup()
dodge <- position_dodge(width = 0.9)
ggplot(data_count, aes(y = as_factor(phb_factor), x = count, fill = as_factor(zaehldelikt_factor))) +
geom_bar(stat = "identity", position = dodge) +
scale_fill_manual(values = c("1" = "#CCCCCC", "2" = "#999999", "3" = "#666666", "4" = "#333333"),
labels = c("1" = "Bedrohung",
"2" = "Verfassungswidrige Organisation",
"3" = "Volksverhetzung",
"4" = "Andere Zaehldelikte (offline?)")) +
labs(x = "Absolute Zahl", y = "Phänomenbereich", fill = "Zähldelikt") +
theme_minimal() +
theme(legend.position = "bottom") +
geom_text(aes(label = paste0(round(relative_share, 1), "%")),
position = dodge,
hjust = -0.1,
vjust = 0.5) +
scale_y_discrete(labels = c("1" = "Links", "2" = "Rechts", "3" = "Religiös"))
Anmerkung: Man könnte die Kategorie “Andere” auch raus lassen, da die Informiation eigentlich redundant ist. In vorherigen FFs das Verhältnis Offline zu Online bereits abgefragt.
Achtung Limitation hier: Andere Zaehldelikte im Sinne einer jursitisch festgelegten Straftat die im Internet verfolgt werden, hier aber nicht mit erhoben werden könnten sein:
spreading or using propaganda material of terrorist organisations (§86 or §129a & b)
planning or organization of severe crimes with system risks (§89, §91) a
various forms of hateful speech such as call for violence or crime (§111)
‘Volksverhetzung’ (§130)
threatening politicians or other persons of public interest (§126,
§241).
All paragraphs reference German law ‘Strafgesetzbuch (StGB)’.
count_table <- table(data_online$phb_factor, data_online$oberthema)
count_df <- as.data.frame(count_table)
melted_df <- melt(count_df, varnames = c("phb_factor", "oberthema"))
## Using Var1, Var2 as id variables
# Calculate the relative frequencies within each Phb Factor group
melted_df <- melted_df %>%
group_by(Var1) %>%
mutate(relative_freq = value / sum(value))
# Round the relative frequencies for better readability in the plot
melted_df$relative_freq <- round(melted_df$relative_freq, digits = 3)
ggplot(melted_df, aes(x = Var1, y = Var2, fill = relative_freq)) +
geom_tile() + # Use geom_tile to create a heatmap-style plot
geom_text(aes(label = value), vjust = 1) + # Add text labels for counts
scale_fill_gradient(low = "white", high = "blue", name = "Absolute Frequency") + # Use a gradient fill based on relative frequency
theme_minimal() +
labs(x = "Phb Factor", y = "Oberthema") +
scale_x_discrete(labels = c("1" = "Links", "2" = "Rechts", "3" = "Religiös"))
Relativer Anteil
# Create the plot
ggplot(melted_df, aes(x = Var1, y = Var2, fill = relative_freq)) +
geom_tile() + # Use geom_tile to create a heatmap-style plot
geom_text(aes(label = relative_freq), vjust = 1) + # Add text labels for counts
scale_fill_gradient(low = "white", high = "blue", name = "Relative\nFrequency") + # Use a gradient fill based on relative frequency
theme_minimal() +
labs(x = "Phb Factor", y = "Oberthema") +
scale_x_discrete(labels = c("1" = "Links", "2" = "Rechts", "3" = "Religiös"))
Chi-Square and Cramers V
contingency_table <- table(data_online$phb_factor, data_online$oberthema)
chi_squared_test <- chisq.test(contingency_table)
print(chi_squared_test)
##
## Pearson's Chi-squared test
##
## data: contingency_table
## X-squared = 34.577, df = 26, p-value = 0.1211
cramers_v <- function(chi_square_result, n, minDim) {
phi <- sqrt(chi_square_result$statistic / n / min(minDim - 1, n - 1))
return(phi)
}
n <- sum(contingency_table)
minDim <- min(dim(contingency_table))
cramers_v_value <- cramers_v(chi_squared_test, n, minDim)
print(cramers_v_value)
## X-squared
## 0.04829257
Residuen überprüfen um zu sehen welche Eigenschaften einen großen Einfluss auf die jeweiligen phb hatten.
std_residuals <- chi_squared_test$residuals
residuals_df <- as.data.frame(as.table(std_residuals))
names(residuals_df) <- c("phb", "oberthema", "residual")
ggplot(residuals_df, aes(y = oberthema, x = phb, fill = residual)) +
geom_tile(color = "white") +
scale_fill_gradient2(low = "blue", high = "red", mid = "white",
midpoint = 0, limit = c(min(std_residuals), max(std_residuals)),
name="Standardized\nResiduals") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "Oberthema", y = "PHB", title = "Heatmap of Standardized Residuals")
Versuch einer Visualisierung - Korrepsondenzanalyse
ca_result <- CA(table(data_online$phb, data_online$oberthema))
plot(ca_result)
Interpretation: Dim1 stellt meiste Varianzfaktoren dar, Dim2 die zweitmeiste. Achsen sind abstrakt und nicht intrinsisch
Je näher am Nullpunkt (0/0) desto weniger Varianz über die Gruppen hinweg. Punkte weiter außerhalb haben deshalb sehr hohe Varianz. Antiziganistisch deshalb vermultich exklusiv für phb = 1, wohingegen Fremdenfeindlichkeit relativ wenige Varianz besitzt und vermutlich bei mehreren Gruppen vorkommt.
count_table <- table(data_online$phb_factor, data_online$oberangriffsziel)
count_df <- as.data.frame(count_table)
melted_df <- melt(count_df, varnames = c("phb_factor", "oberangriffsziel"))
## Using Var1, Var2 as id variables
# Calculate the relative frequencies within each Phb Factor group
melted_df <- melted_df %>%
group_by(Var1) %>%
mutate(relative_freq = value / sum(value))
# Round the relative frequencies for better readability in the plot
melted_df$relative_freq <- round(melted_df$relative_freq, digits = 3)
ggplot(melted_df, aes(x = Var1, y = Var2, fill = relative_freq)) +
geom_tile() + # Use geom_tile to create a heatmap-style plot
geom_text(aes(label = value), vjust = 1) + # Add text labels for counts
scale_fill_gradient(low = "white", high = "blue", name = "Absolute Frequency") + # Use a gradient fill based on relative frequency
theme_minimal() +
labs(x = "Phb Factor", y = "Oberangriffsziel") +
scale_x_discrete(labels = c("1" = "Links", "2" = "Rechts", "3" = "Religiös"))
Relativer Anteil
ggplot(melted_df, aes(x = Var1, y = Var2, fill = relative_freq)) +
geom_tile() + # Use geom_tile to create a heatmap-style plot
geom_text(aes(label = relative_freq), vjust = 1) + # Add text labels for counts
scale_fill_gradient(low = "white", high = "blue", name = "Absolute Frequency") + # Use a gradient fill based on relative frequency
theme_minimal() +
labs(x = "Phb Factor", y = "Oberangriffsziel") +
scale_x_discrete(labels = c("1" = "Links", "2" = "Rechts", "3" = "Religiös"))
Chi-Square and Cramers V
contingency_table <- table(data_online$phb_factor, data_online$oberangriffsziel)
chi_squared_test <- chisq.test(contingency_table)
print(chi_squared_test)
##
## Pearson's Chi-squared test
##
## data: contingency_table
## X-squared = 17.191, df = 14, p-value = 0.2461
cramers_v <- function(chi_square_result, n, minDim) {
phi <- sqrt(chi_square_result$statistic / n / min(minDim - 1, n - 1))
return(phi)
}
n <- sum(contingency_table)
minDim <- min(dim(contingency_table))
cramers_v_value <- cramers_v(chi_squared_test, n, minDim)
print(cramers_v_value)
## X-squared
## 0.03405176
Residuen überprüfen um zu sehen welche Eigenschaften einen großen Einfluss auf die jeweiligen phb hatten.
std_residuals <- chi_squared_test$residuals
residuals_df <- as.data.frame(as.table(std_residuals))
names(residuals_df) <- c("phb", "oberangriffsziel", "residual")
ggplot(residuals_df, aes(y = oberangriffsziel, x = phb, fill = residual)) +
geom_tile(color = "white") +
scale_fill_gradient2(low = "blue", high = "red", mid = "white",
midpoint = 0, limit = c(min(std_residuals), max(std_residuals)),
name="Standardized\nResiduals") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "oberangriffsziel", y = "PHB", title = "Heatmap of Standardized Residuals")
Versuch einer Visualisierung - Korrepsondenzanalyse
ca_result <- CA(table(data_online$phb, data_online$oberangriffsziel))
plot(ca_result)
Multiple Correspondence Analysis
mca_results <- MCA(data_online[, c("phb", "oberthema", "oberangriffsziel")], graph = FALSE)
print(mca_results)
## **Results of the Multiple Correspondence Analysis (MCA)**
## The analysis was performed on 7413 individuals, described by 3 variables
## *The results are available in the following objects:
##
## name description
## 1 "$eig" "eigenvalues"
## 2 "$var" "results for the variables"
## 3 "$var$coord" "coord. of the categories"
## 4 "$var$cos2" "cos2 for the categories"
## 5 "$var$contrib" "contributions of the categories"
## 6 "$var$v.test" "v-test for the categories"
## 7 "$var$eta2" "coord. of variables"
## 8 "$ind" "results for the individuals"
## 9 "$ind$coord" "coord. for the individuals"
## 10 "$ind$cos2" "cos2 for the individuals"
## 11 "$ind$contrib" "contributions of the individuals"
## 12 "$call" "intermediate results"
## 13 "$call$marge.col" "weights of columns"
## 14 "$call$marge.li" "weights of rows"
fviz_mca_var(mca_results, col.var = "cos2",
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE) # Avoid text overlapping
Axes: The horizontal axis (Dim1) and the vertical axis (Dim2) represent the first two dimensions of the MCA. These dimensions are derived from the data to explain as much of the variance in the dataset as possible. The percentage values in the axis titles (e.g., Dim1 4.9%) indicate how much of the variance in the data is explained by that dimension.
Category Points: Each point represents a category of the variables analyzed. The position of a point relative to the axes shows how that category is associated with the dimensions.
Distance Between Points: Categories that are closer to each other are more similar or have a stronger relationship in the dataset. Conversely, categories that are farther from each other are less similar or more distinct.
Quality of Representation (cos2): The color of the points indicates the quality of the representation on the plot, which is measured by the squared cosine (cos2). A high cos2 value (closer to 1, warm colors like red) means that the category is well represented by the two dimensions shown on the plot. A low cos2 value (closer to 0, cool colors like blue) means that the category is not as well represented, and additional dimensions would be needed to better understand its relationships.
Dim1: This axis seems to separate categories like “Islamfeindlich”, “Rechts”, “Geschlecht/Sex. Identität”, which are on the negative side, from “Antisemitisch”, “Moschee”, “Synagoge”, which are on the positive side. This could suggest a contrast between attitudes or themes associated with these categories, perhaps reflecting different ideological or social themes. Additionaly, Links and Rechts seem to be more close to each other that Religiöse Ideologie Dim2: On the lower side of this axis, we see “Deutschfeindlich”, “Links”, “Staat”, and on the upper side, we see “Antiziganistisch”, “Kirche”, “Religiöse Ideologie”. The second dimension might be capturing another aspect of the categorical data that distinguishes between these groups.
To discuss, work further down the Road:
Je nach dem wie die Verlaufslinien verlaufen, kann man hier gezielt nach Punkten suchen.
Stadt-Land Gefälle?
Zusammenhang mit Demos?