For this section we will use the same model as for the multivariate regression analysis. Our dependent variable is attitudes towards immigration immi.jobs.

library(sjlabelled)
EVS <- read_stata("ZA7500_v2-0-0.dta")

Our next step is to keep only the variables we are interesting in:

Since we are only interested in Germany we should exclude all other countries from the analysis:

library(dplyr)
EVS.Germany<-EVS %>% filter(country == 276)
table(EVS.Germany$country) ## ## 276 ## 5407 Let’s exclude the missing cases: EVS.Germany[EVS.Germany <=-1] <- NA EVS.Germany[EVS.Germany <=-2] <- NA Our next step is to give meaningful names to our variables while we are arrange the order of the values (if and when necessary): EVS.Germany<-EVS.Germany %>% mutate(immi.jobs=(max(v185,na.rm=TRUE)-(v185))) EVS.Germany<-EVS.Germany %>% mutate(born.country=(max(v189,na.rm=TRUE)-(v189))) EVS.Germany<-EVS.Germany %>% mutate(respect.inst=(max(v190,na.rm=TRUE)-(v190))) EVS.Germany<-EVS.Germany %>% mutate(country.ancestry=(max(v191,na.rm=TRUE)-(v191))) EVS.Germany<-EVS.Germany %>% mutate(speak.lang=(max(v192,na.rm=TRUE)-(v192))) EVS.Germany<-EVS.Germany %>% mutate(share.cultr=(max(v193,na.rm=TRUE)-(v193))) EVS.Germany<-EVS.Germany %>% rename(education=v243_edulvlb) EVS.Germany<-EVS.Germany %>% rename(left_right=v102) EVS.Germany<-EVS.Germany %>% rename(region=v275c_N1) Next step is to create the variable measuring whether the respondent lived in Eastern or Western Germany. You may consult the Codebook to identify the 5 regions that used to belong to Eastern Germany. table(EVS.Germany$region)
##
## 27601 27602 27603 27604 27605 27606 27607 27608 27609 27610 27611 27612 27613
##   682   908   223   184    35    84   428   133   545  1079   262    60   320
## 27614 27615 27616
##   139   176   149
EVS.Germany$east_west <- NA EVS.Germany$east_west[EVS.Germany$region==27604] <- 1 EVS.Germany$east_west[EVS.Germany$region==27608] <- 1 EVS.Germany$east_west[EVS.Germany$region==27613] <- 1 EVS.Germany$east_west[EVS.Germany$region==27614] <- 1 EVS.Germany$east_west[EVS.Germany$region==27616] <- 1 EVS.Germany$east_west[EVS.Germany$region==27603] <- 0 EVS.Germany$east_west[EVS.Germany$region==27607] <- 0 EVS.Germany$east_west[EVS.Germany$region==27609] <- 0 EVS.Germany$east_west[EVS.Germany$region==27610] <- 0 EVS.Germany$east_west[EVS.Germany$region==27611] <- 0 EVS.Germany$east_west[EVS.Germany$region==27612] <- 0 EVS.Germany$east_west[EVS.Germany$region==27615] <- 0 table(EVS.Germany$east_west)
##
##    0    1
## 2773  925