Data Analysis and Visualization
Community Data: MLM

Author

Gagan Atreya

Published

August 18, 2023

Section 1. Demographics

Demographic variables in the analysis:

  • Age
  • Gender
  • Socio-economic status
  • Nature of employment
  • Religious affiliation
  • Marital status
  • Ethnicity
Display code
options(digits = 2)
rm(list=ls())

## Install "pacman" package if not installed
# (remove the # symbol from the line below):
# install.packages("pacman")

## Load R packages:
pacman::p_load(data.table, tidyverse, haven, labelled, vtable, 
               psych, scales, weights, clipr, forcats,
               stargazer, ggthemes, ggcharts, geomtextpath,
               corrplot, tm, readxl, patchwork, modelsummary,
               gt, lme4, car, lmerTest, 
               ggeffects, magrittr, broom, broom.mixed,
               backports, effects, interactions, plyr, sjPlot)


## Import datasets:
## These are newer datasets with new variables created in the individual analyses:
dsgmb <- fread("/home/gagan/Desktop/oxford/data/cleanedds/dsgmb.csv")
dsgmb$Country <- "Gambia"
dsgmb$id <- 1:nrow(dsgmb)
dsgmb$ID <- paste0("GMB",dsgmb$id)

dspak <- fread("/home/gagan/Desktop/oxford/data/cleanedds/dspak.csv")
dspak$Country <- "Pakistan"
dspak$id <- 1:nrow(dspak)
dspak$ID <- paste0("PAK",dspak$id)

dstza <- fread("/home/gagan/Desktop/oxford/data/cleanedds/dstza.csv")
dstza$Country <- "Tanzania"
dstza$id <- 1:nrow(dstza)
dstza$ID <- paste0("TZA",dstza$id)

dsuga <- fread("/home/gagan/Desktop/oxford/data/cleanedds/dsuga.csv")
dsuga$Country <- "Uganda"
dsuga$id <- 1:nrow(dsuga)
dsuga$ID <- paste0("UGA",dsuga$id)

## Correct asterisk pattern for stargazer tables:
starpattern <- "<em>&#42;p&lt;0.05;&nbsp;&#42;&#42;p&lt;0.01;&nbsp;&#42;&#42;&#42;p&lt;0.001</em>"

## List of variables to retain from all datasets:
list1 <- c("ID", "Country", "age", "gender", 
           "ses", "jobnature", "religion", "married",
           "IGF01", "IGF02", "IGF03", "IGI01", "IGI02", "IGI03", 
           "OGF01", "OGF02", "OGF03", "OGI01", "OGI02", "OGI03",
           "ENDBCL01", "ENDBCL02", "ENDBCL03", "ENDBBL01", "ENDBBL02", "ENDBBL03",
           "EXPBCL01", "EXPBCL02", "EXPBCL03", "EXPBBL01", "EXPBBL02", "EXPBBL03", 
           "empathic_concern_01", "empathic_concern_02", "empathic_concern_03",
           "perspective_taking_01", "perspective_taking_02", 
           "perspective_taking_03", "perspective_taking_04", "history_discrimination",
           "og_hostility", "og_cooperation", "fight_outgroup", "imagistic",
           "event_positive_affect", "event_negative_affect", "event_episodic_recall",
           "event_shared_perception", "event_event_reflection", 
           "event_transformative_indiv", "event_transformative_group",
           "freq_positive_contact", "freq_negative_contact", 
           "sprf", "exp_religious_freedom")

## Subset datasets to only the columns in the above list:
dsgmb1 <- dsgmb[, ..list1]
dspak1 <- dspak[, ..list1]
dstza1 <- dstza[, ..list1]
dsuga1 <- dsuga[, ..list1]

## Merged dataset with needed columns only
ds <- rbind(dsgmb1, dspak1, dstza1, dsuga1)

## Rename the "Event_" columns with title case:
ds01 <- ds[, 1:44]
ds02 <- ds[, !(2:44)]
colnames(ds02) <- stringr::str_to_title(colnames(ds02))
ds02$ID <- ds02$Id
ds02 <- ds02[, !1]
ds <- merge(ds01, ds02, by = "ID")
rm(ds01, ds02)

Variable: Sample size by Country

Display code
tbl01 <- table(ds$Country)

## Table of user language by country:
tbl01

  Gambia Pakistan Tanzania   Uganda 
     232      504      352      500 
Display code
## Sample size by country:

lp01 <- ds %>% 
  # drop_na(Country) %>%
  lollipop_chart(x = Country,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Sample size by country")+
  theme_bw()

lp01

Variable: Age

Display code
summary(ds$age)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
     18      26      34      37      45      92      60 
Display code
ds %>% drop_na(age)%>%
ggplot(aes(x = age))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 50)+
  geom_textvline(label = "Mean = 37.00", 
                 xintercept = 37.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Age", 
       y = "Frequency", 
       title = "Age distribution (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(age)%>%
ggplot(aes(x = age))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 50)+
  labs(x = "Age", 
       y = "Frequency", 
       title = "Age distribution by country")+
  facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Gender

Display code
ds$gender <- ifelse(ds$gender == "Male", "Male",
             ifelse(ds$gender == "Female", "Female", NA))

lp02 <- ds %>% 
  drop_na(gender, age, Country) %>%
lollipop_chart(x = gender,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Gender distribution (full sample)")+
#  facet_wrap(~Country, nrow = 2)+
  theme_bw()

lp02

Display code
bp01 <- ds %>% drop_na(gender, age) %>% 
  ggplot(aes(y = age, 
             x = gender))+
geom_boxplot(fill = "grey")+
  labs(y = "Age",
       x = "",
       title = "Age and gender distribution by country")+
  facet_wrap(~Country, nrow = 2)+
  coord_flip()+
  theme_bw()

bp01

Variable: Socio-economic status

Display code
ds$ses <- ifelse(ds$ses == "", NA, ds$ses)
table(ds$ses)

Lower middle       Middle        Upper Upper middle 
         508          822           24          170 
Display code
ds %>% drop_na(ses) %>%
lollipop_chart(x = ses,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Socioeconomic status (full sample)")+
  theme_bw()

Variable: Nature of employment

Display code
ds$jobnature <- ifelse(ds$jobnature == "", NA, ds$jobnature)

#sentence case:
ds$jobnature <- gsub("(\\D)(\\D+)", "\\U\\1\\L\\2", ds$jobnature, perl = TRUE)

ds$jobnature <- ifelse(ds$jobnature == "Non-government/self-employed", 
                       "Non-government", ds$jobnature)

table(ds$jobnature)

    Government Non-government          Other        Retired  Self-employed 
           321            292              3              1            797 
       Student 
             6 
Display code
ds %>% drop_na(jobnature) %>%
lollipop_chart(x = jobnature,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Nature of employment (full sample)")+
  theme_bw()

Variable: Religious affiliation

Display code
ds$religion <- ifelse(ds$religion == "", NA, ds$religion)

ds$religion <- ifelse(ds$religion == "Christian (Catholic)", "Christian: Catholic", 
               ifelse(ds$religion == "Christian (Protestant)", "Christian: Protestant",
               ifelse(ds$religion == "Muslim (Shia)", "Muslim: Shia",
               ifelse(ds$religion == "Muslim (Sunni)", "Muslim: Sunni", ds$religion))))
table(ds$religion)

    Christian: Catholic        Christian: Other  Christian: Pentecostal 
                    497                      41                      33 
  Christian: Protestant                   Hindu           Muslim: Other 
                    219                      37                       3 
           Muslim: Shia           Muslim: Sunni                   Other 
                    187                     405                      89 
                   Sikh Spiritual not religious 
                      9                      14 
Display code
lp05 <- ds %>% drop_na(religion) %>%
lollipop_chart(x = religion,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Religious distribution (full sample)")+
  theme_bw()

lp05

Variable: Marital status

Display code
ds$married <- ifelse(ds$married == "Not married", "Unmarried", ds$married)
ds$married <- ifelse(ds$married == "", NA, ds$married)

table(ds$married)

  Married     Other Unmarried 
      979        92       479 

Variable: Ethnicity

Display code
## Gambia:
eth <- as.data.frame(table(dsgmb$Ethnicity))
eth$Var1 <- as.character(eth$Var1)
eth$ethnicity <- ifelse(eth$Freq < 2, "Other", eth$Var1)
l1 <- as.list(eth$ethnicity)

dsgmb2 <- dsgmb[, c("Ethnicity")]

dsgmb2$ethnicity <- ifelse(dsgmb2$Ethnicity %in% l1, dsgmb2$Ethnicity, "Other")
dsgmb2$ethnicity <- ifelse(dsgmb2$ethnicity == "Serere", "Serer",
                 ifelse(dsgmb2$ethnicity == "", NA, dsgmb2$ethnicity))

table(dsgmb2$ethnicity)

 Balanta     Fula     Jola Karonika Mandinka  Manjago    Other    Serer 
       3       31       45        3       74        5       11        4 
  Wollof 
      19 
Display code
ethgmb <- dsgmb2 %>% drop_na(ethnicity) %>%
lollipop_chart(x = ethnicity,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Ethnic distribution: Gambia")+
  theme_bw()

ethgmb

Display code
## Pakistan:
eth <- as.data.frame(table(dspak$Ethnicity))
eth$Var1 <- as.character(eth$Var1)
eth$ethnicity <- ifelse(eth$Freq < 7, "Other", eth$Var1)
l1 <- as.list(eth$ethnicity)

dspak2 <- dspak[, c("Ethnicity")]

dspak2$ethnicity <- ifelse(dspak2$Ethnicity %in% l1, dspak2$Ethnicity, "Other")
dspak2$ethnicity <- ifelse(dspak2$ethnicity == "Serere", "Serer",
                 ifelse(dspak2$ethnicity == "", NA, dspak2$ethnicity))

table(dspak2$ethnicity)

      Bhatti    Christain       Hazara         Jopu        Other      Punjabi 
          22           28            7           20          124          118 
      Rajput      Sadozai         Shia         Sikh       Sindhi        Sunni 
           9           10           20           10           14           29 
        Syed Urduspeaking 
          33           60 
Display code
ethpak <- dspak2 %>% drop_na(ethnicity) %>%
lollipop_chart(x = ethnicity,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Ethnic distribution: Pakistan")+
  theme_bw()

ethpak

Display code
## Tanzania:
eth <- as.data.frame(table(dstza$Ethnicity))
eth$Var1 <- as.character(eth$Var1)
eth$ethnicity <- ifelse(eth$Freq < 7, "Other", eth$Var1)
l1 <- as.list(eth$ethnicity)

dstza2 <- dstza[, c("Ethnicity")]

dstza2$ethnicity <- ifelse(dstza2$Ethnicity %in% l1, dstza2$Ethnicity, "Other")
dstza2$ethnicity <- ifelse(dstza2$ethnicity == "Serere", "Serer",
                 ifelse(dstza2$ethnicity == "", NA, dstza2$ethnicity))

table(dstza2$ethnicity)

 Maasai  Mchaga   Mgogo Mlugulu Mluguru  Mngoni   Mpare Msambaa Msukuma    Muha 
    122       9       8      11      15       8       9      11      10       7 
 Mzigua   Other 
      7     120 
Display code
ethtza <- dstza2 %>% drop_na(ethnicity) %>%
lollipop_chart(x = ethnicity,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Ethnic distribution: Tanzania")+
  theme_bw()

ethtza

Display code
## Uganda:
eth <- as.data.frame(table(dsuga$Ethnicity))
eth$Var1 <- as.character(eth$Var1)
eth$ethnicity <- ifelse(eth$Freq < 7, "Other", eth$Var1)
l1 <- as.list(eth$ethnicity)

dsuga2 <- dsuga[, c("Ethnicity")]

dsuga2$ethnicity <- ifelse(dsuga2$Ethnicity %in% l1, dsuga2$Ethnicity, "Other")
dsuga2$ethnicity <- ifelse(dsuga2$ethnicity == "Serere", "Serer",
                 ifelse(dsuga2$ethnicity == "", NA, dsuga2$ethnicity))

table(dsuga2$ethnicity)

     Adhola    Amudaama      Atesot       Bantu      Etesot       Gishu 
         18          12          69          11          74           8 
     Itesot   Japadhola japhadollah Japhadollah     Munyole      Musoga 
         32         107          24          30           7           8 
    Nilotic       Other 
         27          73 
Display code
ethuga <- dsuga2 %>% drop_na(ethnicity) %>%
lollipop_chart(x = ethnicity,
               line_color = "black",
               point_color = "black")+
  labs(y = "Frequency",
       x = "",
       title = "Ethnic distribution: Uganda")+
  theme_bw()

ethuga

Section 2. Variables of interest

Variables of interest in the analysis:

  • Endorsement of Barrier Bound Leadership (BBL)

  • Endorsement of Barrier Crossing Leadership (BCL)

  • Ingroup fusion

  • Ingroup identification

  • Outgroup bonds (sum of outgroup fusion+identification)

  • Empathic concern

  • Perspective taking

  • Perceived history of discrimination

  • Positive contact with outgroup

  • Negative contact with outgroup

  • Imagistic items:

    • Event: Positive affect
    • Event: Negative affect
    • Event: Episodic recall
    • Event: Shared perception
    • Event: Reflection
    • Event: Transformative for individual
    • Event: Transformative for group
    • Imagistic event (sum of all above)
  • Perception of religion Freedom

  • Experience of religious freedom

Variable: Endorsement of Barrier Bound Leadership (BBL)

Display code
ds$bbl <- (ds$ENDBBL01+ ds$ENDBBL02+ ds$ENDBBL03)/3
ds$bcl <- (ds$ENDBCL01+ ds$ENDBCL02+ ds$ENDBCL03)/3

summary(ds$bbl)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       3       5       4       6       7      75 
Display code
ds %>% drop_na(bbl)%>%
ggplot(aes(x = bbl))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
  geom_textvline(label = "Mean = 4.00", 
                 xintercept = 4.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Endorsement of BBL score", 
       y = "Frequency", 
       title = "Endorsement of BBL (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(bbl, Country)%>%
ggplot(aes(x = bbl))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
 labs(x = "Endorsement of BBL score", 
       y = "Frequency", 
       title = "Endorsement of BBL by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(bbl)%>%
ggplot(aes(x = bbl,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 4.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
 labs(x = "Endorsement of BBL score", 
       y = "Frequency", 
       title = "Endorsement of BBL by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Endorsement of Barrier Crossing Leadership (BCL)

Display code
summary(ds$bcl)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       5       6       6       6       7      71 
Display code
ds %>% drop_na(bcl)%>%
ggplot(aes(x = bcl))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Endorsement of BCL score", 
       y = "Frequency", 
       title = "Endorsement of BCL (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(bcl, Country)%>%
ggplot(aes(x = bcl))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
 labs(x = "Endorsement of BCL score", 
       y = "Frequency", 
       title = "Endorsement of BCL by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(bcl)%>%
ggplot(aes(x = bcl,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
 labs(x = "Endorsement of BCL score", 
       y = "Frequency", 
       title = "Endorsement of BCL by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Ingroup fusion

Display code
ds$igfusion <- (ds$IGF01+ds$IGF02+ds$IGF03)/3

summary(ds$igfusion)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       6       6       6       7       7      79 
Display code
ds %>% drop_na(igfusion)%>%
ggplot(aes(x = igfusion))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Ingroup fusion score", 
       y = "Frequency", 
       title = "Ingroup fusion (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(igfusion, Country)%>%
ggplot(aes(x = igfusion))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
 labs(x = "Ingroup fusion score", 
       y = "Frequency", 
       title = "Ingroup fusion by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(igfusion)%>%
ggplot(aes(x = igfusion,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Ingroup fusion score", 
       y = "Frequency", 
       title = "Ingroup fusion by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Ingroup identification

Display code
ds$IGI01 <- ifelse(ds$IGI01 %in% 1:7, ds$IGI01, NA)
ds$igidentification <- (ds$IGI01+ds$IGI02+ds$IGI03)/3

summary(ds$igidentification)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       6       6       6       7       7      83 
Display code
ds %>% drop_na(igidentification)%>%
ggplot(aes(x = igidentification))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Ingroup identification score", 
       y = "Frequency", 
       title = "Ingroup identification (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(igidentification, Country)%>%
ggplot(aes(x = igidentification))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
 labs(x = "Ingroup identification score", 
       y = "Frequency", 
       title = "Ingroup identification by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(igidentification)%>%
ggplot(aes(x = igidentification,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Ingroup identification score", 
       y = "Frequency", 
       title = "Ingroup identification by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Outgroup bonds

Display code
ds$ogbonds <- (ds$OGI01+ds$OGI02+ds$OGI03+
               ds$OGF01+ds$OGF02+ds$OGF03)/6

summary(ds$ogbonds)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       2       3       3       4       7     136 
Display code
ds %>% drop_na(ogbonds)%>%
ggplot(aes(x = ogbonds))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 35)+
  geom_textvline(label = "Mean = 3.00", 
                 xintercept = 3.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Outgroup bonds score", 
       y = "Frequency", 
       title = "Outgroup bonds (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(ogbonds, Country)%>%
ggplot(aes(x = ogbonds))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
 labs(x = "Outgroup bonds score", 
       y = "Frequency", 
       title = "Outgroup bonds by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(ogbonds)%>%
ggplot(aes(x = ogbonds,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 3.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
 labs(x = "Outgroup bonds score", 
       y = "Frequency", 
       title = "Outgroup bonds by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Empathic concern

Display code
ds$empathic_concern <- (ds$empathic_concern_01+ds$empathic_concern_02+
                        ds$empathic_concern_03)/3

summary(ds$empathic_concern)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       5       6       6       6       7      68 
Display code
ds %>% drop_na(empathic_concern)%>%
ggplot(aes(x = empathic_concern))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 35)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Empathic concern score", 
       y = "Frequency", 
       title = "Empathic concern (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(empathic_concern, Country)%>%
ggplot(aes(x = empathic_concern))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
 labs(x = "Empathic concern score", 
       y = "Frequency", 
       title = "Empathic concern by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(empathic_concern)%>%
ggplot(aes(x = empathic_concern,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
 labs(x = "Empathic concern score", 
       y = "Frequency", 
       title = "Empathic concern by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Perspective taking

Display code
ds$perspective_taking <- (ds$perspective_taking_01+ds$perspective_taking_02+
                          ds$perspective_taking_03+ds$perspective_taking_04)/4

summary(ds$perspective_taking)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       5       6       6       6       7      87 
Display code
ds %>% drop_na(perspective_taking)%>%
ggplot(aes(x = perspective_taking))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 35)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Perspective taking score", 
       y = "Frequency", 
       title = "Perspective taking (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(perspective_taking, Country)%>%
ggplot(aes(x = perspective_taking))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 25)+
 labs(x = "Perspective taking score", 
       y = "Frequency", 
       title = "Perspective taking by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(perspective_taking)%>%
ggplot(aes(x = perspective_taking,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
 labs(x = "Perspective taking score", 
       y = "Frequency", 
       title = "Perspective taking by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Perceived history of discrimination

Display code
summary(ds$history_discrimination)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       2       4       4       6       7      60 
Display code
ds %>% drop_na(history_discrimination)%>%
ggplot(aes(x = history_discrimination))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 10)+
  geom_textvline(label = "Mean = 4.00", 
                 xintercept = 4.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Perceived history of discrimination score", 
       y = "Frequency", 
       title = "Perceived history of discrimination (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(history_discrimination, Country)%>%
ggplot(aes(x = history_discrimination))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 10)+
 labs(x = "Perceived history of discrimination score", 
       y = "Frequency", 
       title = "Perceived history of discrimination by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(history_discrimination)%>%
ggplot(aes(x = history_discrimination,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 4.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Perceived history of discrimination score", 
       y = "Frequency", 
       title = "Perceived history of discrimination by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Event: Positive Affect

Display code
summary(ds$Event_positive_affect)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       1       3       4       6       7      70 
Display code
ds %>% drop_na(Event_positive_affect)%>%
ggplot(aes(x = Event_positive_affect))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 4.00", 
                 xintercept = 4.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Positive affect score", 
       y = "Frequency", 
       title = "Event: Positive affect (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_positive_affect, Country)%>%
ggplot(aes(x = Event_positive_affect))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Positive affect score", 
       y = "Frequency", 
       title = "Event: Positive affect by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_positive_affect)%>%
ggplot(aes(x = Event_positive_affect,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 4.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Positive affect score", 
       y = "Frequency", 
       title = "Event: Positive affect by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Event: Negative Affect

Display code
summary(ds$Event_negative_affect)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       2       6       5       7       7      64 
Display code
ds %>% drop_na(Event_negative_affect)%>%
ggplot(aes(x = Event_negative_affect))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 5.00", 
                 xintercept = 5.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Negative affect score", 
       y = "Frequency", 
       title = "Event: Negative affect (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_negative_affect, Country)%>%
ggplot(aes(x = Event_negative_affect))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Negative affect score", 
       y = "Frequency", 
       title = "Event: Negative affect by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_negative_affect)%>%
ggplot(aes(x = Event_negative_affect,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 5.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Negative affect score", 
       y = "Frequency", 
       title = "Event: Negative affect by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Event: Episodic recall

Display code
summary(ds$Event_episodic_recall)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       6       6       6       7       7      77 
Display code
ds %>% drop_na(Event_episodic_recall)%>%
ggplot(aes(x = Event_episodic_recall))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Episodic recall score", 
       y = "Frequency", 
       title = "Event: Episodic recall (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_episodic_recall, Country)%>%
ggplot(aes(x = Event_episodic_recall))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Episodic recall score", 
       y = "Frequency", 
       title = "Event: Episodic recall by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_episodic_recall)%>%
ggplot(aes(x = Event_episodic_recall,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Episodic recall score", 
       y = "Frequency", 
       title = "Event: Episodic recall by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Event: Shared perception

Display code
summary(ds$Event_shared_perception)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       5       6       6       6       7      67 
Display code
ds %>% drop_na(Event_shared_perception)%>%
ggplot(aes(x = Event_shared_perception))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Shared perception score", 
       y = "Frequency", 
       title = "Event: Shared perception (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_shared_perception, Country)%>%
ggplot(aes(x = Event_shared_perception))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Shared perception score", 
       y = "Frequency", 
       title = "Event: Shared perception by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_shared_perception)%>%
ggplot(aes(x = Event_shared_perception,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Shared perception score", 
       y = "Frequency", 
       title = "Event: Shared perception by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Event: Reflection

Display code
ds$Event_reflection <- ds$Event_event_reflection
summary(ds$Event_reflection)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       4       6       5       6       7      77 
Display code
ds %>% drop_na(Event_reflection)%>%
ggplot(aes(x = Event_reflection))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 6.00", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Reflection score", 
       y = "Frequency", 
       title = "Event: Reflection (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_reflection, Country)%>%
ggplot(aes(x = Event_reflection))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Reflection score", 
       y = "Frequency", 
       title = "Event: Reflection by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_reflection)%>%
ggplot(aes(x = Event_reflection,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 6.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Reflection score", 
       y = "Frequency", 
       title = "Event: Reflection by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Event: Transformative for individual

Display code
summary(ds$Event_transformative_indiv)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       4       6       5       6       7      86 
Display code
ds %>% drop_na(Event_transformative_indiv)%>%
ggplot(aes(x = Event_transformative_indiv))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 5.00", 
                 xintercept = 5.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Transformative for individual score", 
       y = "Frequency", 
       title = "Event: Transformative for individual (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_transformative_indiv, Country)%>%
ggplot(aes(x = Event_transformative_indiv))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Transformative for individual score", 
       y = "Frequency", 
       title = "Event: Transformative for individual by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_transformative_indiv)%>%
ggplot(aes(x = Event_transformative_indiv,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 5.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Transformative for individual score", 
       y = "Frequency", 
       title = "Event: Transformative for individual by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Event: Transformative for group

Display code
summary(ds$Event_transformative_group)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      1       4       6       5       6       7      66 
Display code
ds %>% drop_na(Event_transformative_group)%>%
ggplot(aes(x = Event_transformative_group))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 5.00", 
                 xintercept = 5.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Transformative for group score", 
       y = "Frequency", 
       title = "Event: Transformative for group (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_transformative_group, Country)%>%
ggplot(aes(x = Event_transformative_group))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Transformative for group score", 
       y = "Frequency", 
       title = "Event: Transformative for group by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_transformative_group)%>%
ggplot(aes(x = Event_transformative_group,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 5.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Transformative for group score", 
       y = "Frequency", 
       title = "Event: Transformative for group by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Variable: Imagistic event (sum of all subscales)

Display code
ds$Event_imagistic <- ds$imagistic

summary(ds$Event_imagistic)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      7      32      36      35      40      49     133 
Display code
ds %>% drop_na(Event_imagistic)%>%
ggplot(aes(x = Event_imagistic))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
  geom_textvline(label = "Mean = 35.00", 
                 xintercept = 35.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(x = "Event: Imagistic score", 
       y = "Frequency", 
       title = "Event: Imagistic (full sample)")+
  theme_bw()

Display code
ds %>% drop_na(Event_imagistic, Country)%>%
ggplot(aes(x = Event_imagistic))+
  geom_histogram(color = "black",
                 fill = "gray",
                 bins = 15)+
 labs(x = "Event: Imagistic score", 
       y = "Frequency", 
       title = "Event: Imagistic by country")+
  facet_wrap(~Country)+
  theme_bw()

Display code
ds %>% drop_na(Event_imagistic)%>%
ggplot(aes(x = Event_imagistic,
           y = Country))+
  geom_boxplot(fill = "grey")+
  geom_textvline(label = " ", 
                 xintercept = 35.00, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+ 
  labs(x = "Event: Imagistic score", 
       y = "Frequency", 
       title = "Event: Imagistic by country")+
  #facet_wrap(~Country, nrow = 2)+
  theme_bw()

Section 3. Outcome: Social perception of Religious Freedom

Unconditional means model

Also called “varying intercept model with no predictors” (Gelman and Hill, 2016, Chapter 12). Allows intercepts to randomly vary across countries:

Display code
ds$SPRF <- ds$Sprf

## Varying intercept model with no predictors:
m00<- lmer(SPRF ~ 1 + (1 | Country), 
           data = ds)

summary(m00)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: SPRF ~ 1 + (1 | Country)
   Data: ds

REML criterion at convergence: 3075

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-4.781 -0.576  0.062  0.735  2.655 

Random effects:
 Groups   Name        Variance Std.Dev.
 Country  (Intercept) 0.0295   0.172   
 Residual             0.4455   0.667   
Number of obs: 1508, groups:  Country, 4

Fixed effects:
            Estimate Std. Error     df t value  Pr(>|t|)    
(Intercept)   5.4404     0.0878 3.0347    61.9 0.0000083 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Random effects:

Variance for Intercept = 0.03. This is the variance of the means across level 1 categories (countries). Residual = 0.44. Variance explained by level 1 residuals (everything that’s not in level 1).

Display code
tab_model(m00)
  SPRF
Predictors Estimates CI p
(Intercept) 5.44 5.27 – 5.61 <0.001
Random Effects
σ2 0.45
τ00 Country 0.03
ICC 0.06
N Country 4
Observations 1508
Marginal R2 / Conditional R2 0.000 / 0.062

We can see that ICC = 0.06. Lower ICC = low variance explained across groups. In this case, most of the variability is at individual-level (not group level). There is no significantly different patterns between countries.

Random intercept models

Also called “varying intercept model with individual-level predictors” (Gelman and Hill, 2016, Chapter 12).

Display code
## Create proper variable names:

ds$IG_Fusion <- (ds$IGF01+ds$IGF02+ds$IGF03)/3

ds$IG_Identification <- ds$igidentification

ds$OG_Bonds <- (ds$OGI01+ds$OGI02+ds$OGI03+
               ds$OGF01+ds$OGF02+ds$OGF03)/6

ds$Empathic_concern <- (ds$empathic_concern_01+ds$empathic_concern_02+
                        ds$empathic_concern_03)/3

ds$Perspective_taking <- (ds$perspective_taking_01+ds$perspective_taking_02+
                        ds$perspective_taking_03+ds$perspective_taking_03)/4

ds$Age <- ds$age

ds$Wealth_level <- as.factor(ifelse(ds$ses == "Lower middle", 1, 
                             ifelse(ds$ses == "Middle", 2,
                             ifelse(ds$ses == "Upper middle", 3,
                             ifelse(ds$ses == "Upper", 4, "")))))

ds$Female <- as.factor(ifelse(ds$gender == "Female", 1, 0))

ds$Married <- ds$married

ds$Perception_religious_freedom <- ds$SPRF

## Varying intercept models with individual-level predictors:
m01 <- lmer(Perception_religious_freedom~IG_Fusion+IG_Identification+OG_Bonds+Empathic_concern+
              Perspective_taking+Age+Female+Married+Wealth_level+
              (1 | Country), 
            data = ds)

summary(m01)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: Perception_religious_freedom ~ IG_Fusion + IG_Identification +  
    OG_Bonds + Empathic_concern + Perspective_taking + Age +  
    Female + Married + Wealth_level + (1 | Country)
   Data: ds

REML criterion at convergence: 2572

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-5.070 -0.592  0.041  0.684  4.023 

Random effects:
 Groups   Name        Variance Std.Dev.
 Country  (Intercept) 0.0214   0.146   
 Residual             0.3816   0.618   
Number of obs: 1336, groups:  Country, 4

Fixed effects:
                      Estimate  Std. Error          df t value
(Intercept)           2.837537    0.187012  105.809913   15.17
IG_Fusion             0.077957    0.022351 1321.999013    3.49
IG_Identification     0.123826    0.024244 1320.538380    5.11
OG_Bonds              0.015206    0.011833 1322.992963    1.29
Empathic_concern      0.029632    0.018367 1322.549372    1.61
Perspective_taking    0.175117    0.019837 1322.417056    8.83
Age                  -0.000558    0.001353 1322.443901   -0.41
Female1               0.035883    0.034795 1322.918057    1.03
MarriedOther         -0.021654    0.082494 1321.536365   -0.26
MarriedUnmarried      0.090232    0.040041 1321.662765    2.25
Wealth_level2         0.172444    0.043781 1232.761737    3.94
Wealth_level3         0.149016    0.063998 1269.681569    2.33
Wealth_level4         0.004837    0.135786 1322.051826    0.04
                               Pr(>|t|)    
(Intercept)        < 0.0000000000000002 ***
IG_Fusion                        0.0005 ***
IG_Identification            0.00000037 ***
OG_Bonds                         0.1990    
Empathic_concern                 0.1069    
Perspective_taking < 0.0000000000000002 ***
Age                              0.6801    
Female1                          0.3026    
MarriedOther                     0.7930    
MarriedUnmarried                 0.0244 *  
Wealth_level2                0.00008650 ***
Wealth_level3                    0.0200 *  
Wealth_level4                    0.9716    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Display code
tab_model(m01)
  Perception_religious_freedom
Predictors Estimates CI p
(Intercept) 2.84 2.47 – 3.20 <0.001
IG Fusion 0.08 0.03 – 0.12 0.001
IG Identification 0.12 0.08 – 0.17 <0.001
OG Bonds 0.02 -0.01 – 0.04 0.199
Empathic concern 0.03 -0.01 – 0.07 0.107
Perspective taking 0.18 0.14 – 0.21 <0.001
Age -0.00 -0.00 – 0.00 0.680
Female [1] 0.04 -0.03 – 0.10 0.303
Married [Other] -0.02 -0.18 – 0.14 0.793
Married [Unmarried] 0.09 0.01 – 0.17 0.024
Wealth level [2] 0.17 0.09 – 0.26 <0.001
Wealth level [3] 0.15 0.02 – 0.27 0.020
Wealth level [4] 0.00 -0.26 – 0.27 0.972
Random Effects
σ2 0.38
τ00 Country 0.02
ICC 0.05
N Country 4
Observations 1336
Marginal R2 / Conditional R2 0.165 / 0.209

Here, marginal R sq is much higher compared to previous model. Adding individual-level predictors significantly increases explanatory power of the model. Again, evidence that most of the variation is at individual-level differences.

Display code
## Change class of all models so we can use stargazer():
class(m00) <- "lmerMod"
class(m01) <- "lmerMod"

## Tabulated results:
stargazer(m00, m01,
          type = "html", 
          star.cutoffs = c(0.05, 0.01, 0.001),
          out = "table1.html")
Display code
htmltools::includeHTML("table1.html")
Dependent variable:
SPRFPerception_religious_freedom
(1)(2)
IG_Fusion0.078***
(0.022)
IG_Identification0.120***
(0.024)
OG_Bonds0.015
(0.012)
Empathic_concern0.030
(0.018)
Perspective_taking0.170***
(0.020)
Age-0.001
(0.001)
Female10.036
(0.035)
MarriedOther-0.022
(0.082)
MarriedUnmarried0.090*
(0.040)
Wealth_level20.170***
(0.044)
Wealth_level30.150*
(0.064)
Wealth_level40.005
(0.140)
Constant5.400***2.800***
(0.088)(0.190)
Observations1,5081,336
Log Likelihood-1,538.000-1,286.000
Akaike Inf. Crit.3,081.0002,602.000
Bayesian Inf. Crit.3,097.0002,680.000
Note:*p<0.05; **p<0.01; ***p<0.001

Random intercept models: Imagistic predictors

Display code
## Varying intercept models with individual-level predictors:
m02 <- lmer(Perception_religious_freedom~Event_shared_perception+Event_episodic_recall+
              Event_reflection+Event_positive_affect+Event_negative_affect+
              Event_transformative_indiv+Event_transformative_group+
              Age+Female+Married+Wealth_level+
              (1 | Country), 
            data = ds)

summary(m02)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: 
Perception_religious_freedom ~ Event_shared_perception + Event_episodic_recall +  
    Event_reflection + Event_positive_affect + Event_negative_affect +  
    Event_transformative_indiv + Event_transformative_group +  
    Age + Female + Married + Wealth_level + (1 | Country)
   Data: ds

REML criterion at convergence: 2694

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-4.582 -0.638  0.027  0.695  3.074 

Random effects:
 Groups   Name        Variance Std.Dev.
 Country  (Intercept) 0.0351   0.187   
 Residual             0.3829   0.619   
Number of obs: 1389, groups:  Country, 4

Fixed effects:
                              Estimate  Std. Error          df t value
(Intercept)                   3.740008    0.167245   26.908539   22.36
Event_shared_perception       0.005196    0.014739 1373.885648    0.35
Event_episodic_recall         0.156927    0.018088 1373.002552    8.68
Event_reflection              0.007746    0.014817 1360.070474    0.52
Event_positive_affect         0.012999    0.009906 1372.960896    1.31
Event_negative_affect         0.033502    0.009505 1373.548506    3.52
Event_transformative_indiv    0.038284    0.015107 1373.570934    2.53
Event_transformative_group    0.034220    0.013935 1372.159201    2.46
Age                           0.000292    0.001338 1372.419082    0.22
Female1                       0.029548    0.034110 1373.690621    0.87
MarriedOther                 -0.056278    0.082711 1373.810656   -0.68
MarriedUnmarried              0.072826    0.039482 1371.850497    1.84
Wealth_level2                 0.161968    0.043650 1329.019879    3.71
Wealth_level3                 0.032567    0.063280 1351.778041    0.51
Wealth_level4                -0.127885    0.136147 1373.992721   -0.94
                                       Pr(>|t|)    
(Intercept)                < 0.0000000000000002 ***
Event_shared_perception                 0.72450    
Event_episodic_recall      < 0.0000000000000002 ***
Event_reflection                        0.60123    
Event_positive_affect                   0.18968    
Event_negative_affect                   0.00044 ***
Event_transformative_indiv              0.01138 *  
Event_transformative_group              0.01418 *  
Age                                     0.82732    
Female1                                 0.38651    
MarriedOther                            0.49636    
MarriedUnmarried                        0.06532 .  
Wealth_level2                           0.00022 ***
Wealth_level3                           0.60689    
Wealth_level4                           0.34773    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Display code
tab_model(m02)
  Perception_religious_freedom
Predictors Estimates CI p
(Intercept) 3.74 3.41 – 4.07 <0.001
Event shared perception 0.01 -0.02 – 0.03 0.725
Event episodic recall 0.16 0.12 – 0.19 <0.001
Event reflection 0.01 -0.02 – 0.04 0.601
Event positive affect 0.01 -0.01 – 0.03 0.190
Event negative affect 0.03 0.01 – 0.05 <0.001
Event transformative
indiv
0.04 0.01 – 0.07 0.011
Event transformative
group
0.03 0.01 – 0.06 0.014
Age 0.00 -0.00 – 0.00 0.827
Female [1] 0.03 -0.04 – 0.10 0.387
Married [Other] -0.06 -0.22 – 0.11 0.496
Married [Unmarried] 0.07 -0.00 – 0.15 0.065
Wealth level [2] 0.16 0.08 – 0.25 <0.001
Wealth level [3] 0.03 -0.09 – 0.16 0.607
Wealth level [4] -0.13 -0.39 – 0.14 0.348
Random Effects
σ2 0.38
τ00 Country 0.04
ICC 0.08
N Country 4
Observations 1389
Marginal R2 / Conditional R2 0.135 / 0.208

Here, marginal R sq is much higher compared to previous model. Adding individual-level predictors significantly increases explanatory power of the model. Again, evidence that most of the variation is at individual-level differences.

Display code
## Change class of all models so we can use stargazer():
class(m00) <- "lmerMod"
class(m01) <- "lmerMod"
class(m02) <- "lmerMod"

## Tabulated results:
stargazer(m00, m01, m02,
          type = "html", 
          star.cutoffs = c(0.05, 0.01, 0.001),
          out = "table1.html")
Display code
htmltools::includeHTML("table1.html")
Dependent variable:
SPRFPerception_religious_freedom
(1)(2)(3)
IG_Fusion0.078***
(0.022)
IG_Identification0.120***
(0.024)
OG_Bonds0.015
(0.012)
Empathic_concern0.030
(0.018)
Perspective_taking0.170***
(0.020)
Event_shared_perception0.005
(0.015)
Event_episodic_recall0.160***
(0.018)
Event_reflection0.008
(0.015)
Event_positive_affect0.013
(0.010)
Event_negative_affect0.034***
(0.010)
Event_transformative_indiv0.038*
(0.015)
Event_transformative_group0.034*
(0.014)
Age-0.0010.0003
(0.001)(0.001)
Female10.0360.030
(0.035)(0.034)
MarriedOther-0.022-0.056
(0.082)(0.083)
MarriedUnmarried0.090*0.073
(0.040)(0.039)
Wealth_level20.170***0.160***
(0.044)(0.044)
Wealth_level30.150*0.033
(0.064)(0.063)
Wealth_level40.005-0.130
(0.140)(0.140)
Constant5.400***2.800***3.700***
(0.088)(0.190)(0.170)
Observations1,5081,3361,389
Log Likelihood-1,538.000-1,286.000-1,347.000
Akaike Inf. Crit.3,081.0002,602.0002,728.000
Bayesian Inf. Crit.3,097.0002,680.0002,817.000
Note:*p<0.05; **p<0.01; ***p<0.001

Histogram: Perception of Religious Freedom

Display code
summary(ds$SPRF)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      2       5       6       5       6       7      80 
Display code
ggplot(data = ds, 
       aes(x = SPRF)) +
  geom_histogram(color = "black",
                 bins = 20)+
  xlim(1, 7)+
  geom_textvline(label = "Mean = 5.0", 
                 xintercept = 5.0, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(y = "Frequency",
       x = "SPRF score", 
       title = "Social Perception of Religiour Freedom")+
  theme_bw()

Display code
ggplot(data = ds, 
       aes(x = SPRF)) +
  geom_histogram(color = "black",
                 bins = 20)+
  xlim(1, 7)+
  labs(y = "Frequency",
       x = "SPRF score", 
       title = "Social Perception of Religiour Freedom")+
  facet_wrap( ~ Country, nrow = 2) +
  theme_bw()

Display code
df01 <- ds %>% drop_na(SPRF)

tbl01 <- aggregate(df01$SPRF, 
                    by=list(df01$Country),
                    FUN=mean)
tbl01$Country <- tbl01$Group.1
tbl01$SPRF <- tbl01$x
tbl01 <- tbl01[, 3:4]
tbl01
   Country SPRF
1   Gambia  5.6
2 Pakistan  5.2
3 Tanzania  5.4
4   Uganda  5.6
Display code
ggplot(data = df01, 
       aes(x = SPRF, 
           y = Country)) +
  geom_boxplot(color = "black",
               fill = "grey")+
  xlim(1, 7)+
  geom_textvline(label = "Mean = 4.70", 
                 xintercept = 4.70, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(y = "",
       x = "SPRF score", 
       title = "Social Perceptions of Relgious Freedom")+
  theme_bw()

Section 3. Outcome: Experience of Religious Freedom

Unconditional means model

Also called “varying intercept model with no predictors” (Gelman and Hill, 2016, Chapter 12). Allows intercepts to randomly vary across countries:

Display code
ds$Exp_religious_freedom <- ds$Exp_religious_freedom

## Varying intercept model with no predictors:
m10<- lmer(Exp_religious_freedom ~ 1 + (1 | Country), 
           data = ds)

summary(m10)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: Exp_religious_freedom ~ 1 + (1 | Country)
   Data: ds

REML criterion at convergence: 5084

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-3.965 -0.514  0.381  0.646  1.219 

Random effects:
 Groups   Name        Variance Std.Dev.
 Country  (Intercept) 0.141    0.375   
 Residual             1.700    1.304   
Number of obs: 1505, groups:  Country, 4

Fixed effects:
            Estimate Std. Error    df t value Pr(>|t|)    
(Intercept)    5.863      0.191 3.022    30.7 0.000072 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Random effects:

Variance for Intercept = 0.141. This is the variance of the means across level 1 categories (countries). Residual = 1.7. Variance explained by level 1 residuals (everything that’s not in level 1).

Display code
tab_model(m10)
  Exp_religious_freedom
Predictors Estimates CI p
(Intercept) 5.86 5.49 – 6.24 <0.001
Random Effects
σ2 1.70
τ00 Country 0.14
ICC 0.08
N Country 4
Observations 1505
Marginal R2 / Conditional R2 0.000 / 0.076

We can see that ICC = 0.08. Lower ICC = low variance explained across groups. In this case, most of the variability is at individual-level (not group level). There is no significantly different patterns between countries.

Random intercept models

Also called “varying intercept model with individual-level predictors” (Gelman and Hill, 2016, Chapter 12).

Display code
## Varying intercept models with individual-level predictors:
m11 <- lmer(Exp_religious_freedom~IG_Fusion+IG_Identification+OG_Bonds+Empathic_concern+
              Perspective_taking+Age+Female+Married+Wealth_level+
              (1 | Country), 
            data = ds)

summary(m11)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: Exp_religious_freedom ~ IG_Fusion + IG_Identification + OG_Bonds +  
    Empathic_concern + Perspective_taking + Age + Female + Married +  
    Wealth_level + (1 | Country)
   Data: ds

REML criterion at convergence: 4304

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-4.627 -0.520  0.236  0.698  2.388 

Random effects:
 Groups   Name        Variance Std.Dev.
 Country  (Intercept) 0.0965   0.311   
 Residual             1.4016   1.184   
Number of obs: 1339, groups:  Country, 4

Fixed effects:
                     Estimate Std. Error         df t value
(Intercept)           4.59130    0.36432   77.36163   12.60
IG_Fusion             0.05115    0.04276 1324.52159    1.20
IG_Identification     0.10790    0.04628 1323.36627    2.33
OG_Bonds             -0.21021    0.02264 1325.97372   -9.29
Empathic_concern      0.17279    0.03521 1325.96834    4.91
Perspective_taking   -0.00981    0.03806 1325.83255   -0.26
Age                   0.00158    0.00258 1325.20060    0.61
Female1               0.19232    0.06668 1325.99948    2.88
MarriedOther          0.22916    0.15809 1325.57351    1.45
MarriedUnmarried      0.06626    0.07672 1324.31473    0.86
Wealth_level2        -0.03090    0.08370 1271.71331   -0.37
Wealth_level3        -0.32471    0.12264 1293.93970   -2.65
Wealth_level4        -0.55570    0.26024 1325.78204   -2.14
                               Pr(>|t|)    
(Intercept)        < 0.0000000000000002 ***
IG_Fusion                        0.2318    
IG_Identification                0.0199 *  
OG_Bonds           < 0.0000000000000002 ***
Empathic_concern               0.000001 ***
Perspective_taking               0.7967    
Age                              0.5405    
Female1                          0.0040 ** 
MarriedOther                     0.1474    
MarriedUnmarried                 0.3879    
Wealth_level2                    0.7120    
Wealth_level3                    0.0082 ** 
Wealth_level4                    0.0329 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Display code
tab_model(m11)
  Exp_religious_freedom
Predictors Estimates CI p
(Intercept) 4.59 3.88 – 5.31 <0.001
IG Fusion 0.05 -0.03 – 0.14 0.232
IG Identification 0.11 0.02 – 0.20 0.020
OG Bonds -0.21 -0.25 – -0.17 <0.001
Empathic concern 0.17 0.10 – 0.24 <0.001
Perspective taking -0.01 -0.08 – 0.06 0.797
Age 0.00 -0.00 – 0.01 0.540
Female [1] 0.19 0.06 – 0.32 0.004
Married [Other] 0.23 -0.08 – 0.54 0.147
Married [Unmarried] 0.07 -0.08 – 0.22 0.388
Wealth level [2] -0.03 -0.20 – 0.13 0.712
Wealth level [3] -0.32 -0.57 – -0.08 0.008
Wealth level [4] -0.56 -1.07 – -0.05 0.033
Random Effects
σ2 1.40
τ00 Country 0.10
ICC 0.06
N Country 4
Observations 1339
Marginal R2 / Conditional R2 0.118 / 0.175

Here, marginal R sq is much higher compared to previous model. Adding individual-level predictors significantly increases explanatory power of the model. Again, evidence that most of the variation is at individual-level differences.

Display code
## Change class of all models so we can use stargazer():
class(m10) <- "lmerMod"
class(m11) <- "lmerMod"

## Tabulated results:
stargazer(m10, m11,
          type = "html", 
          star.cutoffs = c(0.05, 0.01, 0.001),
          out = "table1.html")
Display code
htmltools::includeHTML("table1.html")
Dependent variable:
Exp_religious_freedom
(1)(2)
IG_Fusion0.051
(0.043)
IG_Identification0.110*
(0.046)
OG_Bonds-0.210***
(0.023)
Empathic_concern0.170***
(0.035)
Perspective_taking-0.010
(0.038)
Age0.002
(0.003)
Female10.190**
(0.067)
MarriedOther0.230
(0.160)
MarriedUnmarried0.066
(0.077)
Wealth_level2-0.031
(0.084)
Wealth_level3-0.330**
(0.120)
Wealth_level4-0.560*
(0.260)
Constant5.900***4.600***
(0.190)(0.360)
Observations1,5051,339
Log Likelihood-2,542.000-2,152.000
Akaike Inf. Crit.5,090.0004,334.000
Bayesian Inf. Crit.5,106.0004,412.000
Note:*p<0.05; **p<0.01; ***p<0.001

Random intercept models: Imagistic predictors

Display code
## Varying intercept models with individual-level predictors:
m12 <- lmer(Exp_religious_freedom~Event_shared_perception+Event_episodic_recall+
              Event_reflection+Event_positive_affect+Event_negative_affect+
              Event_transformative_indiv+Event_transformative_group+
              Age+Female+Married+Wealth_level+
              (1 | Country), 
            data = ds)

summary(m12)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: 
Exp_religious_freedom ~ Event_shared_perception + Event_episodic_recall +  
    Event_reflection + Event_positive_affect + Event_negative_affect +  
    Event_transformative_indiv + Event_transformative_group +  
    Age + Female + Married + Wealth_level + (1 | Country)
   Data: ds

REML criterion at convergence: 4613

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-3.434 -0.582  0.278  0.730  1.912 

Random effects:
 Groups   Name        Variance Std.Dev.
 Country  (Intercept) 0.134    0.366   
 Residual             1.556    1.247   
Number of obs: 1387, groups:  Country, 4

Fixed effects:
                             Estimate Std. Error         df t value
(Intercept)                   5.96553    0.33347   29.55931   17.89
Event_shared_perception       0.06147    0.02957 1371.99729    2.08
Event_episodic_recall         0.23236    0.03659 1371.17509    6.35
Event_reflection             -0.13355    0.03014 1353.41425   -4.43
Event_positive_affect        -0.09431    0.02008 1370.45600   -4.70
Event_negative_affect        -0.13599    0.01924 1371.67387   -7.07
Event_transformative_indiv    0.00372    0.03050 1371.44255    0.12
Event_transformative_group   -0.06317    0.02822 1370.26891   -2.24
Age                           0.00296    0.00269 1370.52767    1.10
Female1                       0.20508    0.06884 1371.76861    2.98
MarriedOther                  0.33440    0.16674 1371.89308    2.01
MarriedUnmarried              0.16165    0.07966 1369.92439    2.03
Wealth_level2                -0.12293    0.08758 1324.40342   -1.40
Wealth_level3                -0.41244    0.12768 1348.23217   -3.23
Wealth_level4                -0.77496    0.27435 1371.97373   -2.82
                                       Pr(>|t|)    
(Intercept)                < 0.0000000000000002 ***
Event_shared_perception                  0.0378 *  
Event_episodic_recall           0.0000000002923 ***
Event_reflection                0.0000101584195 ***
Event_positive_affect           0.0000028934113 ***
Event_negative_affect           0.0000000000025 ***
Event_transformative_indiv               0.9030    
Event_transformative_group               0.0254 *  
Age                                      0.2717    
Female1                                  0.0029 ** 
MarriedOther                             0.0451 *  
MarriedUnmarried                         0.0426 *  
Wealth_level2                            0.1607    
Wealth_level3                            0.0013 ** 
Wealth_level4                            0.0048 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Display code
tab_model(m12)
  Exp_religious_freedom
Predictors Estimates CI p
(Intercept) 5.97 5.31 – 6.62 <0.001
Event shared perception 0.06 0.00 – 0.12 0.038
Event episodic recall 0.23 0.16 – 0.30 <0.001
Event reflection -0.13 -0.19 – -0.07 <0.001
Event positive affect -0.09 -0.13 – -0.05 <0.001
Event negative affect -0.14 -0.17 – -0.10 <0.001
Event transformative
indiv
0.00 -0.06 – 0.06 0.903
Event transformative
group
-0.06 -0.12 – -0.01 0.025
Age 0.00 -0.00 – 0.01 0.272
Female [1] 0.21 0.07 – 0.34 0.003
Married [Other] 0.33 0.01 – 0.66 0.045
Married [Unmarried] 0.16 0.01 – 0.32 0.043
Wealth level [2] -0.12 -0.29 – 0.05 0.161
Wealth level [3] -0.41 -0.66 – -0.16 0.001
Wealth level [4] -0.77 -1.31 – -0.24 0.005
Random Effects
σ2 1.56
τ00 Country 0.13
ICC 0.08
N Country 4
Observations 1387
Marginal R2 / Conditional R2 0.089 / 0.161

Here, marginal R sq is much higher compared to previous model. Adding individual-level predictors significantly increases explanatory power of the model. Again, evidence that most of the variation is at individual-level differences.

Display code
## Change class of all models so we can use stargazer():
class(m10) <- "lmerMod"
class(m11) <- "lmerMod"
class(m12) <- "lmerMod"

## Tabulated results:
stargazer(m10, m11, m12,
          type = "html", 
          star.cutoffs = c(0.05, 0.01, 0.001),
          out = "table1.html")
Display code
htmltools::includeHTML("table1.html")
Dependent variable:
Exp_religious_freedom
(1)(2)(3)
IG_Fusion0.051
(0.043)
IG_Identification0.110*
(0.046)
OG_Bonds-0.210***
(0.023)
Empathic_concern0.170***
(0.035)
Perspective_taking-0.010
(0.038)
Event_shared_perception0.061*
(0.030)
Event_episodic_recall0.230***
(0.037)
Event_reflection-0.130***
(0.030)
Event_positive_affect-0.094***
(0.020)
Event_negative_affect-0.140***
(0.019)
Event_transformative_indiv0.004
(0.031)
Event_transformative_group-0.063*
(0.028)
Age0.0020.003
(0.003)(0.003)
Female10.190**0.200**
(0.067)(0.069)
MarriedOther0.2300.330*
(0.160)(0.170)
MarriedUnmarried0.0660.160*
(0.077)(0.080)
Wealth_level2-0.031-0.120
(0.084)(0.088)
Wealth_level3-0.330**-0.410**
(0.120)(0.130)
Wealth_level4-0.560*-0.780**
(0.260)(0.270)
Constant5.900***4.600***6.000***
(0.190)(0.360)(0.330)
Observations1,5051,3391,387
Log Likelihood-2,542.000-2,152.000-2,307.000
Akaike Inf. Crit.5,090.0004,334.0004,647.000
Bayesian Inf. Crit.5,106.0004,412.0004,736.000
Note:*p<0.05; **p<0.01; ***p<0.001

Histogram: Experience of Religious Freedom

Display code
df01 <- ds%>% drop_na(Exp_religious_freedom)
summary(df01$Exp_religious_freedom)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    1.0     5.2     6.3     5.8     7.0     7.0 
Display code
ggplot(data = df01, 
       aes(x = Exp_religious_freedom)) +
  geom_histogram(color = "black",
                 bins = 20)+
  xlim(1, 7)+
  geom_textvline(label = "Mean = 5.8", 
                 xintercept = 5.8, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(y = "Frequency",
       x = "Exp_religious_freedom score", 
       title = "Experience of Relgious Freedom")+
  theme_bw()

Display code
ggplot(data = ds, 
       aes(x = Exp_religious_freedom)) +
  geom_histogram(color = "black",
                 bins = 20)+
  xlim(1, 7)+
  labs(y = "Frequency",
       x = "Exp_religious_freedom score", 
       title = "Experience of Religious Freedom")+
  facet_wrap( ~ Country, nrow = 2) +
  theme_bw()

Display code
df01 <- ds %>% drop_na(Exp_religious_freedom)

tbl01 <- aggregate(df01$Exp_religious_freedom, 
                    by=list(df01$Country),
                    FUN=mean)
tbl01$Country <- tbl01$Group.1
tbl01$Exp_religious_freedom <- tbl01$x
tbl01 <- tbl01[, 3:4]
tbl01
   Country Exp_religious_freedom
1   Gambia                   6.2
2 Pakistan                   5.4
3 Tanzania                   5.7
4   Uganda                   6.2
Display code
ggplot(data = df01, 
       aes(x = Exp_religious_freedom, 
           y = Country)) +
  geom_boxplot(color = "black",
               fill = "grey")+
  xlim(1, 7)+
  geom_textvline(label = "Mean = 5.8", 
                 xintercept = 5.8, 
                 vjust = 1.1, 
                 lwd = 1.05, 
                 linetype = 2)+
  labs(y = "",
       x = "Exp_religious_freedom score", 
       title = "Experience of Relgious Freedom")+
  theme_bw()

Section X: Coefficient Plots

Outcome: Social Perception of Religious Freedom

Display code
mp01 <- modelplot(m01,
                  coef_omit = 'SD (Observations)',
                  coef_rename = TRUE) +
  aes(color = ifelse(p.value < 0.05, "Significant", "Not significant")) +
  scale_color_manual(values = c("red", "blue", "black"))+
#  xlim(-3, 3)+
  labs(title = "Social perception of religious freedom", 
       x = "Coefficient estimates with95% CI")+
  geom_vline(xintercept = 0, 
             linetype = 2)

mp01

Display code
mp02 <- modelplot(m02,
                  coef_omit = 'SD (Observations)',
                  coef_rename = TRUE) +
  aes(color = ifelse(p.value < 0.05, "Significant", "Not significant")) +
  scale_color_manual(values = c("red", "blue", "black"))+
#  xlim(-3, 3)+
  labs(title = "Social perception of religious freedom", 
       x = "Coefficient estimates with95% CI")+
  geom_vline(xintercept = 0, 
             linetype = 2)

mp02

Display code
mp01a <- mp01 + theme(legend.position = "none")
ol2 <- mp01a / mp02
ol2

Outcome: Experience of Religious Freedom

Display code
mp11 <- modelplot(m11,
                  coef_omit = 'SD (Observations)',
                  coef_rename = TRUE) +
  aes(color = ifelse(p.value < 0.05, "Significant", "Not significant")) +
  scale_color_manual(values = c("red", "blue", "black"))+
#  xlim(-3, 3)+
  labs(title = "Experience of religious freedom", 
       x = "Coefficient estimates with95% CI")+
  geom_vline(xintercept = 0, 
             linetype = 2)

mp11

Display code
mp12 <- modelplot(m12,
                  coef_omit = 'SD (Observations)',
                  coef_rename = TRUE) +
  aes(color = ifelse(p.value < 0.05, "Significant", "Not significant")) +
  scale_color_manual(values = c("red", "blue", "black"))+
#  xlim(-3, 3)+
  labs(title = "Experience of religious freedom", 
       x = "Coefficient estimates with95% CI")+
  geom_vline(xintercept = 0, 
             linetype = 2)

mp12

Display code
mp11a <- mp11 + theme(legend.position = "none")
ol2a <- mp11a / mp12
ol2a