1. Packages einlesen

library(foreign)
#install.packages("ggplot2")
library(ggplot2)
#install.packages("tidyverse")
library(tidyverse)
#install.packages("plotly")
library(plotly)
#install.packages("gapminder")
library(gapminder)
#install.packages("psych")
library(psych)
#install.packages("car")
library(car)
library(carData)
#install.packages("forcats")
library(forcats)
#install.packages("DescTools")
library(DescTools)
#install.packages("e1071")
library(e1071)
#install.packages("sjPlot")
#install.packages("patchwork")
library(patchwork)
#install.packages("gridExtra")
library(gridExtra)
#install.packages("QuantPsyc")
#install.packages("lm.beta")
#install.packages("sandwich")
library(lm.beta)
library(sjPlot)
library(glmmTMB)
library(sandwich)
#install.packages("tinytext")
library(tinytex)
#tinytex::install_tinytex()
#install_tinytex()
#install.packages("modelsummary")
library(modelsummary)
#install.packages("stargazer")
library(stargazer)
#install.packages("webshot")
library(webshot)
#install.packages("Hmisc")
library(Hmisc)
#install.packages("dplyr")
library(dplyr)
#install.packages("VIM", dependencies = TRUE)
library(VIM)
#install.packages("mice")
library(mice)
#install.packages("ggpubr")
library(ggpubr)
#install.packages("vtable")
library(vtable)
#install.packages("lme4")
library(lme4)
#install.packages("easystats")
library(easystats)
#install.packages("esquisse")
library(esquisse)
#install.packages("devtools")
library(openai)
require(devtools)

2. Daten einlesen

#Einlesen vom Albus Datensatz 
Albus <- read.spss("./Allbus-2018.sav", use.value.labels = FALSE, to.data.frame = TRUE, reencode = TRUE)

3. AV Migration und Umweltschutz

3.1 AV Migration

  • AV1: Einstellungen gegenüber Migranten (atm - attitudes towards migrants)

  • Skala von 1-5, keine Zustimmung - volle Zustimmung

    • px06 (= BRD gefährlich überfremdet)

    • px07 (= Ausländer sollten grundsätzlich ihre Ehepartner unter ihren eigenen Landsleuten auswählen)

    • px10 (= Anschläge auf Asylbewerberheime kann ich gut verstehen)

    • pa17 (= Einwanderer sind gut für die deutsche Wirtschaft; Variable muss gedreht werden)

    • pa09 (= Einwanderer sollten sich deutschen Sitten und Gebräuchen anpassen; Variable muss gedreht werden)

    • JO35_2 (= Einstellung zu Muslimen, als Proxy zur Einstellung von Migranten)

Grafik

#Drehen von Variablen 
Albus$ausländer_wirtschaft <- (Albus$pa17 - 6) *-1

Albus$ausländer_sitten <- (Albus$pa09)
Albus$a <- (Albus$px06 -6) * -1
Albus$b <- (Albus$px07 -6) * -1
Albus$c <- (Albus$px10 -6) * -1

3.1.1 PCA

  • Faktoranalyse, ob die Variablen sich zu einem Index zusammenfügen lassen
#Kontrolle der NA's
var <- c("px06", "px07", "px10", "ausländer_wirtschaft", "ausländer_sitten")
Albus$missings <- rowSums(is.na(Albus[, var]))
table(Albus$missings) #kleinste gemeinsame Fallzahl ist 3120
## 
##    0    1    2    3    4    5 
## 3120  120   18  209    8    2
sum(is.na(Albus[, var])) # 825 Missings
## [1] 825
#Anteil an Missings
(825 / 3477) * 100
## [1] 23.72735
# Anteil der NA's über alle Variablen beträgt 23.7% und muss imputiert werden

Albus_NA <- subset(Albus[,var])


var_1 <- c("a", "b", "c", "ausländer_sitten")
Albus$missings_2 <- rowSums(is.na(Albus[, var_1]))
table(Albus$missings_2) #kleinste gemeinsame Fallzahl ist 3188
## 
##    0    1    2    3    4 
## 3188   59   11  213    6
sum(is.na(Albus[, var_1])) # 744 Missings
## [1] 744
#Anteil an Missings
(744 / 3477) * 100
## [1] 21.39776
# Anteil der NA's über alle Variablen beträgt 21.4% und muss imputiert werden

Albus_NA_1 <- subset(Albus[,var_1])

var_2 <- c("px06", "px07", "ausländer_sitten")
Albus$missings_3 <- rowSums(is.na(Albus[, var_2]))
table(Albus$missings_3) #kleinste gemeinsame Fallzahl ist 3201
## 
##    0    1    2    3 
## 3201   51  219    6
sum(is.na(Albus[, var_2])) #507 Missings
## [1] 507
#Anteil an Missings
(507 / 3477) * 100
## [1] 14.58154
#Anteil der NA's über alle Variablen beträgt 14,6% und muss imputiert werden 

Albus_NA_2 <- subset(Albus[, var_2])
#Funktion für Grafik
propmiss <- function(dataframe) {
  m <- sapply(dataframe, function(x) {
    data.frame(
      nmiss=sum(is.na(x)), 
      n=length(x), 
      propmiss=sum(is.na(x))/length(x)
    )
  })
  d <- data.frame(t(m))
  d <- sapply(d, unlist)
  d <- as.data.frame(d)
  d$variable <- row.names(d)
  row.names(d) <- NULL
  d <- cbind(d[ncol(d)],d[-ncol(d)])
  return(d[order(d$propmiss), ])
}
miss_vars<-propmiss(Albus_NA_1)
miss_vars_mean<-mean(miss_vars$propmiss)
miss_vars_ges<- miss_vars  %>% arrange(desc(propmiss)) 
plot <-ggplot(miss_vars_ges,aes(x=reorder(variable,propmiss),y=propmiss*100)) + 
  geom_point(size=3) +
  coord_flip() + 
  theme_bw() + xlab("") +ylab("NAs pro Variable in %") +
  theme(panel.grid.major.x=element_blank(),
        panel.grid.minor.x=element_blank(),
        panel.grid.major.y=element_line(colour="grey",linetype="dashed")) +
  ggtitle("Prozent an NAs")
plot

ggsave(filename = "NA_proptable.png", plot = plot, width = 8, height  = 7, dpi = 1000)

aggr(Albus_NA_1, numbers=TRUE, prop=TRUE, combined=TRUE, sortVars=F, vscale = 1)

#Imputation der Daten 
imputed_data <- mice(Albus_NA, m = 50, method = "pmm")
completed_data <- complete(imputed_data)

imputed_data_1 <- mice(Albus_NA_1, m = 50, method = "pmm")
completed_data_1 <- complete(imputed_data_1)


imputed_data_2 <- mice(Albus_NA_2, m = 50, method = "pmm")
completed_data_2 <- complete(imputed_data_2)
#Bartlett Test ob Korrelation (!=0) gibt 
cortest.bartlett(Albus_NA)
## $chisq
## [1] 3410.029
## 
## $p.value
## [1] 0
## 
## $df
## [1] 10
#Kaiser-Meyer-Olkin-Kriterium zur Beurteilung der Eignung der Daten zur Durchführung einer Faktoranalyse 
kmo <- KMO(Albus_NA)
kmo
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = Albus_NA)
## Overall MSA =  0.75
## MSA for each item = 
##                 px06                 px07                 px10 
##                 0.70                 0.78                 0.80 
## ausländer_wirtschaft     ausländer_sitten 
##                 0.77                 0.77
#geordnete MSAi
kmo$MSAi[order(kmo$MSAi)]
##                 px06     ausländer_sitten ausländer_wirtschaft 
##            0.7024397            0.7712986            0.7736524 
##                 px07                 px10 
##            0.7769871            0.7999107
#Bartlett Test ob Korrelation (!=0) gibt 
cortest.bartlett(Albus_NA_1)
## $chisq
## [1] 2379.119
## 
## $p.value
## [1] 0
## 
## $df
## [1] 6
#Kaiser-Meyer-Olkin-Kriterium zur Beurteilung der Eignung der Daten zur Durchführung einer Faktoranalyse 
kmo <- KMO(Albus_NA_1)
kmo
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = Albus_NA_1)
## Overall MSA =  0.69
## MSA for each item = 
##                a                b                c ausländer_sitten 
##             0.65             0.72             0.75             0.68
#geordnete MSAi
kmo$MSAi[order(kmo$MSAi)]
##                a ausländer_sitten                b                c 
##        0.6536623        0.6803117        0.7214650        0.7473041
#Bartlett Test ob Korrelation (!=0) gibt 
cortest.bartlett(Albus_NA_2)
## $chisq
## [1] 1827.782
## 
## $p.value
## [1] 0
## 
## $df
## [1] 3
#Kaiser-Meyer-Olkin-Kriterium zur Beurteilung der Eignung der Daten zur Durchführung einer Faktoranalyse 
kmo <- KMO(Albus_NA_2)
kmo
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = Albus_NA_2)
## Overall MSA =  0.63
## MSA for each item = 
##             px06             px07 ausländer_sitten 
##             0.60             0.67             0.66
#geordnete MSAi
kmo$MSAi[order(kmo$MSAi)]
##             px06 ausländer_sitten             px07 
##        0.5976965        0.6551481        0.6713080

Bei einem KMO von 0.63 sehen wir eine gute bis sehr hohe Eignung für die Faktoranalyse. Die Variablen weisen starke linerare Abhängigkeiten auf. Es müssen keine Items ausgeschlossen werden, da alle über 0.5 liegen, was bei einem Wert unter 0.5 empfohlen ist.

#Anzahl der Komponenten
fa.parallel(completed_data, fa = "pc") #Ein Faktor lässt sich in der explorativen Faktoranalyse bestätigen

## Parallel analysis suggests that the number of factors =  NA  and the number of components =  1
#konfirmatorische Faktoranalyse  
# Durchführung 
kfa_result <- fa(completed_data, nfactors = 1, rotate = "varimax")

# Zeige die Ergebnisse der EFA an
print(kfa_result)
## Factor Analysis using method =  minres
## Call: fa(r = completed_data, nfactors = 1, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                        MR1   h2   u2 com
## px06                  0.84 0.70 0.30   1
## px07                  0.58 0.33 0.67   1
## px10                  0.43 0.18 0.82   1
## ausländer_wirtschaft -0.56 0.32 0.68   1
## ausländer_sitten     -0.54 0.29 0.71   1
## 
##                 MR1
## SS loadings    1.82
## Proportion Var 0.36
## 
## Mean item complexity =  1
## Test of the hypothesis that 1 factor is sufficient.
## 
## df null model =  10  with the objective function =  0.98 with Chi Square =  3398.61
## df of  the model are 5  and the objective function was  0.04 
## 
## The root mean square of the residuals (RMSR) is  0.04 
## The df corrected root mean square of the residuals is  0.06 
## 
## The harmonic n.obs is  3477 with the empirical chi square  128.65  with prob <  4.6e-26 
## The total n.obs was  3477  with Likelihood Chi Square =  135.73  with prob <  1.4e-27 
## 
## Tucker Lewis Index of factoring reliability =  0.923
## RMSEA index =  0.087  and the 90 % confidence intervals are  0.074 0.1
## BIC =  94.96
## Fit based upon off diagonal values = 0.99
## Measures of factor score adequacy             
##                                                    MR1
## Correlation of (regression) scores with factors   0.89
## Multiple R square of scores with factors          0.80
## Minimum correlation of possible factor scores     0.59
fa.diagram(kfa_result, simple = T)

#Anzahl der Komponenten
fa.parallel(completed_data_1, fa = "pc") #Ein Faktor lässt sich in der explorativen Faktoranalyse bestätigen

## Parallel analysis suggests that the number of factors =  NA  and the number of components =  1
#konfirmatorische Faktoranalyse  
# Durchführung 
kfa_result <- fa(completed_data_1, nfactors = 1, rotate = "varimax")

# Zeige die Ergebnisse der EFA an
print(kfa_result)
## Factor Analysis using method =  minres
## Call: fa(r = completed_data_1, nfactors = 1, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                   MR1   h2   u2 com
## a                0.80 0.64 0.36   1
## b                0.61 0.37 0.63   1
## c                0.42 0.18 0.82   1
## ausländer_sitten 0.53 0.29 0.71   1
## 
##                 MR1
## SS loadings    1.47
## Proportion Var 0.37
## 
## Mean item complexity =  1
## Test of the hypothesis that 1 factor is sufficient.
## 
## df null model =  6  with the objective function =  0.66 with Chi Square =  2302.55
## df of  the model are 2  and the objective function was  0.03 
## 
## The root mean square of the residuals (RMSR) is  0.05 
## The df corrected root mean square of the residuals is  0.08 
## 
## The harmonic n.obs is  3477 with the empirical chi square  92.33  with prob <  8.9e-21 
## The total n.obs was  3477  with Likelihood Chi Square =  100.65  with prob <  1.4e-22 
## 
## Tucker Lewis Index of factoring reliability =  0.871
## RMSEA index =  0.119  and the 90 % confidence intervals are  0.1 0.139
## BIC =  84.34
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy             
##                                                    MR1
## Correlation of (regression) scores with factors   0.86
## Multiple R square of scores with factors          0.75
## Minimum correlation of possible factor scores     0.50
fa.diagram(kfa_result, simple = T)

#Anzahl der Komponenten
fa.parallel(completed_data_2, fa = "pc") #Ein Faktor lässt sich in der explorativen Faktoranalyse bestätigen

## Parallel analysis suggests that the number of factors =  NA  and the number of components =  1
#konfirmatorische Faktoranalyse  
# Durchführung 
kfa_result <- fa(completed_data_2, nfactors = 1, rotate = "varimax")

# Zeige die Ergebnisse der EFA an
print(kfa_result)
## Factor Analysis using method =  minres
## Call: fa(r = completed_data_2, nfactors = 1, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                    MR1   h2   u2 com
## px06              0.85 0.72 0.28   1
## px07              0.53 0.28 0.72   1
## ausländer_sitten -0.57 0.32 0.68   1
## 
##                 MR1
## SS loadings    1.32
## Proportion Var 0.44
## 
## Mean item complexity =  1
## Test of the hypothesis that 1 factor is sufficient.
## 
## df null model =  3  with the objective function =  0.5 with Chi Square =  1730.42
## df of  the model are 0  and the objective function was  0 
## 
## The root mean square of the residuals (RMSR) is  0 
## The df corrected root mean square of the residuals is  NA 
## 
## The harmonic n.obs is  3477 with the empirical chi square  0  with prob <  NA 
## The total n.obs was  3477  with Likelihood Chi Square =  0  with prob <  NA 
## 
## Tucker Lewis Index of factoring reliability =  -Inf
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                    MR1
## Correlation of (regression) scores with factors   0.88
## Multiple R square of scores with factors          0.78
## Minimum correlation of possible factor scores     0.55
fa.diagram(kfa_result, simple = T)

Ausländer_wirtschaft muss gedroppt werden, da es einen negative Korrelation auweist und somit den Index verfälschen würde.

3.2 Index bilden

#Index bilden 
Albus$Migration <- rowSums(completed_data, na.rm = T) / 5
Desc(Albus$Migration)
## ------------------------------------------------------------------------------ 
## Albus$Migration (numeric)
## 
##   length       n    NAs  unique    0s  mean  meanCI'
##    3'477   3'477      0      19     0  2.27    2.26
##           100.0%   0.0%          0.0%          2.29
##                                                    
##      .05     .10    .25  median   .75   .90     .95
##     1.60    1.80   2.00    2.20  2.60  2.80    3.00
##                                                    
##    range      sd  vcoef     mad   IQR  skew    kurt
##     3.80    0.45   0.20    0.30  0.60  0.75    1.18
##                                                    
## lowest : 1.0 (3), 1.2 (13), 1.4 (48), 1.6 (157), 1.8 (486)
## highest: 3.8 (11), 4.0 (3), 4.2 (6), 4.4, 4.8
## 
## heap(?): remarkable frequency (19.3%) for the mode(s) (= 2.2)
## 
## ' 95%-CI (classic)

Albus$Migration_1 <- rowSums(completed_data_1, na.rm = T) /4
Desc(Albus$Migration_1)
## ------------------------------------------------------------------------------ 
## Albus$Migration_1 (numeric)
## 
##   length       n    NAs  unique    0s   mean  meanCI'
##    3'477   3'477      0      17     0   3.41    3.39
##           100.0%   0.0%          0.0%           3.44
##                                                     
##      .05     .10    .25  median   .75    .90     .95
##     2.00    2.25   2.75    3.50  4.00   4.50    4.75
##                                                     
##    range      sd  vcoef     mad   IQR   skew    kurt
##     4.00    0.83   0.24    0.74  1.25  -0.32   -0.38
##                                                     
## lowest : 1.0 (16), 1.25 (21), 1.5 (39), 1.75 (44), 2.0 (130)
## highest: 4.0 (408), 4.25 (336), 4.5 (195), 4.75 (154), 5.0 (62)
## 
## heap(?): remarkable frequency (11.7%) for the mode(s) (= 4)
## 
## ' 95%-CI (classic)

table(Albus$Migration_1)
## 
##    1 1.25  1.5 1.75    2 2.25  2.5 2.75    3 3.25  3.5 3.75    4 4.25  4.5 4.75 
##   16   21   39   44  130  138  222  302  351  368  342  349  408  336  195  154 
##    5 
##   62
Albus$Migration_2 <- rowSums(completed_data_2, na.rm = T) / 3
Desc(Albus$Migration_2)
## ------------------------------------------------------------------------------ 
## Albus$Migration_2 (numeric)
## 
##     length         n       NAs    unique        0s      mean     meanCI'
##      3'477     3'477         0        12         0  2.230659   2.209344
##               100.0%      0.0%                0.0%             2.251973
##                                                                        
##        .05       .10       .25    median       .75       .90        .95
##   1.333333  1.333333  1.666667  2.333333  2.666667  3.000000   3.333333
##                                                                        
##      range        sd     vcoef       mad       IQR      skew       kurt
##   3.666667  0.641028  0.287371  0.494200  1.000000  0.370328  -0.171135
##                                                                        
## 
##                value  freq   perc  cumfreq  cumperc
## 1                  1    95   2.7%       95     2.7%
## 2   1.33333333333333   363  10.4%      458    13.2%
## 3   1.66666666666667   528  15.2%      986    28.4%
## 4                  2   693  19.9%    1'679    48.3%
## 5   2.33333333333333   726  20.9%    2'405    69.2%
## 6   2.66666666666667   443  12.7%    2'848    81.9%
## 7                  3   339   9.7%    3'187    91.7%
## 8   3.33333333333333   165   4.7%    3'352    96.4%
## 9   3.66666666666667   105   3.0%    3'457    99.4%
## 10                 4    13   0.4%    3'470    99.8%
## 11  4.33333333333333     3   0.1%    3'473    99.9%
## 12  4.66666666666667     4   0.1%    3'477   100.0%
## 
## ' 95%-CI (classic)

Grafik

Migration <- ggplot(Albus, aes(Migration_1))+
 geom_bar(aes(y = (..count..)/sum(..count..)),
 fill = "lightblue", color = "blue")+
 scale_y_continuous(labels = scales::percent)+
 scale_x_continuous(breaks = seq(1,5),
 labels = c("Keine Ablehung","2", "3", "4", "starke Ablehung"))+
 labs(title = "Einstellung gegenüber Migranten",
 caption = "Data: ALLBUS (2018)",
 y = "Häufigkeit in Prozent",
 x ="Einstellung gegenüber Migranten")+
 theme_bw()
Migration

ggsave(filename = "Einstellung_Migranten.png", plot = Migration, width = 8, height  = 7, dpi = 1000)

3.2 AV Umweltschutz

  • AV2: Umweltschutz

  • Skala von 1-5, keine Zustimmung - volle Zustimmung

    • pa11 (= Zum Schutz der Umwelt sollten härtere Maßnahmen getroffen werden; Variable drehen und dann Skala von 0-4)

    • sm09 (= Mitglied in Naturzschutzorganisation; möglicher Dummy?)

    • pp22 (= Aus politischen, ethischen oder Umweltgründen Waren boykottieren; Dummy)

    • pp40 (= Habe aus politischen, ethischen oder Umweltgründen Waren boykottieren, oder kaufen; Meiner Meinung nach sinnlos, weil es in beide Richtungen zeigen kann und wir nicht wissen, was was ist)

#Variable drehen (hohe Werte bedeuten hohe Zustimmung)
attributes(Albus$pa11)
## $value.labels
##  STIMME GAR NICHT ZU STIMME EHER NICHT ZU           WEDER NOCH 
##                  "5"                  "4"                  "3" 
##       STIMME EHER ZU       STIMME VOLL ZU 
##                  "2"                  "1"
Albus$Umweltschutz <- (Albus$pa11 - 6) *-1
Desc(Albus$Umweltschutz)
## ------------------------------------------------------------------------------ 
## Albus$Umweltschutz (numeric)
## 
##   length      n    NAs  unique    0s   mean  meanCI'
##    3'477  3'450     27       5     0   4.26    4.23
##           99.2%   0.8%          0.0%           4.29
##                                                    
##      .05    .10    .25  median   .75    .90     .95
##     2.00   3.00   4.00    5.00  5.00   5.00    5.00
##                                                    
##    range     sd  vcoef     mad   IQR   skew    kurt
##     4.00   0.95   0.22    0.00  1.00  -1.42    1.63
##                                                    
## 
##    value   freq   perc  cumfreq  cumperc
## 1      1     61   1.8%       61     1.8%
## 2      2    193   5.6%      254     7.4%
## 3      3    290   8.4%      544    15.8%
## 4      4  1'151  33.4%    1'695    49.1%
## 5      5  1'755  50.9%    3'450   100.0%
## 
## ' 95%-CI (classic)

Grafik

Umweltschutz <- ggplot(Albus, aes(Umweltschutz))+
 geom_bar(aes(y = (..count..)/sum(..count..)),
 fill = "lightblue", color = "blue")+
 scale_y_continuous(labels = scales::percent)+
 scale_x_continuous(breaks = seq(1,5),
 labels = c("Keine Zustimmung","2", "3", "4", "starke Zustimmung"))+
 labs(title = "Umweltschutz",
 caption = "Data: ALLBUS (2018)",
 y = "Häufigkeit in Prozent",
 x ="Umweltschutz")+
 theme_bw()
Umweltschutz

ggsave(filename = "Umweltschutz.png", plot = Umweltschutz, width = 8, height  = 7, dpi = 1000)
#Kontrolle der NA's
sum(is.na(Albus$pa11)) # 27 Missings
## [1] 27
#Anteil an Missings
(27 / 3477) * 100
## [1] 0.7765315
# Anteil der NA's über alle Variablen beträgt 0.77% und muss daher nicht imputiert werden

4. UV Heimat

  • pn12 (= Verbundenheit zur Gemeinde; local identity anstatt national identity

  • Zwei Formen von Dummys:

    • Einmal 1-2 werden geprüft und 3-4 zusammengefasst als Referenz

    • Einmal 1-4 werden geprüft und 4 ist Referenz

Aufgrund der fehlenden qunatitativen Vorarbeit zur Operationalisierung von Heimat, haben wir verschiedene Wege der Operationalisierung ausprobiert und haben uns schlussendlich auf den zweiten Weg festgelegt für diese Arbeit.

4.1 Weg 1

#Weg 1 (= Verbundenheit mit Gemeinde)
Albus$pn12_r <- car::recode(Albus$pn12,
                            "1 = 1;
                            2= 2;
                            3:4 = 3;
                            else = NA")
pn12_f <- as.factor(Albus$pn12_r)
Albus$Heimat_1 <- relevel(pn12_f, ref = 3)
#Verbundenheit mit Deutschland pn16
Albus$pn12_r_1 <- car::recode(Albus$pn16,
                            "1 = 1;
                            2= 2;
                            3:4 = 3;
                            else = NA")
pn12_f_1 <- as.factor(Albus$pn12_r_1)
Albus$Heimat_1.1 <- relevel(pn12_f_1, ref = 3)
#Verbundenheit mit EU pn17
Albus$pn12_r_2 <- car::recode(Albus$pn17,
                            "1 = 1;
                            2= 2;
                            3:4 = 3;
                            else = NA")
pn12_f_2 <- as.factor(Albus$pn12_r_2)
Albus$Heimat_1.2 <- relevel(pn12_f_2, ref = 3)

4.1.1 Tabelle und Grafik

 geom_bar(aes(y = (..count..)/sum(..count..)),
 fill = "lightblue", color = "blue")+
 scale_y_continuous(labels = scales::percent)+
 scale_x_continuous(breaks = seq(1,4),
 labels = c("Keine Verbundenheit","2", "3", "starke Verbundenheit"))+
 labs(title = "Heimatverbundenheit",
 caption = "Data: ALLBUS (2018)",
 y = "Häufigkeit in Prozent",
 x ="Heimatverbundenheit")+
 theme_bw()
Heimat
ggsave(filename = "Heimat.png", plot = Heimat, width = 8, height  = 7, dpi = 1000)

4.2 Weg 2

#Weg 2
Albus$pn12_g <- as.factor(Albus$pn12)
Albus$Heimat_2 <- relevel(Albus$pn12_g, ref = 4)
Desc(Albus$Heimat_2)
## ------------------------------------------------------------------------------ 
## Albus$Heimat_2 (factor)
## 
##   length      n    NAs unique levels  dupes
##    3'477  3'460     17      4      4      y
##           99.5%   0.5%                     
## 
##    level   freq   perc  cumfreq  cumperc
## 1      2  1'567  45.3%    1'567    45.3%
## 2      3    933  27.0%    2'500    72.3%
## 3      1    827  23.9%    3'327    96.2%
## 4      4    133   3.8%    3'460   100.0%

Albus$Heimat_3 <- car::recode(Albus$pn12,
                              "
                              1:3 = 1;
                              4 = 0;
                              else = NA")
#Verbundenheit mit Deutschland pn16
pn12_g_1 <- as.factor(Albus$pn16)
Albus$Heimat_2.1 <- relevel(pn12_g_1, ref = 4)

Albus$Heimat_3.1 <- car::recode(Albus$pn16,
                              "
                              1:3 = 1;
                              4 = 0;
                              else = NA")
#Verbundenheit mit EU pn17
pn12_g_2 <- as.factor(Albus$pn16)
Albus$Heimat_2.2 <- relevel(pn12_g_2, ref = 4)

Albus$Heimat_3.2 <- car::recode(Albus$pn16,
                              "
                              1:3 = 1;
                              4 = 0;
                              else = NA")

5. Kontrollvariablen

Zufriedenheit mit Wirtschaft

attributes(Albus$ep01)
## $value.labels
## SEHR SCHLECHT      SCHLECHT   TEILS TEILS           GUT      SEHR GUT 
##           "5"           "4"           "3"           "2"           "1"
Albus$ZufWirtschaft <- (Albus$ep01 - 6) * -1

Ost-West

  • 1 Alte Bundesländer, 2 Neue Bundesländer

  • Alte Bundesländer sind Referenz

ostwest <- car::recode(Albus$eastwest,
                       "1 = 0;
                       2 = 1; else = NA")
Albus$ostDummy <- as.factor(ostwest)

Bildung nach ISCD-Standard

1 = Kein Abschluss; 2 = Hauptschule; 3 = Realschule; 4 = Fachhochschule, Abitur

  • lower Education wird als Referenz genutzt

  • Es wird ein Dummy gebildet:

    • Lower Education: Level 1, 2, 3 (= Primary education, Lower secondary education, Upper secondary education)
    • Middle Education: Level 4, 5 (= Post secondary non-tertiary education, Short-cycle tertiary education)
    • Higher Education: Level 6, 7, 8 (= Bachelor’s or equivalent level, Master’s or equivalent level, Doctoral or equivalent level)
    • lower education wird als Referenz gesetzt
    • Begründung nach Wordl Values Survey, welche diese Vereinfachung nutzen, um einen einfacheren Vergleich durchführen zu können
attributes(Albus$educ)
## $value.labels
##      NOCH SCHUELER  ANDERER ABSCHLUSS     HOCHSCHULREIFE FACHHOCHSCHULREIFE 
##                "7"                "6"                "5"                "4" 
##     MITTLERE REIFE VOLKS-,HAUPTSCHULE     OHNE ABSCHLUSS 
##                "3"                "2"                "1"
table(Albus$educ)
## 
##    1    2    3    4    5    6    7 
##   50  810 1195  302 1075   20   22
Albus$bildung <- car::recode(Albus$educ,
                             "1 = 1; 
                             2 = 2;
                             3 = 3;
                             4:5 = 4; else = NA")

#Dummy-Variable Bildung Realschulabschluss ist Referenzkategorie 
bildung <- as.factor(Albus$bildung)
Albus$bildungDummy <- relevel(bildung, ref = 1)


attributes(Albus$iscd11)
## $value.labels
##       DOCTORAL LEVEL         MASTER LEVEL       BACHELOR LEVEL 
##                  "8"                  "7"                  "6" 
## SHORT-CYCLE TERTIARY       POST SECONDARY      UPPER SECONDARY 
##                  "5"                  "4"                  "3" 
##      LOWER SECONDARY    PRIMARY EDUCATION 
##                  "2"                  "1"
table(Albus$iscd11)
## 
##    1    2    3    4    5    6    7    8 
##   35  236 1543  256  457  159  696   72
Albus$bildung <- car::recode(Albus$iscd11,
                             "1:3 = 1;
                             4:5 = 2;
                             6:8 = 3; else = NA")
bildung <- as.factor(Albus$bildung)
Albus$bildungDummy <- relevel(bildung, ref = 1)

Politisches Interesse

#Politisches Interesse 
attributes(Albus$pa02a)
## $value.labels
## UEBERHAUPT NICHT            WENIG           MITTEL            STARK 
##              "5"              "4"              "3"              "2" 
##       SEHR STARK 
##              "1"
table(Albus$pa02a)
## 
##    1    2    3    4    5 
##  385  943 1605  429  113
Albus$pol_intr <- (Albus$pa02a -5) * -1
table(Albus$pol_intr)
## 
##    0    1    2    3    4 
##  113  429 1605  943  385
Desc(Albus$pol_intr)
## ------------------------------------------------------------------------------ 
## Albus$pol_intr (numeric)
## 
##   length      n    NAs  unique    0s   mean  meanCI'
##    3'477  3'475      2       5   113   2.30    2.27
##           99.9%   0.1%          3.2%           2.34
##                                                    
##      .05    .10    .25  median   .75    .90     .95
##     1.00   1.00   2.00    2.00  3.00   4.00    4.00
##                                                    
##    range     sd  vcoef     mad   IQR   skew    kurt
##     4.00   0.94   0.41    1.48  1.00  -0.07   -0.06
##                                                    
## 
##    value   freq   perc  cumfreq  cumperc
## 1      0    113   3.3%      113     3.3%
## 2      1    429  12.3%      542    15.6%
## 3      2  1'605  46.2%    2'147    61.8%
## 4      3    943  27.1%    3'090    88.9%
## 5      4    385  11.1%    3'475   100.0%
## 
## ' 95%-CI (classic)

shapiro.test(Albus$pa02a)
## 
##  Shapiro-Wilk normality test
## 
## data:  Albus$pa02a
## W = 0.88946, p-value < 2.2e-16
polintr <- car::recode(Albus$pa02a,"
                                   1:2 = 1;
                                   4:5 = 2;
                                   3 = 3; else = NA")
Albus$polintr_dummy_1 <- as.factor(polintr)
Albus$polintr_dummy <- relevel(Albus$polintr_dummy_1, ref = 3) #Referenz ist das mittlere politische Interesse

Alter

Desc(Albus$age) #Variable = age
## ------------------------------------------------------------------------------ 
## Albus$age (numeric)
## 
##   length      n    NAs  unique     0s   mean  meanCI'
##    3'477  3'472      5      77      0  51.68   51.09
##           99.9%   0.1%           0.0%          52.26
##                                                     
##      .05    .10    .25  median    .75    .90     .95
##    23.00  27.00  37.00   53.00  65.00  76.00   80.00
##                                                     
##    range     sd  vcoef     mad    IQR   skew    kurt
##    77.00  17.64   0.34   20.76  28.00  -0.01   -0.87
##                                                     
## lowest : 18.0 (26), 19.0 (37), 20.0 (34), 21.0 (34), 22.0 (33)
## highest: 90.0 (4), 91.0, 92.0 (7), 94.0 (2), 95.0
## 
## ' 95%-CI (classic)
#Variable wird Mittelwertszentriert um es für den Haupteffekt interpretierbar zu machen 
center_scale <- function(x) {
  scale(x, scale = FALSE)
}#Funktion wird geschrieben 

Albus$Alter_zentriert <- center_scale(Albus$age)
Desc(Albus$age)
## ------------------------------------------------------------------------------ 
## Albus$age (numeric)
## 
##   length      n    NAs  unique     0s   mean  meanCI'
##    3'477  3'472      5      77      0  51.68   51.09
##           99.9%   0.1%           0.0%          52.26
##                                                     
##      .05    .10    .25  median    .75    .90     .95
##    23.00  27.00  37.00   53.00  65.00  76.00   80.00
##                                                     
##    range     sd  vcoef     mad    IQR   skew    kurt
##    77.00  17.64   0.34   20.76  28.00  -0.01   -0.87
##                                                     
## lowest : 18.0 (26), 19.0 (37), 20.0 (34), 21.0 (34), 22.0 (33)
## highest: 90.0 (4), 91.0, 92.0 (7), 94.0 (2), 95.0
## 
## ' 95%-CI (classic)

Geschlecht

attributes(Albus$sex) #1 ist Mann und 2 ist Frau 
## $value.labels
## FRAU MANN 
##  "2"  "1"
Albus$geschlecht <- car::recode(Albus$sex,
                                "1 = 0; 
                                 2 = 1; else = NA") #0 ist Mann und Referenz 1 ist Frau 
Albus$geschlecht_f <- car::recode(Albus$sex, "
                                  1 = 1;
                                  2 = 0; else = NA") #0 ist Frau und Referenz und 1 ist Mann

Nettoeinkommen

Desc(Albus$di01a) #einkommen wird Mittelwertszentriert, da sie kontinuierlich ist 
## ------------------------------------------------------------------------------ 
## Albus$di01a (numeric)
## 
##      length         n     NAs    unique        0s      mean    meanCI'
##       3'477     2'647     830       339         0  1'788.59  1'739.82
##                 76.1%   23.9%                0.0%            1'837.35
##                                                                      
##         .05       .10     .25    median       .75       .90       .95
##      414.60    570.60  990.00  1'500.00  2'300.00  3'200.00  4'000.00
##                                                                      
##       range        sd   vcoef       mad       IQR      skew      kurt
##   17'975.00  1'279.41    0.72    889.56  1'310.00      3.09     22.74
##                                                                      
## lowest : 25.0, 50.0 (3), 60.0, 62.0, 85.0
## highest: 9'500.0, 10'000.0 (2), 12'000.0, 15'000.0 (2), 18'000.0
## 
## heap(?): remarkable frequency (5.9%) for the mode(s) (= 2000)
## 
## ' 95%-CI (classic)
Albus$Einkommen_zentriert <- center_scale(Albus$di01a)
Desc(Albus$di01a)
## ------------------------------------------------------------------------------ 
## Albus$di01a (numeric)
## 
##      length         n     NAs    unique        0s      mean    meanCI'
##       3'477     2'647     830       339         0  1'788.59  1'739.82
##                 76.1%   23.9%                0.0%            1'837.35
##                                                                      
##         .05       .10     .25    median       .75       .90       .95
##      414.60    570.60  990.00  1'500.00  2'300.00  3'200.00  4'000.00
##                                                                      
##       range        sd   vcoef       mad       IQR      skew      kurt
##   17'975.00  1'279.41    0.72    889.56  1'310.00      3.09     22.74
##                                                                      
## lowest : 25.0, 50.0 (3), 60.0, 62.0, 85.0
## highest: 9'500.0, 10'000.0 (2), 12'000.0, 15'000.0 (2), 18'000.0
## 
## heap(?): remarkable frequency (5.9%) for the mode(s) (= 2000)
## 
## ' 95%-CI (classic)

Größe der Gemeinde

  • 1 = bis 2k Einwohner

    2 = 2k bis 5k Einwohner

    3 = 5k bis 20k

    4 = 20k bis 50k

    5 = 50k bis 100k

    6 = 100k bis 500k

    7 = 500k und mehr

Desc(Albus$gkpol)
## ------------------------------------------------------------------------------ 
## Albus$gkpol (numeric)
## 
##   length      n    NAs  unique    0s  mean  meanCI'
##    3'477  3'404     73       7     0  3.98    3.91
##           97.9%   2.1%          0.0%          4.04
##                                                   
##      .05    .10    .25  median   .75   .90     .95
##     1.00   2.00   3.00    4.00  6.00  7.00    7.00
##                                                   
##    range     sd  vcoef     mad   IQR  skew    kurt
##     6.00   1.85   0.47    1.48  3.00  0.29   -1.04
##                                                   
## 
##    value  freq   perc  cumfreq  cumperc
## 1      1   275   8.1%      275     8.1%
## 2      2   432  12.7%      707    20.8%
## 3      3   989  29.1%    1'696    49.8%
## 4      4   552  16.2%    2'248    66.0%
## 5      5   219   6.4%    2'467    72.5%
## 6      6   432  12.7%    2'899    85.2%
## 7      7   505  14.8%    3'404   100.0%
## 
## ' 95%-CI (classic)

shapiro.test(Albus$gkpol)
## 
##  Shapiro-Wilk normality test
## 
## data:  Albus$gkpol
## W = 0.90931, p-value < 2.2e-16
table(Albus$gkpol)
## 
##   1   2   3   4   5   6   7 
## 275 432 989 552 219 432 505
Albus$Gemeindegröße_1 <- car::recode(Albus$gkpol,
                                   "1:2 = 1;
                                   3 = 2;
                                   4:5 = 3;
                                   6:7 = 4; else = NA")
gk <- as.factor(Albus$Gemeindegröße_1)
Albus$Gemeindegröße <- relevel(gk, ref = 4)

5.1 Deskripitive Statistik

#Kontrollvariablen
sumtable(Albus, vars = c('bildungDummy', 'LinksRechts', 'pol_intr', 'age', 'ostDummy',  'geschlecht', 'Gemeindegröße', 'ZufWirtschaft', 'di01a')
          ,summ = list(
           c('notNA(x)', 'mean(x)', 'median(x)', 'sd(x)', 'min(x)', 'max(x)', 'pctile(x)[25]',  'pctile(x)[75]')
         ),
 summ.names = list(
         c('N', 'Mean', 'Median', 'Standard Error', 'Minimum', 'Maximum', '1 Quantil', '4 Quantil')
         )
         ,title = "Deskriptive Statistik der Kontrollvariablen"
   ,labels = c("Bildung", "Links-Rechts Einschätzung", "Politisches Interesse", "Alter","Ost-Westdeutsche",  "Geschlecht", "Gemeindegröße", "Zufriedenheit mit Wirtschaftslage", "Einkommen"), file = 'Deskriptive Statistik Kontrolle')
Deskriptive Statistik der Kontrollvariablen
Variable N Mean Median Standard Error Minimum Maximum 1 Quantil 4 Quantil
Bildung 3454
… 1 1814 53%
… 2 713 21%
… 3 927 27%
Links-Rechts Einschätzung 3295
… 2 1566 48%
… 1 1186 36%
… 3 543 16%
Politisches Interesse 3475 2.3 2 0.94 0 4 2 3
Alter 3472 52 53 18 18 95 37 65
Ost-Westdeutsche 3477
… 0 2387 69%
… 1 1090 31%
Geschlecht 3477 0.49 0 0.5 0 1 0 1
Gemeindegröße 3404
… 4 937 28%
… 1 707 21%
… 2 989 29%
… 3 771 23%
Zufriedenheit mit Wirtschaftslage 3468 3.8 4 0.79 1 5 3 4
Einkommen 2647 1789 1500 1279 25 18000 990 2300
#Alle Variablen 
sumtable(Albus, vars = c('Migration_1', 'Umweltschutz', 'pn12_g', 'bildungDummy', 'LinksRechts', 'pol_intr', 'age', 'ostDummy',  'geschlecht', 'Gemeindegröße', 'ZufWirtschaft', 'di01a')
          ,summ = list(
           c('notNA(x)', 'mean(x)', 'median(x)', 'sd(x)', 'min(x)', 'max(x)', 'pctile(x)[25]',  'pctile(x)[75]')
         ),
 summ.names = list(
         c('N', 'Mean', 'Median', 'Standard Error', 'Minimum', 'Maximum', '1 Quantil', '4 Quantil')
         )
         ,title = "Deskriptive Statistik der Kontrollvariablen"
   ,labels = c("Einstellung gegenüber Migration", "Umweltschutz", "Heimatgefühl","Bildung", "Links-Rechts Einschätzung", "Politisches Interesse", "Alter","Ost-Westdeutsche",  "Geschlecht", "Gemeindegröße", "Zufriedenheit mit Wirtschaftslage", "Einkommen"), file = 'Deskriptive Statistik Alle')
Deskriptive Statistik der Kontrollvariablen
Variable N Mean Median Standard Error Minimum Maximum 1 Quantil 4 Quantil
Einstellung gegenüber Migration 3477 3.4 3.5 0.83 1 5 2.8 4
Umweltschutz 3450 4.3 5 0.95 1 5 4 5
Heimatgefühl 3460
… 1 827 24%
… 2 1567 45%
… 3 933 27%
… 4 133 4%
Bildung 3454
… 1 1814 53%
… 2 713 21%
… 3 927 27%
Links-Rechts Einschätzung 3295
… 2 1566 48%
… 1 1186 36%
… 3 543 16%
Politisches Interesse 3475 2.3 2 0.94 0 4 2 3
Alter 3472 52 53 18 18 95 37 65
Ost-Westdeutsche 3477
… 0 2387 69%
… 1 1090 31%
Geschlecht 3477 0.49 0 0.5 0 1 0 1
Gemeindegröße 3404
… 4 937 28%
… 1 707 21%
… 2 989 29%
… 3 771 23%
Zufriedenheit mit Wirtschaftslage 3468 3.8 4 0.79 1 5 3 4
Einkommen 2647 1789 1500 1279 25 18000 990 2300

6. Regression

6.1 Migration

m1 <- lm(Migration ~ Heimat_1, data = Albus)
m1.1 <- lm(Migration ~ Heimat_2, data = Albus)
m1.2 <- lm(Migration ~ Heimat_3, data = Albus)

tab_model(m1, m1.1, m1.2, p.style = "stars")
  Migration Migration Migration
Predictors Estimates CI Estimates CI Estimates CI
(Intercept) 2.29 *** 2.26 – 2.32 2.28 *** 2.20 – 2.35 2.28 *** 2.20 – 2.35
Heimat 1 [1] -0.02 -0.06 – 0.02
Heimat 1 [2] -0.03 -0.06 – 0.01
Heimat 2 [1] -0.00 -0.09 – 0.08
Heimat 2 [2] -0.01 -0.09 – 0.07
Heimat 2 [3] 0.02 -0.06 – 0.10
Heimat 3 -0.00 -0.08 – 0.08
Observations 3460 3460 3460
R2 / R2 adjusted 0.001 / 0.000 0.001 / -0.000 0.000 / -0.000
  • p<0.05   ** p<0.01   *** p<0.001
#Mit Kontrollvariablen 1 #Probier hier mal rum mit Heimat_1 , 2, 3 ob sich was ändert bei dir
m1.3 <- lm(Migration_1 ~ Heimat_2 + geschlecht + bildungDummy + ostDummy +Einkommen_zentriert + Alter_zentriert + Gemeindegröße + pol_intr + ZufWirtschaft + LinksRechts + LinksRechts:Heimat_2, data = Albus)
tab_model(m1.3, p.style = "stars")#,
  Migration_1
Predictors Estimates CI
(Intercept) 2.42 *** 2.16 – 2.68
Heimat 2 [1] 0.23 * 0.01 – 0.45
Heimat 2 [2] 0.23 * 0.02 – 0.44
Heimat 2 [3] 0.16 -0.06 – 0.38
geschlecht 0.11 *** 0.05 – 0.17
bildungDummy [2] 0.09 * 0.02 – 0.17
bildungDummy [3] 0.36 *** 0.28 – 0.43
ostDummy [1] -0.21 *** -0.27 – -0.15
Einkommen zentriert 0.00 *** 0.00 – 0.00
Alter zentriert -0.01 *** -0.01 – -0.01
Gemeindegröße [1] -0.29 *** -0.37 – -0.21
Gemeindegröße [2] -0.15 *** -0.22 – -0.07
Gemeindegröße [3] -0.11 ** -0.19 – -0.03
pol intr 0.07 *** 0.04 – 0.10
ZufWirtschaft 0.16 *** 0.12 – 0.19
LinksRechts [1] 0.77 *** 0.45 – 1.09
LinksRechts [3] -0.13 -0.48 – 0.23
Heimat 2 [1] ×
LinksRechts [1]
-0.47 ** -0.82 – -0.13
Heimat 2 [2] ×
LinksRechts [1]
-0.50 ** -0.83 – -0.16
Heimat 2 [3] ×
LinksRechts [1]
-0.48 ** -0.83 – -0.14
Heimat 2 [1] ×
LinksRechts [3]
-0.32 -0.71 – 0.07
Heimat 2 [2] ×
LinksRechts [3]
-0.24 -0.61 – 0.14
Heimat 2 [3] ×
LinksRechts [3]
-0.22 -0.60 – 0.17
Observations 2468
R2 / R2 adjusted 0.315 / 0.309
  • p<0.05   ** p<0.01   *** p<0.001
          #file = "Regression_Migration_Kontroll1.html")
plot_model(m1.3)

#Mit Kontrollvariablen 2
m1.3.1 <- lm(Migration_1 ~ Heimat_2 + bildungDummy + ostDummy + LinksRechts + polintr_dummy + Alter_zentriert + geschlecht_f + Einkommen_zentriert + Gemeindegröße  + LinksRechts:Heimat_2, data = Albus)

tab_model( m1.3.1, p.style = "stars")#,
  Migration_1
Predictors Estimates CI
(Intercept) 3.28 *** 3.07 – 3.50
Heimat 2 [1] 0.18 -0.04 – 0.41
Heimat 2 [2] 0.18 -0.03 – 0.40
Heimat 2 [3] 0.09 -0.12 – 0.31
bildungDummy [2] 0.12 ** 0.05 – 0.19
bildungDummy [3] 0.41 *** 0.33 – 0.48
ostDummy [1] -0.22 *** -0.28 – -0.16
LinksRechts [1] 0.70 *** 0.38 – 1.03
LinksRechts [3] -0.19 -0.55 – 0.16
polintr dummy [1] 0.12 *** 0.06 – 0.18
polintr dummy [2] -0.13 ** -0.22 – -0.04
Alter zentriert -0.01 *** -0.01 – -0.01
geschlecht f -0.08 ** -0.14 – -0.02
Einkommen zentriert 0.00 *** 0.00 – 0.00
Gemeindegröße [1] -0.29 *** -0.38 – -0.21
Gemeindegröße [2] -0.14 *** -0.22 – -0.07
Gemeindegröße [3] -0.13 ** -0.21 – -0.05
Heimat 2 [1] ×
LinksRechts [1]
-0.39 * -0.74 – -0.05
Heimat 2 [2] ×
LinksRechts [1]
-0.42 * -0.75 – -0.08
Heimat 2 [3] ×
LinksRechts [1]
-0.41 * -0.75 – -0.06
Heimat 2 [1] ×
LinksRechts [3]
-0.25 -0.65 – 0.14
Heimat 2 [2] ×
LinksRechts [3]
-0.18 -0.56 – 0.20
Heimat 2 [3] ×
LinksRechts [3]
-0.15 -0.53 – 0.24
Observations 2473
R2 / R2 adjusted 0.297 / 0.290
  • p<0.05   ** p<0.01   *** p<0.001
          #file = "Regression_Migration_Kontroll2.html")

6.2 Umweltschutz

m2 <- lm(Umweltschutz ~ Heimat_1, data = Albus)
m2.1 <- lm(Umweltschutz ~ Heimat_2, data = Albus)
m2.2 <- lm(Umweltschutz ~ Heimat_3, data = Albus)

tab_model(m2, m2.1, m2.2, p.style = "stars")
  Umweltschutz Umweltschutz Umweltschutz
Predictors Estimates CI Estimates CI Estimates CI
(Intercept) 4.28 *** 4.22 – 4.34 4.39 *** 4.23 – 4.56 4.39 *** 4.23 – 4.56
Heimat 1 [1] -0.02 -0.11 – 0.07
Heimat 1 [2] -0.03 -0.11 – 0.04
Heimat 2 [1] -0.14 -0.31 – 0.04
Heimat 2 [2] -0.15 -0.32 – 0.02
Heimat 2 [3] -0.13 -0.31 – 0.04
Heimat 3 -0.14 -0.31 – 0.03
Observations 3434 3434 3434
R2 / R2 adjusted 0.000 / -0.000 0.001 / -0.000 0.001 / 0.000
  • p<0.05   ** p<0.01   *** p<0.001
#Mit Kontrollvariablen 1 
m2.3 <- glm(Umweltschutz ~ Heimat_2 + geschlecht + bildungDummy + ostDummy +Einkommen_zentriert + Alter_zentriert + Gemeindegröße + pol_intr + ZufWirtschaft + LinksRechts + LinksRechts:Heimat_2, data = Albus, family = "poisson")
summary(m2.3)
## 
## Call:
## glm(formula = Umweltschutz ~ Heimat_2 + geschlecht + bildungDummy + 
##     ostDummy + Einkommen_zentriert + Alter_zentriert + Gemeindegröße + 
##     pol_intr + ZufWirtschaft + LinksRechts + LinksRechts:Heimat_2, 
##     family = "poisson", data = Albus)
## 
## Coefficients:
##                          Estimate Std. Error z value Pr(>|z|)    
## (Intercept)             1.404e+00  9.312e-02  15.072  < 2e-16 ***
## Heimat_21               3.873e-02  7.938e-02   0.488  0.62560    
## Heimat_22               1.393e-02  7.676e-02   0.181  0.85603    
## Heimat_23              -1.072e-03  7.868e-02  -0.014  0.98913    
## geschlecht              5.939e-02  2.141e-02   2.774  0.00554 ** 
## bildungDummy2          -1.677e-02  2.629e-02  -0.638  0.52365    
## bildungDummy3          -5.581e-03  2.677e-02  -0.208  0.83485    
## ostDummy1              -2.341e-02  2.193e-02  -1.067  0.28593    
## Einkommen_zentriert    -9.442e-06  8.994e-06  -1.050  0.29380    
## Alter_zentriert        -4.674e-04  5.893e-04  -0.793  0.42776    
## Gemeindegröße1         -4.191e-02  2.923e-02  -1.434  0.15160    
## Gemeindegröße2         -1.831e-02  2.623e-02  -0.698  0.48503    
## Gemeindegröße3         -1.647e-02  2.812e-02  -0.586  0.55806    
## pol_intr                4.075e-03  1.201e-02   0.339  0.73427    
## ZufWirtschaft           3.569e-03  1.341e-02   0.266  0.79014    
## LinksRechts1            1.137e-01  1.115e-01   1.020  0.30775    
## LinksRechts3            4.357e-02  1.265e-01   0.345  0.73042    
## Heimat_21:LinksRechts1 -1.026e-01  1.200e-01  -0.854  0.39287    
## Heimat_22:LinksRechts1 -7.542e-02  1.159e-01  -0.651  0.51509    
## Heimat_23:LinksRechts1 -3.001e-02  1.191e-01  -0.252  0.80105    
## Heimat_21:LinksRechts3 -1.189e-01  1.385e-01  -0.858  0.39079    
## Heimat_22:LinksRechts3 -8.471e-02  1.341e-01  -0.631  0.52772    
## Heimat_23:LinksRechts3 -4.200e-02  1.372e-01  -0.306  0.75957    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 587.50  on 2457  degrees of freedom
## Residual deviance: 555.44  on 2435  degrees of freedom
##   (1019 observations deleted due to missingness)
## AIC: 8708.5
## 
## Number of Fisher Scoring iterations: 4
tab_model(m2.3, p.style = "stars")#,
  Umweltschutz
Predictors Incidence Rate Ratios CI
(Intercept) 4.07 *** 3.38 – 4.87
Heimat 2 [1] 1.04 0.89 – 1.22
Heimat 2 [2] 1.01 0.88 – 1.18
Heimat 2 [3] 1.00 0.86 – 1.17
geschlecht 1.06 ** 1.02 – 1.11
bildungDummy [2] 0.98 0.93 – 1.04
bildungDummy [3] 0.99 0.94 – 1.05
ostDummy [1] 0.98 0.94 – 1.02
Einkommen zentriert 1.00 1.00 – 1.00
Alter zentriert 1.00 1.00 – 1.00
Gemeindegröße [1] 0.96 0.91 – 1.02
Gemeindegröße [2] 0.98 0.93 – 1.03
Gemeindegröße [3] 0.98 0.93 – 1.04
pol intr 1.00 0.98 – 1.03
ZufWirtschaft 1.00 0.98 – 1.03
LinksRechts [1] 1.12 0.90 – 1.39
LinksRechts [3] 1.04 0.81 – 1.33
Heimat 2 [1] ×
LinksRechts [1]
0.90 0.71 – 1.14
Heimat 2 [2] ×
LinksRechts [1]
0.93 0.74 – 1.17
Heimat 2 [3] ×
LinksRechts [1]
0.97 0.77 – 1.23
Heimat 2 [1] ×
LinksRechts [3]
0.89 0.68 – 1.17
Heimat 2 [2] ×
LinksRechts [3]
0.92 0.71 – 1.20
Heimat 2 [3] ×
LinksRechts [3]
0.96 0.73 – 1.26
Observations 2458
R2 Nagelkerke 0.061
  • p<0.05   ** p<0.01   *** p<0.001
          #file = "Regression_Umweltschutz_Kontroll1.html")
#Robuste Standardfehler 
cov.m1 <- vcovHC(m2.3, type="HC0")
std.err <- sqrt(diag(cov.m1))
r.est <- cbind(Estimate= coef(m2.3), "Robust SE" = std.err,
"Pr(>|z|)" = 2 * pnorm(abs(coef(m2.3)/std.err), lower.tail=FALSE),
LL = coef(m2.3) - 1.96 * std.err,
UL = coef(m2.3) + 1.96 * std.err)

r.est
##                             Estimate    Robust SE      Pr(>|z|)            LL
## (Intercept)             1.403528e+00 5.335116e-02 1.580118e-152  1.298959e+00
## Heimat_21               3.873336e-02 4.651891e-02  4.050496e-01 -5.244371e-02
## Heimat_22               1.392739e-02 4.562215e-02  7.601552e-01 -7.549201e-02
## Heimat_23              -1.071665e-03 4.680408e-02  9.817326e-01 -9.280767e-02
## geschlecht              5.939280e-02 9.413918e-03  2.807691e-10  4.094152e-02
## bildungDummy2          -1.676840e-02 1.153761e-02  1.461215e-01 -3.938211e-02
## bildungDummy3          -5.580619e-03 1.215856e-02  6.462436e-01 -2.941139e-02
## ostDummy1              -2.340536e-02 9.986938e-03  1.909877e-02 -4.297976e-02
## Einkommen_zentriert    -9.441814e-06 3.628491e-06  9.264601e-03 -1.655366e-05
## Alter_zentriert        -4.673631e-04 2.555529e-04  6.742493e-02 -9.682469e-04
## Gemeindegröße1         -4.191101e-02 1.284347e-02  1.101557e-03 -6.708422e-02
## Gemeindegröße2         -1.831242e-02 1.124496e-02  1.034188e-01 -4.035253e-02
## Gemeindegröße3         -1.647194e-02 1.219100e-02  1.766457e-01 -4.036630e-02
## pol_intr                4.075406e-03 5.351903e-03  4.463661e-01 -6.414324e-03
## ZufWirtschaft           3.569148e-03 6.024747e-03  5.535730e-01 -8.239356e-03
## LinksRechts1            1.137311e-01 4.765696e-02  1.701175e-02  2.032348e-02
## LinksRechts3            4.357245e-02 6.765845e-02  5.195715e-01 -8.903811e-02
## Heimat_21:LinksRechts1 -1.025552e-01 5.129482e-02  4.557280e-02 -2.030931e-01
## Heimat_22:LinksRechts1 -7.542428e-02 4.947554e-02  1.273898e-01 -1.723963e-01
## Heimat_23:LinksRechts1 -3.001458e-02 5.070635e-02  5.538979e-01 -1.293990e-01
## Heimat_21:LinksRechts3 -1.188514e-01 7.372172e-02  1.069266e-01 -2.633459e-01
## Heimat_22:LinksRechts3 -8.470545e-02 7.086872e-02  2.319915e-01 -2.236081e-01
## Heimat_23:LinksRechts3 -4.200217e-02 7.266152e-02  5.632287e-01 -1.844188e-01
##                                   UL
## (Intercept)             1.508096e+00
## Heimat_21               1.299104e-01
## Heimat_22               1.033468e-01
## Heimat_23               9.066434e-02
## geschlecht              7.784407e-02
## bildungDummy2           5.845317e-03
## bildungDummy3           1.825015e-02
## ostDummy1              -3.830964e-03
## Einkommen_zentriert    -2.329972e-06
## Alter_zentriert         3.352062e-05
## Gemeindegröße1         -1.673781e-02
## Gemeindegröße2          3.727697e-03
## Gemeindegröße3          7.422425e-03
## pol_intr                1.456514e-02
## ZufWirtschaft           1.537765e-02
## LinksRechts1            2.071388e-01
## LinksRechts3            1.761830e-01
## Heimat_21:LinksRechts1 -2.017358e-03
## Heimat_22:LinksRechts1  2.154778e-02
## Heimat_23:LinksRechts1  6.936986e-02
## Heimat_21:LinksRechts3  2.564318e-02
## Heimat_22:LinksRechts3  5.419723e-02
## Heimat_23:LinksRechts3  1.004144e-01
#Mit Kontrollvariablen 2
m2.3.1 <- lm(Umweltschutz ~ Heimat_2 + bildungDummy + LinksRechts + polintr_dummy  + Alter_zentriert + geschlecht_f + Einkommen_zentriert + Gemeindegröße + LinksRechts:Heimat_2, data = Albus)

tab_model(m2.3.1, p.style = "stars")#,
  Umweltschutz
Predictors Estimates CI
(Intercept) 4.35 *** 4.08 – 4.63
Heimat 2 [1] 0.16 -0.13 – 0.44
Heimat 2 [2] 0.06 -0.22 – 0.33
Heimat 2 [3] -0.00 -0.28 – 0.28
bildungDummy [2] -0.07 -0.16 – 0.03
bildungDummy [3] -0.03 -0.13 – 0.06
LinksRechts [1] 0.50 * 0.09 – 0.92
LinksRechts [3] 0.18 -0.28 – 0.64
polintr dummy [1] 0.10 * 0.02 – 0.18
polintr dummy [2] 0.08 -0.04 – 0.19
Alter zentriert -0.00 * -0.00 – -0.00
geschlecht f -0.26 *** -0.34 – -0.19
Einkommen zentriert -0.00 -0.00 – 0.00
Gemeindegröße [1] -0.19 *** -0.29 – -0.08
Gemeindegröße [2] -0.07 -0.17 – 0.03
Gemeindegröße [3] -0.06 -0.17 – 0.04
Heimat 2 [1] ×
LinksRechts [1]
-0.46 * -0.91 – -0.01
Heimat 2 [2] ×
LinksRechts [1]
-0.35 -0.78 – 0.09
Heimat 2 [3] ×
LinksRechts [1]
-0.14 -0.59 – 0.31
Heimat 2 [1] ×
LinksRechts [3]
-0.49 -1.00 – 0.02
Heimat 2 [2] ×
LinksRechts [3]
-0.35 -0.85 – 0.14
Heimat 2 [3] ×
LinksRechts [3]
-0.18 -0.68 – 0.32
Observations 2463
R2 / R2 adjusted 0.063 / 0.055
  • p<0.05   ** p<0.01   *** p<0.001
          #file = "Regression_Umweltschutz_Kontroll2.html")

6.3 Tabellen und Robustheitstests

Robustheitstest 1

#Migration
#Mit Deutschland 
m1.1.1 <- lm(Migration ~ Heimat_1.1, data = Albus)
m1.1.2 <- lm(Migration_1 ~ Heimat_2.1, data = Albus)
m1.1.3 <- lm(Migration ~ Heimat_3.1, data = Albus)

tab_model(m1.1.1, m1.1.2, m1.1.3, p.style = "stars")
  Migration Migration_1 Migration
Predictors Estimates CI Estimates CI Estimates CI
(Intercept) 2.35 *** 2.31 – 2.38 3.15 *** 2.91 – 3.40 2.40 *** 2.27 – 2.54
Heimat 1 1 [1] -0.08 ** -0.13 – -0.03
Heimat 1 1 [2] -0.09 *** -0.13 – -0.05
Heimat 2 1 [1] 0.22 -0.03 – 0.48
Heimat 2 1 [2] 0.30 * 0.05 – 0.55
Heimat 2 1 [3] 0.18 -0.07 – 0.44
Heimat 3 1 -0.13 -0.27 – 0.00
Observations 3440 3440 3440
R2 / R2 adjusted 0.005 / 0.005 0.005 / 0.004 0.001 / 0.001
  • p<0.05   ** p<0.01   *** p<0.001
#Mit EU 
m1.1.4 <- lm(Migration ~ Heimat_1.2, data = Albus)
m1.1.5 <- lm(Migration_1 ~ Heimat_2.2, data = Albus)
m1.1.6 <- lm(Migration ~ Heimat_3.1, data = Albus)

tab_model(m1.1.4, m1.1.5, m1.1.6, p.style = "stars")
  Migration Migration_1 Migration
Predictors Estimates CI Estimates CI Estimates CI
(Intercept) 2.34 *** 2.32 – 2.36 3.15 *** 2.91 – 3.40 2.40 *** 2.27 – 2.54
Heimat 1 2 [1] -0.14 *** -0.19 – -0.08
Heimat 1 2 [2] -0.13 *** -0.16 – -0.10
Heimat 2 2 [1] 0.22 -0.03 – 0.48
Heimat 2 2 [2] 0.30 * 0.05 – 0.55
Heimat 2 2 [3] 0.18 -0.07 – 0.44
Heimat 3 1 -0.13 -0.27 – 0.00
Observations 3391 3440 3440
R2 / R2 adjusted 0.022 / 0.021 0.005 / 0.004 0.001 / 0.001
  • p<0.05   ** p<0.01   *** p<0.001
#Umweltschutz
#Mit Deutschland 
m2.1.1 <- lm(Umweltschutz ~ Heimat_1.1, data = Albus)
m2.1.2 <- lm(Umweltschutz ~ Heimat_2.1, data = Albus)
m2.1.3 <- lm(Umweltschutz ~ Heimat_3.1, data = Albus)

tab_model(m2.1.1, m2.1.2, m2.1.3, p.style = "stars")
  Umweltschutz Umweltschutz Umweltschutz
Predictors Estimates CI Estimates CI Estimates CI
(Intercept) 4.26 *** 4.18 – 4.34 4.14 *** 3.85 – 4.43 4.14 *** 3.85 – 4.43
Heimat 1 1 [1] -0.03 -0.13 – 0.07
Heimat 1 1 [2] 0.01 -0.08 – 0.10
Heimat 2 1 [1] 0.09 -0.21 – 0.38
Heimat 2 1 [2] 0.13 -0.16 – 0.42
Heimat 2 1 [3] 0.13 -0.17 – 0.43
Heimat 3 1 0.12 -0.17 – 0.41
Observations 3415 3415 3415
R2 / R2 adjusted 0.000 / -0.000 0.000 / -0.000 0.000 / -0.000
  • p<0.05   ** p<0.01   *** p<0.001
#Mit EU 
m2.1.4 <- lm(Umweltschutz ~ Heimat_1.2, data = Albus)
m2.1.5 <- lm(Umweltschutz ~ Heimat_2.2, data = Albus)
m2.1.6 <- lm(Umweltschutz ~ Heimat_3.1, data = Albus)

tab_model(m2.1.4, m2.1.5, m2.1.6, p.style = "stars")
  Umweltschutz Umweltschutz Umweltschutz
Predictors Estimates CI Estimates CI Estimates CI
(Intercept) 4.19 *** 4.14 – 4.24 4.14 *** 3.85 – 4.43 4.14 *** 3.85 – 4.43
Heimat 1 2 [1] 0.24 *** 0.12 – 0.35
Heimat 1 2 [2] 0.11 ** 0.04 – 0.18
Heimat 2 2 [1] 0.09 -0.21 – 0.38
Heimat 2 2 [2] 0.13 -0.16 – 0.42
Heimat 2 2 [3] 0.13 -0.17 – 0.43
Heimat 3 1 0.12 -0.17 – 0.41
Observations 3368 3415 3415
R2 / R2 adjusted 0.006 / 0.006 0.000 / -0.000 0.000 / -0.000
  • p<0.05   ** p<0.01   *** p<0.001

Robustheitstest 2

#model_dashboard(m1.3)
a3 <- check_collinearity(m1.3)
plot(a3)

#model_dashboard(m2.3)
b3 <- check_collinearity(m2.3)
plot(b3)

Tabellen

#Migration
tab_model(m1.3,
          show.aic = T,
          show.dev = T,
          show.se = T,
          p.style = "stars",
          title = "Effekt Heimatgefühl auf Einstellung gegenüber Migranten",
          dv.labels = "Einstellung gegenüber Migranten",
          pred.labels = c("Intercept", "Heimatgefühl[Stark]", "Heimatgefühl[Mittel]", "Heimatgefühl[Schwach]", "Geschlecht[Mann = Referenz]", "Mittlere Bildung[Niedrig = Referenz]", "Hohe Bildung", "Ostdeutschland[Westen = Referenz]", "Einkommen[Mittelwertszentriert]", "Alter[Mittelwertszentriert]", "Landgemeinde[1k-5k]", "Kleinstadt[5k-20k]","Mittelstadt[20k-100k]", "Pol. Interesse", "Zufriedenheit mit Wirtschaftslage", "Links[Mitte = Referenz]", "Rechts", "Heimat[Stark] x Links", "Heimat[Mittel] x Links", "Heimat[Schwach] x Links", "Heimat[Stark] x Rechts", "Heimat[Mittel] x Rechts", "Heimat[Schwach] x Rechts"), file = "Regression_Migration.html")
Effekt Heimatgefühl auf Einstellung gegenüber Migranten
  Einstellung gegenüber Migranten
Predictors Estimates std. Error CI
Intercept 2.42 *** 0.13 2.16 – 2.68
Heimatgefühl[Stark] 0.23 * 0.11 0.01 – 0.45
Heimatgefühl[Mittel] 0.23 * 0.11 0.02 – 0.44
Heimatgefühl[Schwach] 0.16 0.11 -0.06 – 0.38
Geschlecht[Mann = Referenz] 0.11 *** 0.03 0.05 – 0.17
Mittlere Bildung[Niedrig = Referenz] 0.09 * 0.04 0.02 – 0.17
Hohe Bildung 0.36 *** 0.04 0.28 – 0.43
Ostdeutschland[Westen = Referenz] -0.21 *** 0.03 -0.27 – -0.15
Einkommen[Mittelwertszentriert] 0.00 *** 0.00 0.00 – 0.00
Alter[Mittelwertszentriert] -0.01 *** 0.00 -0.01 – -0.01
Landgemeinde[1k-5k] -0.29 *** 0.04 -0.37 – -0.21
Kleinstadt[5k-20k] -0.15 *** 0.04 -0.22 – -0.07
Mittelstadt[20k-100k] -0.11 ** 0.04 -0.19 – -0.03
Pol. Interesse 0.07 *** 0.02 0.04 – 0.10
Zufriedenheit mit Wirtschaftslage 0.16 *** 0.02 0.12 – 0.19
Links[Mitte = Referenz] 0.77 *** 0.16 0.45 – 1.09
Rechts -0.13 0.18 -0.48 – 0.23
Heimat[Stark] x Links -0.47 ** 0.18 -0.82 – -0.13
Heimat[Mittel] x Links -0.50 ** 0.17 -0.83 – -0.16
Heimat[Schwach] x Links -0.48 ** 0.18 -0.83 – -0.14
Heimat[Stark] x Rechts -0.32 0.20 -0.71 – 0.07
Heimat[Mittel] x Rechts -0.24 0.19 -0.61 – 0.14
Heimat[Schwach] x Rechts -0.22 0.20 -0.60 – 0.17
Observations 2468
R2 / R2 adjusted 0.315 / 0.309
Deviance 1175.629
AIC 5221.600
  • p<0.05   ** p<0.01   *** p<0.001
#Umweltschutz
tab_model(m2.3,
          show.aic = T,
          show.dev = T,
          show.se = T,
          p.style = "stars",
          title = "Effekt Heimatgefühl auf das Umweltschutz",
          dv.labels = "Umweltschutz",
          pred.labels = c("Intercept", "Heimatgefühl[Stark]", "Heimatgefühl[Mittel]", "Heimatgefühl[Schwach]", "Geschlecht[Mann = Referenz]", "Mittlere Bildung[Niedrig = Referenz]", "Hohe Bildung", "Ostdeutschland[Westen = Referenz]", "Einkommen[Mittelwertszentriert]", "Alter[Mittelwertszentriert]", "Landgemeinde[1k-5k]", "Kleinstadt[5k-20k]","Mittelstadt[20k-100k]", "Pol. Interesse", "Zufriedenheit mit Wirtschaftslage", "Links[Mitte = Referenz]", "Rechts", "Heimat[Stark] x Links", "Heimat[Mittel] x Links", "Heimat[Schwach] x Links", "Heimat[Stark] x Rechts", "Heimat[Mittel] x Rechts", "Heimat[Schwach] x Rechts"), file = "Regression_Umweltschutz.html")
Effekt Heimatgefühl auf das Umweltschutz
  Umweltschutz
Predictors Incidence Rate Ratios std. Error CI
Intercept 4.07 *** 0.38 3.38 – 4.87
Heimatgefühl[Stark] 1.04 0.08 0.89 – 1.22
Heimatgefühl[Mittel] 1.01 0.08 0.88 – 1.18
Heimatgefühl[Schwach] 1.00 0.08 0.86 – 1.17
Geschlecht[Mann = Referenz] 1.06 ** 0.02 1.02 – 1.11
Mittlere Bildung[Niedrig = Referenz] 0.98 0.03 0.93 – 1.04
Hohe Bildung 0.99 0.03 0.94 – 1.05
Ostdeutschland[Westen = Referenz] 0.98 0.02 0.94 – 1.02
Einkommen[Mittelwertszentriert] 1.00 0.00 1.00 – 1.00
Alter[Mittelwertszentriert] 1.00 0.00 1.00 – 1.00
Landgemeinde[1k-5k] 0.96 0.03 0.91 – 1.02
Kleinstadt[5k-20k] 0.98 0.03 0.93 – 1.03
Mittelstadt[20k-100k] 0.98 0.03 0.93 – 1.04
Pol. Interesse 1.00 0.01 0.98 – 1.03
Zufriedenheit mit Wirtschaftslage 1.00 0.01 0.98 – 1.03
Links[Mitte = Referenz] 1.12 0.12 0.90 – 1.39
Rechts 1.04 0.13 0.81 – 1.33
Heimat[Stark] x Links 0.90 0.11 0.71 – 1.14
Heimat[Mittel] x Links 0.93 0.11 0.74 – 1.17
Heimat[Schwach] x Links 0.97 0.12 0.77 – 1.23
Heimat[Stark] x Rechts 0.89 0.12 0.68 – 1.17
Heimat[Mittel] x Rechts 0.92 0.12 0.71 – 1.20
Heimat[Schwach] x Rechts 0.96 0.13 0.73 – 1.26
Observations 2458
R2 Nagelkerke 0.061
Deviance 555.443
AIC 8708.478
  • p<0.05   ** p<0.01   *** p<0.001