library(tidyverse)
library(haven)
library(labelled)
library(survey)
library(forcats)
library(openxlsx)
library(Hmisc)
library(ggplot2)
library(kableExtra)
library(dplyr)
library(tidyr)
library(stringr)
library(knitr)
library(cregg)
library(scales)
library(readxl)




data_file <- "D:/Populism and Democrary/World value survey/WVS 2017/WVS_Cross-National_Wave_7_Rdata_v6_0.rdata"

stopifnot(file.exists(data_file))


load(data_file)

wvs_raw7 <- `WVS_Cross-National_Wave_7_v6_0`
wvs7 <- wvs_raw7

Country statistics

country_lookup_wvs <- tibble::tribble(
  ~B_COUNTRY, ~country,
  8,   "Albania",
  20,  "Andorra",
  32,  "Argentina",
  51,  "Armenia",
  36,  "Australia",
  40,  "Austria",
  31,  "Azerbaijan",
  50,  "Bangladesh",
  112, "Belarus",
  68,  "Bolivia",
  70,  "Bosnia Herzegovina",
  76,  "Brazil",
  100, "Bulgaria",
  124, "Canada",
  152, "Chile",
  156, "China",
  170, "Colombia",
  191, "Croatia",
  196, "Cyprus",
  203, "Czechia",
  208, "Denmark",
  218, "Ecuador",
  818, "Egypt",
  233, "Estonia",
  231, "Ethiopia",
  246, "Finland",
  250, "France",
  268, "Georgia",
  276, "Germany",
  826, "Great Britain",
  300, "Greece",
  320, "Guatemala",
  344, "Hong Kong SAR",
  348, "Hungary",
  352, "Iceland",
  356, "India",
  360, "Indonesia",
  364, "Iran",
  368, "Iraq",
  380, "Italy",
  392, "Japan",
  400, "Jordan",
  398, "Kazakhstan",
  404, "Kenya",
  410, "South Korea",
  417, "Kyrgyzstan",
  422, "Lebanon",
  428, "Latvia",
  440, "Lithuania",
  434, "Libya",
  446, "Macao SAR",
  458, "Malaysia",
  462, "Maldives",
  484, "Mexico",
  496, "Mongolia",
  499, "Montenegro",
  504, "Morocco",
  104, "Myanmar",
  528, "Netherlands",
  554, "New Zealand",
  558, "Nicaragua",
  566, "Nigeria",
  807, "North Macedonia",
  909, "Northern Ireland",
  578, "Norway",
  586, "Pakistan",
  604, "Peru",
  608, "Philippines",
  616, "Poland",
  620, "Portugal",
  630, "Puerto Rico",
  642, "Romania",
  643, "Russia",
  688, "Serbia",
  702, "Singapore",
  703, "Slovakia",
  705, "Slovenia",
  724, "Spain",
  752, "Sweden",
  756, "Switzerland",
  158, "Taiwan ROC",
  762, "Tajikistan",
  764, "Thailand",
  788, "Tunisia",
  792, "Turkey",
  804, "Ukraine",
  840, "United States",
  858, "Uruguay",
  860, "Uzbekistan",
  862, "Venezuela",
  704, "Vietnam",
  716, "Zimbabwe"
)

country_n <- wvs7 |>
  dplyr::filter(!is.na(B_COUNTRY)) |>
  dplyr::count(B_COUNTRY, name = "n", sort = TRUE) |>
  dplyr::left_join(country_lookup_wvs, by = "B_COUNTRY") |>
  dplyr::relocate(country, .before = B_COUNTRY)

country_year_n <- wvs7 |>
  dplyr::filter(!is.na(B_COUNTRY), !is.na(A_YEAR)) |>
  dplyr::count(B_COUNTRY, A_YEAR, name = "n", sort = TRUE) |>
  dplyr::left_join(country_lookup_wvs, by = "B_COUNTRY") |>
  dplyr::relocate(country, .before = B_COUNTRY)

country_year_n
##             country B_COUNTRY A_YEAR    n
## 1            Canada       124   2020 4018
## 2         Indonesia       360   2018 3200
## 3             China       156   2018 3036
## 4     Great Britain       826   2022 2609
## 5     United States       840   2017 2596
## 6            Turkey       792   2018 2415
## 7       Netherlands       528   2022 2145
## 8     Hong Kong SAR       344   2018 2075
## 9           Bolivia        68   2017 2067
## 10        Singapore       702   2020 2012
## 11         Pakistan       586   2018 1995
## 12        Australia        36   2018 1813
## 13           Russia       643   2017 1810
## 14           Brazil        76   2018 1762
## 15           Mexico       484   2018 1741
## 16            India       356   2023 1692
## 17         Mongolia       496   2020 1638
## 18          Germany       276   2018 1528
## 19         Colombia       170   2018 1520
## 20         Thailand       764   2018 1500
## 21             Iran       364   2020 1499
## 22             Peru       604   2018 1400
## 23            Japan       392   2019 1353
## 24         Malaysia       458   2018 1313
## 25          Ukraine       804   2020 1289
## 26       Kazakhstan       398   2018 1276
## 27            Kenya       404   2021 1266
## 28          Romania       642   2018 1257
## 29       Uzbekistan       860   2022 1250
## 30      South Korea       410   2018 1245
## 31          Nigeria       566   2018 1237
## 32         Ethiopia       231   2020 1230
## 33        Guatemala       320   2020 1229
## 34          Armenia        51   2021 1223
## 35       Taiwan ROC       158   2019 1223
## 36         Zimbabwe       716   2020 1215
## 37          Tunisia       788   2019 1208
## 38           Jordan       400   2018 1203
## 39       Bangladesh        50   2018 1200
## 40          Myanmar       104   2020 1200
## 41          Czechia       203   2022 1200
## 42          Ecuador       218   2018 1200
## 43           Greece       300   2017 1200
## 44             Iraq       368   2018 1200
## 45       Kyrgyzstan       417   2020 1200
## 46          Lebanon       422   2018 1200
## 47          Morocco       504   2021 1200
## 48        Nicaragua       558   2020 1200
## 49      Philippines       608   2019 1200
## 50         Slovakia       703   2022 1200
## 51          Vietnam       704   2020 1200
## 52       Tajikistan       762   2020 1200
## 53            Egypt       818   2018 1200
## 54            Libya       434   2022 1196
## 55        Venezuela       862   2021 1190
## 56      Puerto Rico       630   2018 1127
## 57      New Zealand       554   2020 1057
## 58           Serbia       688   2017 1046
## 59         Maldives       462   2021 1039
## 60        Macao SAR       446   2019 1023
## 61          Andorra        20   2018 1004
## 62        Argentina        32   2017 1003
## 63            Chile       152   2018 1000
## 64           Cyprus       196   2019 1000
## 65          Uruguay       858   2022 1000
## 66 Northern Ireland       909   2022  447

Macro regions

macro_map_prevstyle <- tibble::tribble(
  ~B_COUNTRY, ~country, ~region,

  # India (own category)
  356, "India", "India",

  # South Asia
  586, "Pakistan",   "South Asia",
  50,  "Bangladesh", "South Asia",
  462, "Maldives", "South Asia",

  # East & Southeast Asia
  156, "China",         "East & Southeast Asia",
  344, "Hong Kong SAR", "East & Southeast Asia",
  392, "Japan",         "East & Southeast Asia",
  410, "South Korea",   "East & Southeast Asia",
  158, "Taiwan ROC",    "East & Southeast Asia",
  702, "Singapore",     "East & Southeast Asia",
  458, "Malaysia",      "East & Southeast Asia",
  608, "Philippines",   "East & Southeast Asia",
  764, "Thailand",      "East & Southeast Asia",
  360, "Indonesia",     "East & Southeast Asia",
  496, "Mongolia",      "East & Southeast Asia",
  446, "Macao SAR",     "East & Southeast Asia",
  104, "Myanmar",       "East & Southeast Asia",
  704, "Vietnam",       "East & Southeast Asia",

  # Middle East & North Africa (MENA)
  818, "Egypt",    "Middle East & North Africa (MENA)",
  368, "Iraq",     "Middle East & North Africa (MENA)",
  400, "Jordan",   "Middle East & North Africa (MENA)",
  422, "Lebanon",  "Middle East & North Africa (MENA)",
  434, "Libya",    "Middle East & North Africa (MENA)",
  504, "Morocco",  "Middle East & North Africa (MENA)",
  788, "Tunisia",  "Middle East & North Africa (MENA)",
  792, "Turkey",   "Middle East & North Africa (MENA)",
  364, "Iran",     "Middle East & North Africa (MENA)",

  # Sub-Saharan Africa
  566, "Nigeria",  "Sub-Saharan Africa",
  716, "Zimbabwe", "Sub-Saharan Africa",
  231, "Ethiopia", "Sub-Saharan Africa",
  404, "Kenya",    "Sub-Saharan Africa",

  # Latin America & Caribbean
  32,  "Argentina",  "Latin America & Caribbean",
  68,  "Bolivia",    "Latin America & Caribbean",
  76,  "Brazil",     "Latin America & Caribbean",
  152, "Chile",      "Latin America & Caribbean",
  170, "Colombia",   "Latin America & Caribbean",
  218, "Ecuador",    "Latin America & Caribbean",
  484, "Mexico",     "Latin America & Caribbean",
  604, "Peru",       "Latin America & Caribbean",
  858, "Uruguay",    "Latin America & Caribbean",
  862, "Venezuela",  "Latin America & Caribbean",
  320, "Guatemala",  "Latin America & Caribbean",
  558, "Nicaragua",  "Latin America & Caribbean",
  630, "Puerto Rico","Latin America & Caribbean",

  # Western Europe & Offshoots
  36,  "Australia",       "Western Europe & Offshoots",
  124, "Canada",          "Western Europe & Offshoots",
  840, "United States",   "Western Europe & Offshoots",
  554, "New Zealand",     "Western Europe & Offshoots",
  826, "Great Britain",   "Western Europe & Offshoots",
  909, "Northern Ireland","Western Europe & Offshoots",

  20,  "Andorra",     "Western Europe & Offshoots",
  40,  "Austria",     "Western Europe & Offshoots",
  208, "Denmark",     "Western Europe & Offshoots",
  246, "Finland",     "Western Europe & Offshoots",
  250, "France",      "Western Europe & Offshoots",
  276, "Germany",     "Western Europe & Offshoots",
  300, "Greece",      "Western Europe & Offshoots",
  348, "Hungary",     "Western Europe & Offshoots",
  352, "Iceland",     "Western Europe & Offshoots",
  380, "Italy",       "Western Europe & Offshoots",
  528, "Netherlands", "Western Europe & Offshoots",
  578, "Norway",      "Western Europe & Offshoots",
  620, "Portugal",    "Western Europe & Offshoots",
  724, "Spain",       "Western Europe & Offshoots",
  752, "Sweden",      "Western Europe & Offshoots",
  756, "Switzerland", "Western Europe & Offshoots",
  196, "Cyprus",      "Western Europe & Offshoots",

  # Eastern Europe & Post-Soviet
  8,   "Albania",   "Eastern Europe & Post-Soviet",
  51,  "Armenia",   "Eastern Europe & Post-Soviet",
  31,  "Azerbaijan","Eastern Europe & Post-Soviet",
  112, "Belarus",   "Eastern Europe & Post-Soviet",
  70,  "Bosnia Herzegovina", "Eastern Europe & Post-Soviet",
  191, "Croatia",   "Eastern Europe & Post-Soviet",
  203, "Czechia",   "Eastern Europe & Post-Soviet",
  233, "Estonia",   "Eastern Europe & Post-Soviet",
  268, "Georgia",   "Eastern Europe & Post-Soviet",
  398, "Kazakhstan","Eastern Europe & Post-Soviet",
  417, "Kyrgyzstan","Eastern Europe & Post-Soviet",
  428, "Latvia",    "Eastern Europe & Post-Soviet",
  440, "Lithuania", "Eastern Europe & Post-Soviet",
  499, "Montenegro","Eastern Europe & Post-Soviet",
  616, "Poland",    "Eastern Europe & Post-Soviet",
  642, "Romania",   "Eastern Europe & Post-Soviet",
  643, "Russia",    "Eastern Europe & Post-Soviet",
  688, "Serbia",    "Eastern Europe & Post-Soviet",
  703, "Slovakia",  "Eastern Europe & Post-Soviet",
  705, "Slovenia",  "Eastern Europe & Post-Soviet",
  762, "Tajikistan","Eastern Europe & Post-Soviet",
  804, "Ukraine",   "Eastern Europe & Post-Soviet",
  860, "Uzbekistan","Eastern Europe & Post-Soviet",
  807, "North Macedonia", "Eastern Europe & Post-Soviet"
)

w7_countries <- wvs7 %>%
  distinct(B_COUNTRY) %>%
  filter(!is.na(B_COUNTRY))

# Keep only mapping rows relevant to Wave 7
macro_map_w7 <- macro_map_prevstyle %>%
  semi_join(w7_countries, by = "B_COUNTRY")

# Join macro-region onto the microdata
wvs7 <- wvs7 %>%
  left_join(macro_map_w7 %>% select(B_COUNTRY, macro_region = region), by = "B_COUNTRY")

missing_map <- wvs7 %>%
  distinct(B_COUNTRY) %>%
  left_join(macro_map_w7, by = "B_COUNTRY") %>%
  filter(is.na(region))

missing_map
## [1] B_COUNTRY country   region   
## <0 rows> (or 0-length row.names)
wvs7 %>%
  group_by(macro_region) %>%
  summarise(
    n_respondents = n(),
    n_countries   = n_distinct(B_COUNTRY),
    .groups = "drop"
  ) %>%
  arrange(desc(n_respondents))
## # A tibble: 8 × 3
##   macro_region                      n_respondents n_countries
##   <chr>                                     <int>       <int>
## 1 East & Southeast Asia                     23218          14
## 2 Western Europe & Offshoots                19417          11
## 3 Latin America & Caribbean                 17439          13
## 4 Eastern Europe & Post-Soviet              13951          11
## 5 Middle East & North Africa (MENA)         12321           9
## 6 Sub-Saharan Africa                         4948           4
## 7 South Asia                                 4234           3
## 8 India                                      1692           1

Regional demographics

# Age Cohorts (Q262 = age, X003R = recoded age groups)
wvs7 <- wvs7 %>%
  mutate(
    age = Q262,
    age_group = case_when(
      age < 25 ~ "18–24",
      age < 35 ~ "25–34",
      age < 45 ~ "35–44",
      age < 55 ~ "45–54",
      age < 65 ~ "55–64",
      age >= 65 ~ "65+",
      TRUE ~ NA_character_
    )
  )

age_region <- wvs7 %>%
  filter(!is.na(macro_region), !is.na(age_group)) %>%
  count(macro_region, age_group) %>%
  group_by(macro_region) %>%
  mutate(share = n / sum(n)) %>%
  ungroup()

kable(
  age_region,
  digits = 3,
  caption = "Age-group distribution by macro region (Wave 7)"
)
Age-group distribution by macro region (Wave 7)
macro_region age_group n share
East & Southeast Asia 18–24 2939 0.127
East & Southeast Asia 25–34 4670 0.201
East & Southeast Asia 35–44 4793 0.206
East & Southeast Asia 45–54 4538 0.195
East & Southeast Asia 55–64 3742 0.161
East & Southeast Asia 65+ 2536 0.109
Eastern Europe & Post-Soviet 18–24 1622 0.116
Eastern Europe & Post-Soviet 25–34 2899 0.208
Eastern Europe & Post-Soviet 35–44 2638 0.189
Eastern Europe & Post-Soviet 45–54 2430 0.174
Eastern Europe & Post-Soviet 55–64 2225 0.159
Eastern Europe & Post-Soviet 65+ 2137 0.153
India 18–24 564 0.333
India 25–34 308 0.182
India 35–44 293 0.173
India 45–54 265 0.157
India 55–64 166 0.098
India 65+ 96 0.057
Latin America & Caribbean 18–24 3530 0.202
Latin America & Caribbean 25–34 3818 0.219
Latin America & Caribbean 35–44 3211 0.184
Latin America & Caribbean 45–54 2667 0.153
Latin America & Caribbean 55–64 2253 0.129
Latin America & Caribbean 65+ 1960 0.112
Middle East & North Africa (MENA) 18–24 2011 0.163
Middle East & North Africa (MENA) 25–34 2927 0.238
Middle East & North Africa (MENA) 35–44 2854 0.232
Middle East & North Africa (MENA) 45–54 2257 0.183
Middle East & North Africa (MENA) 55–64 1628 0.132
Middle East & North Africa (MENA) 65+ 644 0.052
South Asia 18–24 749 0.177
South Asia 25–34 1311 0.310
South Asia 35–44 1115 0.263
South Asia 45–54 592 0.140
South Asia 55–64 330 0.078
South Asia 65+ 137 0.032
Sub-Saharan Africa 18–24 1390 0.281
Sub-Saharan Africa 25–34 1689 0.341
Sub-Saharan Africa 35–44 938 0.190
Sub-Saharan Africa 45–54 494 0.100
Sub-Saharan Africa 55–64 260 0.053
Sub-Saharan Africa 65+ 177 0.036
Western Europe & Offshoots 18–24 1763 0.091
Western Europe & Offshoots 25–34 3215 0.166
Western Europe & Offshoots 35–44 3236 0.167
Western Europe & Offshoots 45–54 3377 0.174
Western Europe & Offshoots 55–64 3360 0.173
Western Europe & Offshoots 65+ 4466 0.230
# Gender (Q260)
wvs7 <- wvs7 %>%
  mutate(
    gender = case_when(
      Q260 == 1 ~ "Male",
      Q260 == 2 ~ "Female",
      TRUE ~ NA_character_
    )
  )

gender_region <- wvs7 %>%
  filter(!is.na(macro_region), !is.na(gender)) %>%
  count(macro_region, gender) %>%
  group_by(macro_region) %>%
  mutate(share = n / sum(n)) %>%
  ungroup()

gender_region
## # A tibble: 16 × 4
##    macro_region                      gender     n share
##    <chr>                             <chr>  <int> <dbl>
##  1 East & Southeast Asia             Female 12383 0.534
##  2 East & Southeast Asia             Male   10825 0.466
##  3 Eastern Europe & Post-Soviet      Female  7933 0.569
##  4 Eastern Europe & Post-Soviet      Male    6018 0.431
##  5 India                             Female   734 0.434
##  6 India                             Male     958 0.566
##  7 Latin America & Caribbean         Female  9249 0.530
##  8 Latin America & Caribbean         Male    8188 0.470
##  9 Middle East & North Africa (MENA) Female  6133 0.498
## 10 Middle East & North Africa (MENA) Male    6186 0.502
## 11 South Asia                        Female  2113 0.500
## 12 South Asia                        Male    2117 0.500
## 13 Sub-Saharan Africa                Female  2449 0.496
## 14 Sub-Saharan Africa                Male    2492 0.504
## 15 Western Europe & Offshoots        Female 10136 0.524
## 16 Western Europe & Offshoots        Male    9211 0.476
# Immigrant status (Q263 = self-born in country)
wvs7 <- wvs7 %>%
  mutate(
    immigrant_status = case_when(
      Q263 == 1 ~ "Native",
      Q263 == 2 ~ "Immigrant",
      TRUE ~ NA_character_
    )
  )

immigrant_region <- wvs7 %>%
  filter(!is.na(macro_region), !is.na(immigrant_status)) %>%
  count(macro_region, immigrant_status) %>%
  group_by(macro_region) %>%
  mutate(share = n / sum(n)) %>%
  ungroup()

immigrant_region
## # A tibble: 15 × 4
##    macro_region                      immigrant_status     n   share
##    <chr>                             <chr>            <int>   <dbl>
##  1 East & Southeast Asia             Immigrant         1447 0.0624 
##  2 East & Southeast Asia             Native           21736 0.938  
##  3 Eastern Europe & Post-Soviet      Immigrant          484 0.0347 
##  4 Eastern Europe & Post-Soviet      Native           13448 0.965  
##  5 India                             Native            1692 1      
##  6 Latin America & Caribbean         Immigrant          240 0.0138 
##  7 Latin America & Caribbean         Native           17173 0.986  
##  8 Middle East & North Africa (MENA) Immigrant          212 0.0172 
##  9 Middle East & North Africa (MENA) Native           12106 0.983  
## 10 South Asia                        Immigrant           13 0.00307
## 11 South Asia                        Native            4221 0.997  
## 12 Sub-Saharan Africa                Immigrant           19 0.00384
## 13 Sub-Saharan Africa                Native            4925 0.996  
## 14 Western Europe & Offshoots        Immigrant         3246 0.170  
## 15 Western Europe & Offshoots        Native           15874 0.830
# Missingness check
wvs7 %>%
  summarise(
    missing_age = sum(is.na(Q262)),
    missing_gender = sum(is.na(Q260)),
    missing_immigrant = sum(is.na(Q263))
  )
##   missing_age missing_gender missing_immigrant
## 1           0              0                 0
table(wvs7$Q263, useNA = "always")
## 
##    -5    -2    -1     1     2  <NA> 
##   186   157    41 91175  5661     0
# Missingness by macro_region
wvs7 %>%
  group_by(macro_region) %>%
  summarise(
    n_obs = n(),
    missing_age = sum(is.na(Q262)),
    missing_gender = sum(is.na(Q260)),
    missing_immigrant = sum(is.na(Q263))
  )
## # A tibble: 8 × 5
##   macro_region                n_obs missing_age missing_gender missing_immigrant
##   <chr>                       <int>       <int>          <int>             <int>
## 1 East & Southeast Asia       23218           0              0                 0
## 2 Eastern Europe & Post-Sovi… 13951           0              0                 0
## 3 India                        1692           0              0                 0
## 4 Latin America & Caribbean   17439           0              0                 0
## 5 Middle East & North Africa… 12321           0              0                 0
## 6 South Asia                   4234           0              0                 0
## 7 Sub-Saharan Africa           4948           0              0                 0
## 8 Western Europe & Offshoots  19417           0              0                 0

Macro-region analysis (Economic system)

# Economic values (Wave 7: Q106-Q111)
likert_vars <- paste0("Q", 106:111)

wvs7 <- wvs7 %>%
  mutate(across(all_of(likert_vars), ~ifelse(.x < 0, NA, .x)))

# keep valid cases (non-missing macro_region + at least one likert var)
wvs_clean <- wvs7 %>%
  filter(!is.na(macro_region))

svy_design <- svydesign(
  ids = ~1,
  weights = ~W_WEIGHT,  # Wave 7 weight (like V258)
  data = wvs_clean
)

# Country-level means first
country_means <- lapply(likert_vars, function(v){
  
  svyby(
    as.formula(paste0("~", v)),
    ~B_COUNTRY + macro_region,  # B_COUNTRY instead of V2
    svy_design,
    svymean,
    na.rm = TRUE
  ) %>%
    rename(country_mean = 3) %>%
    mutate(variable = v)
  
}) %>% bind_rows()

# Region means (country-weighted)
region_means_country_weighted <- country_means %>%
  group_by(macro_region, variable) %>%
  summarise(
    mean = mean(country_mean, na.rm = TRUE),
    n_countries = n(),
    .groups = "drop"
  )

# Updated labels for Wave 7 economic values
var_labels <- c(
  Q106 = "Income equality vs Inequality incentives (1=More equal, 10=Larger differences)",
  Q107 = "Private vs government ownership of business (1=Private, 10=Government)",
  Q108 = "Government vs individual responsibility (1=Government, 10=Individuals)",
  Q109 = "Competition good vs harmful (1=Good, 10=Harmful)",
  Q110 = "Success: hard work vs luck (1=Hard work, 10=Luck/connections)",
  Q111 = "Environment vs economic growth (1=Protect env, 2=Economic growth)"
)
for(v in likert_vars){

  temp_table <- region_means_country_weighted %>%
    filter(variable == v) %>%
    select(macro_region, mean, n_countries) %>%
    arrange(mean)

  print(
    kable(
      temp_table,
      digits = 2,
      col.names = c("Macro Region",
                    "Mean (country-weighted, 1–10)",
                    "N countries"),
      caption = paste("Regional comparison:", var_labels[v]),
      format = "html"
    ) %>%
      kable_styling(full_width = FALSE)
  )

  cat("<br><br>")
}
Regional comparison: Income equality vs Inequality incentives (1=More equal, 10=Larger differences)
Macro Region Mean (country-weighted, 1–10) N countries
South Asia 5.43 3
Western Europe & Offshoots 5.61 11
Latin America & Caribbean 6.14 13
Middle East & North Africa (MENA) 6.33 9
East & Southeast Asia 6.43 14
Sub-Saharan Africa 6.70 4
India 7.14 1
Eastern Europe & Post-Soviet 7.23 11


Regional comparison: Private vs government ownership of business (1=Private, 10=Government)
Macro Region Mean (country-weighted, 1–10) N countries
Western Europe & Offshoots 4.85 11
South Asia 5.26 3
East & Southeast Asia 5.59 14
Sub-Saharan Africa 5.77 4
Latin America & Caribbean 5.77 13
Middle East & North Africa (MENA) 5.95 9
Eastern Europe & Post-Soviet 6.13 11
India 6.43 1


Regional comparison: Government vs individual responsibility (1=Government, 10=Individuals)
Macro Region Mean (country-weighted, 1–10) N countries
Sub-Saharan Africa 4.24 4
Middle East & North Africa (MENA) 4.45 9
South Asia 4.62 3
Western Europe & Offshoots 4.90 11
Eastern Europe & Post-Soviet 4.97 11
East & Southeast Asia 5.30 14
Latin America & Caribbean 5.36 13
India 5.37 1


Regional comparison: Competition good vs harmful (1=Good, 10=Harmful)
Macro Region Mean (country-weighted, 1–10) N countries
Sub-Saharan Africa 3.28 4
Western Europe & Offshoots 3.73 11
South Asia 3.90 3
Middle East & North Africa (MENA) 3.90 9
Eastern Europe & Post-Soviet 3.92 11
East & Southeast Asia 4.17 14
Latin America & Caribbean 4.55 13
India 5.11 1


Regional comparison: Success: hard work vs luck (1=Hard work, 10=Luck/connections)
Macro Region Mean (country-weighted, 1–10) N countries
Sub-Saharan Africa 3.22 4
South Asia 3.60 3
East & Southeast Asia 4.41 14
Latin America & Caribbean 4.52 13
Middle East & North Africa (MENA) 4.57 9
India 4.58 1
Western Europe & Offshoots 4.69 11
Eastern Europe & Post-Soviet 4.89 11


Regional comparison: Environment vs economic growth (1=Protect env, 2=Economic growth)
Macro Region Mean (country-weighted, 1–10) N countries
Western Europe & Offshoots 1.39 11
East & Southeast Asia 1.43 14
Latin America & Caribbean 1.44 13
India 1.46 1
Sub-Saharan Africa 1.53 4
Eastern Europe & Post-Soviet 1.53 11
Middle East & North Africa (MENA) 1.55 9
South Asia 1.55 3



And again the results are amazing, pretty much what we discussed. This also aligns with the results we see in PALS survey. Over the years from 2012 to 2022 India has seen a complete shift in most of the questions where India was lowest in terms of regional average in 2012, it has completely turnaround in 2022, where India has highest regional averages.

Macro region analysis (democratic system)

# Democratic system variables 
demo_vars <- paste0("Q", 240:250)

# remove invalid codes (-1 to -5)
wvs7 <- wvs7 %>%
  mutate(across(all_of(demo_vars), ~ifelse(.x < 0, NA, .x)))

# keep valid cases
wvs_clean_demo <- wvs7 %>%
  filter(!is.na(macro_region))

# survey design
svy_design_demo <- svydesign(
  ids = ~1,
  weights = ~W_WEIGHT,
  data = wvs_clean_demo
)

# SURVEY-WEIGHTED COUNTRY MEANS
country_means_demo <- lapply(demo_vars, function(v){

  svyby(
    as.formula(paste0("~", v)),
    ~B_COUNTRY + macro_region,
    svy_design_demo,
    svymean,
    na.rm = TRUE
  ) %>%
    rename(country_mean = 3) %>%
    mutate(variable = v)

}) %>% bind_rows()

# MACRO REGION AVERAGE OF COUNTRY MEANS
region_means_demo <- country_means_demo %>%
  group_by(macro_region, variable) %>%
  summarise(
    mean = mean(country_mean, na.rm = TRUE),
    n_countries = n(),
    .groups = "drop"
  )


demo_labels <- c(
  Q240  = "Political self-placement (1=Left, 10=Right)",
  Q241  = "Democracy: Taxing rich & subsidizing poor (1=Not essential, 10=Essential)",
  Q242  = "Democracy: Religious authorities interpret laws (1=Not essential, 10=Essential)",
  Q243  = "Democracy: Free elections for leaders (1=Not essential, 10=Essential)",
  Q244  = "Democracy: State aid for unemployment (1=Not essential, 10=Essential)",
  Q245  = "Democracy: Army takeover when govt incompetent (1=Not essential, 10=Essential)",
  Q246  = "Democracy: Civil rights protect against oppression (1=Not essential, 10=Essential)",
  Q247  = "Democracy: State makes incomes equal (1=Not essential, 10=Essential)",
  Q248  = "Democracy: People obey rulers (1=Not essential, 10=Essential)",
  Q249  = "Democracy: Women equal rights (1=Not essential, 10=Essential)",
  Q250  = "Importance of democratic country (1=Not important, 10=Absolutely)"
)
for(v in demo_vars){

  temp_table <- region_means_demo %>%
    filter(variable == v) %>%
    select(macro_region, mean, n_countries) %>%
    arrange(desc(mean))

  print(
    kable(
      temp_table,
      digits = 2,
      col.names = c("Macro Region",
                    "Mean (country-weighted, 1–10)",
                    "N countries"),
      caption = paste("Regional comparison:", demo_labels[v]),
      format = "html"
    ) %>%
      kable_styling(full_width = FALSE)
  )

  cat("<br><br>")
}
Regional comparison: Political self-placement (1=Left, 10=Right)
Macro Region Mean (country-weighted, 1–10) N countries
India 6.38 1
Sub-Saharan Africa 5.85 4
Latin America & Caribbean 5.67 13
Western Europe & Offshoots 5.24 11
East & Southeast Asia 4.40 14
South Asia 4.38 3
Eastern Europe & Post-Soviet 4.26 11
Middle East & North Africa (MENA) 2.65 9


Regional comparison: Democracy: Taxing rich & subsidizing poor (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
South Asia 7.46 3
Middle East & North Africa (MENA) 7.13 9
India 6.92 1
Eastern Europe & Post-Soviet 6.52 11
Western Europe & Offshoots 6.39 11
East & Southeast Asia 6.33 14
Sub-Saharan Africa 5.99 4
Latin America & Caribbean 5.40 13


Regional comparison: Democracy: Religious authorities interpret laws (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
South Asia 6.63 3
Middle East & North Africa (MENA) 5.17 9
Sub-Saharan Africa 4.82 4
Latin America & Caribbean 4.25 13
Eastern Europe & Post-Soviet 4.18 11
East & Southeast Asia 4.09 14
India 3.72 1
Western Europe & Offshoots 2.57 11


Regional comparison: Democracy: Free elections for leaders (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
Western Europe & Offshoots 8.84 11
South Asia 8.42 3
Sub-Saharan Africa 8.05 4
Eastern Europe & Post-Soviet 7.93 11
India 7.91 1
Middle East & North Africa (MENA) 7.88 9
Latin America & Caribbean 7.69 13
East & Southeast Asia 7.48 14


Regional comparison: Democracy: State aid for unemployment (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
Eastern Europe & Post-Soviet 7.34 11
Western Europe & Offshoots 7.30 11
South Asia 7.25 3
Middle East & North Africa (MENA) 7.12 9
India 7.04 1
Sub-Saharan Africa 6.98 4
East & Southeast Asia 6.60 14
Latin America & Caribbean 6.28 13


Regional comparison: Democracy: Army takeover when govt incompetent (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
South Asia 6.45 3
Sub-Saharan Africa 5.55 4
Eastern Europe & Post-Soviet 5.10 11
India 4.84 1
Latin America & Caribbean 4.72 13
East & Southeast Asia 4.62 14
Middle East & North Africa (MENA) 4.41 9
Western Europe & Offshoots 2.95 11


Regional comparison: Democracy: Civil rights protect against oppression (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
Western Europe & Offshoots 8.00 11
South Asia 7.69 3
Sub-Saharan Africa 7.60 4
Eastern Europe & Post-Soviet 7.56 11
Middle East & North Africa (MENA) 7.38 9
India 7.37 1
East & Southeast Asia 7.04 14
Latin America & Caribbean 6.69 13


Regional comparison: Democracy: State makes incomes equal (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
South Asia 7.07 3
Middle East & North Africa (MENA) 6.80 9
Eastern Europe & Post-Soviet 6.39 11
India 6.29 1
East & Southeast Asia 6.08 14
Sub-Saharan Africa 5.69 4
Latin America & Caribbean 5.39 13
Western Europe & Offshoots 5.03 11


Regional comparison: Democracy: People obey rulers (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
South Asia 7.93 3
Sub-Saharan Africa 7.63 4
India 6.44 1
Middle East & North Africa (MENA) 6.16 9
Eastern Europe & Post-Soviet 6.13 11
East & Southeast Asia 5.57 14
Latin America & Caribbean 5.51 13
Western Europe & Offshoots 4.94 11


Regional comparison: Democracy: Women equal rights (1=Not essential, 10=Essential)
Macro Region Mean (country-weighted, 1–10) N countries
Western Europe & Offshoots 8.98 11
Eastern Europe & Post-Soviet 8.12 11
India 8.04 1
South Asia 8.03 3
Latin America & Caribbean 7.82 13
East & Southeast Asia 7.76 14
Sub-Saharan Africa 7.61 4
Middle East & North Africa (MENA) 7.24 9


Regional comparison: Importance of democratic country (1=Not important, 10=Absolutely)
Macro Region Mean (country-weighted, 1–10) N countries
Western Europe & Offshoots 8.91 11
Sub-Saharan Africa 8.61 4
India 8.43 1
Latin America & Caribbean 8.37 13
East & Southeast Asia 8.19 14
Eastern Europe & Post-Soviet 8.17 11
Middle East & North Africa (MENA) 8.16 9
South Asia 7.96 3



Macro region analysis (value system)

Neighbours

# Neighbors rejection items (Wave 7: Q27-Q35)
neigh_vars <- paste0("Q", 27:35)

# Clean negative codes
wvs7 <- wvs7 %>%
  mutate(across(all_of(neigh_vars), ~ifelse(.x < 0, NA, .x)))

wvs_clean_neigh <- wvs7 %>%
  filter(!is.na(macro_region))

svy_design_neigh <- svydesign(
  ids = ~1, 
  weights = ~W_WEIGHT,  
  data = wvs_clean_neigh
)

# SURVEY-WEIGHTED COUNTRY % rejecting each group
country_prop_neigh <- lapply(neigh_vars, function(v){
  
  svyby(
    as.formula(paste0("~I(", v, " == 1)")),  # 1 if rejected (mentioned), 0 otherwise
    ~B_COUNTRY + macro_region,  # V2 → B_COUNTRY
    svy_design_neigh,
    svymean,
    na.rm = TRUE
  ) %>%
    rename(country_prop = 3) %>%
    mutate(variable = v)
  
}) %>% bind_rows()

# MACRO REGION AVERAGE OF COUNTRY PROPORTIONS
region_prop_neigh <- country_prop_neigh %>%
  group_by(macro_region, variable) %>%
  summarise(
    mean_prop = mean(country_prop, na.rm = TRUE),
    n_countries = n(),
    .groups = "drop"
  )

# Labels for Wave 7 "Undesirable neighbors" (Q27-Q35)
neigh_labels <- c(
  Q27 = "Drug addicts",
  Q28 = "Alcoholics",
  Q29 = "People with AIDS",
  Q30 = "Homosexuals",
  Q31 = "Immigrants/foreign workers",
  Q32 = "Different race",
  Q33 = "Different religion",
  Q34 = "Different language",
  Q35 = "Other countries"
)
for(v in neigh_vars){

  temp_table <- region_prop_neigh %>%
    filter(variable == v) %>%
    mutate(mean_prop = round(mean_prop * 100, 1)) %>%  # Convert to %
    select(macro_region, mean_prop, n_countries) %>%
    arrange(desc(mean_prop))

  print(
    kable(
      temp_table,
      digits = 1,
      col.names = c("Macro Region",
                    "% Rejecting (country-weighted)",
                    "N countries"),
      caption = paste("Undesirable neighbors:", neigh_labels[v]),
      format = "html"
    ) %>%
      kable_styling(full_width = FALSE)
  )

  cat("<br><br>")
}
Undesirable neighbors: Drug addicts
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 72.4 11
East & Southeast Asia 61.1 14
Eastern Europe & Post-Soviet 49.9 11
Latin America & Caribbean 48.4 13
Middle East & North Africa (MENA) 24.9 9
Sub-Saharan Africa 24.1 4
India 19.8 1
South Asia 16.0 3


Undesirable neighbors: Alcoholics
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 94.7 11
East & Southeast Asia 90.1 14
Eastern Europe & Post-Soviet 88.3 11
Sub-Saharan Africa 86.0 4
Latin America & Caribbean 85.1 13
Middle East & North Africa (MENA) 69.2 9
South Asia 66.2 3
India 65.2 1


Undesirable neighbors: People with AIDS
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 97.2 11
Latin America & Caribbean 95.2 13
East & Southeast Asia 87.3 14
Eastern Europe & Post-Soviet 79.5 11
Sub-Saharan Africa 75.6 4
India 75.5 1
Middle East & North Africa (MENA) 68.2 9
South Asia 67.0 3


Undesirable neighbors: Homosexuals
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 98.7 11
Latin America & Caribbean 95.4 13
East & Southeast Asia 91.7 14
Sub-Saharan Africa 88.5 4
Middle East & North Africa (MENA) 87.5 9
Eastern Europe & Post-Soviet 86.4 11
India 83.0 1
South Asia 79.0 3


Undesirable neighbors: Immigrants/foreign workers
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 97.8 11
Latin America & Caribbean 96.3 13
East & Southeast Asia 90.0 14
Sub-Saharan Africa 83.1 4
Eastern Europe & Post-Soviet 81.8 11
India 78.2 1
Middle East & North Africa (MENA) 76.2 9
South Asia 69.8 3


Undesirable neighbors: Different race
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 82.0 11
Sub-Saharan Africa 81.8 4
East & Southeast Asia 80.9 14
Eastern Europe & Post-Soviet 78.4 11
Latin America & Caribbean 77.8 13
India 73.2 1
South Asia 69.5 3
Middle East & North Africa (MENA) 68.6 9


Undesirable neighbors: Different religion
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 96.6 11
Latin America & Caribbean 94.6 13
East & Southeast Asia 85.3 14
Sub-Saharan Africa 84.5 4
Eastern Europe & Post-Soviet 77.7 11
India 65.5 1
Middle East & North Africa (MENA) 55.8 9
South Asia 53.0 3


Undesirable neighbors: Different language
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 83.8 11
Latin America & Caribbean 79.7 13
Sub-Saharan Africa 69.1 4
East & Southeast Asia 64.9 14
Eastern Europe & Post-Soviet 57.1 11
India 47.7 1
Middle East & North Africa (MENA) 36.0 9
South Asia 35.4 3


Undesirable neighbors: Other countries
Macro Region % Rejecting (country-weighted) N countries
Western Europe & Offshoots 97.4 11
East & Southeast Asia 93.4 14
Latin America & Caribbean 90.7 13
Eastern Europe & Post-Soviet 85.7 11
Sub-Saharan Africa 81.7 4
Middle East & North Africa (MENA) 79.2 9
India 71.5 1
South Asia 70.9 3