library(ggplot2)
library(ggthemes)
library(haven)
library(scales)
library(tidyverse)
ggplot_scale <- c("navyblue", "tan4", "chartreuse4", "blueviolet", "blue", "deeppink4", "goldenrod", "violetred", "turquoise2", "lightgreen", "lightpink1", "yellow1", "slategrey", "peachpuff2", "mediumorchid4", "mediumspringgreen", "tomato")
wvs <- read_sav("data/wvs.sav")

wvs_mexjp <- wvs %>% filter(V2 %in% c(484)) # 392 == japan
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    country = ifelse(V2 == 484, "México", "日本")
  )

Dependent Variable

•   V211 Proud of Nationality 
•   Dependent; Continuous

I want to keep it continuous for the integrity of the investigation. But I could make this variable dichotomous to isolate the high or low end just to test my hypothesis for significant associations.

1 Very proud 2 Quite proud 3 Not very proud 4 Not at all proud 5 I am not [French]

V211_lookup <- read_csv('
1,Very proud
2,Quite proud
3,Not very proud
4,Not at all proud
5,I am not from this country
', col_names=c("V211","natlpride"))

wvs_mexjp <- wvs_mexjp %>%
  left_join(V211_lookup)
## Joining, by = "V211"
ggplot(wvs_mexjp) +
  aes(x = natlpride) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "National Pride") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3'), 
        legend.position = "none") +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V211-natlpride.png")
## Saving 7 x 5 in image

Independent Variables

V9 Important: Religion

•   Categorical/Ordinal
•   I’ll dichotomize it by grouping those who say “very important” or “important”, and those who say not important at all (excluding all other responses.)

1,2 = Important 3,4 = Not Important

wvs_mexjp <- wvs_mexjp %>%
  mutate(
    religion_t = ifelse(V9 < 3, 1, 5),
    religion = ifelse(V9 < 3, "Important", "Not Important")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$religion_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$religion_t
## t = -12.639, df = 1997, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.4972207 -0.3636401
## sample estimates:
## mean of the differences 
##              -0.4304304
ggplot(wvs_mexjp) +
  aes(x = religion) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "How Important is Religion?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V9-religion.png")
## Saving 7 x 5 in image

V23 Satisfaction in Life

•   Nominal
•   I’ll bifurcate it to highlight the high and low ends of the spectrum if responses
•   Descriptive, ttest  
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    lifesat_t = ifelse(V23 < 6, 1, 5),
    lifesat = ifelse(V23 < 6, "Meh.", "Alright!")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$lifesat_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$lifesat_t
## t = -118.93, df = 1997, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -3.492084 -3.378786
## sample estimates:
## mean of the differences 
##               -3.435435
ggplot(wvs_mexjp) +
  aes(x = lifesat) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "How Satisfied with Life?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V23-lifesat.png")
## Saving 7 x 5 in image

V32 Inactive/Active Charity

•   Nominal
•   I may need to exclude all responses other than yes or no.
•   Descriptive, ttest
# active, inactive, none
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    charity_t = ifelse(V32 > 0, 2, 1),
    charity = ifelse(V32 > 0, "Yes", "No")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$charity_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$charity_t
## t = 0.91517, df = 1997, p-value = 0.3602
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.01601710  0.04404513
## sample estimates:
## mean of the differences 
##              0.01401401
ggplot(wvs_mexjp) +
  aes(x = charity) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Humanitarian or Charitable Organization?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V32-charity.png")
## Saving 7 x 5 in image

V40 Neighbours: Homosexuals

•   Nominal
•   I’ll dichotomize it by grouping responses at each end of the scale.
•   Descriptive, ttest
# mentioned, not mentioned
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    homos_t = V40,
    homos = ifelse(V40 == 1, "Nope", "Yes plz")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$homos_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$homos_t
## t = -36.639, df = 1997, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.5810741 -0.5220290
## sample estimates:
## mean of the differences 
##              -0.5515516
ggplot(wvs_mexjp) +
  aes(x = homos) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Gay Neighbors?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V40-homos.png")
## Saving 7 x 5 in image

V147 religious person

•   Nominal
•   I’ll dichotomize it to focus on only each end of the scale.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    religious_t = ifelse(V147 > 1, 1, 2),
    religious = ifelse(V147 > 1, "Going to Hell", "Yes")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$religious_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$religious_t
## t = -32.629, df = 1986, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.5617971 -0.4980922
## sample estimates:
## mean of the differences 
##              -0.5299446
ggplot(wvs_mexjp) +
  aes(x = religious) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Is Your House in Order?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V147-religious.png")
## Saving 7 x 5 in image

V79 Tradition Important

•   Nominal
•   I’ll dichotomize it by grouping those who say “very important” or “important”, and those who say not important at all (excluding all other responses.)
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    tradition_t = ifelse(V79 > 3, 2, 1),
    tradition = ifelse(V79 > 3, "Got Change?", "Stuck in the Past")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$tradition_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$tradition_t
## t = 1.7776, df = 1994, p-value = 0.07562
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.00258743  0.05271274
## sample estimates:
## mean of the differences 
##              0.02506266
ggplot(wvs_mexjp) +
  aes(x = tradition) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Customs & Tradition?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V79-tradition.png")
## Saving 7 x 5 in image

V45 When jobs scarce

•   Nominal
•   I’ll dichotomize it by grouping those who agree or agree strongly, and those who disagree or disagree 
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    jobs_t = ifelse(V45 == 2, NA, V45),
    jobs = ifelse(jobs_t == 1, "Yes", "No")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$jobs_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$jobs_t
## t = -62.74, df = 1743, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.433950 -1.347014
## sample estimates:
## mean of the differences 
##               -1.390482
ggplot(wvs_mexjp) +
  aes(x = jobs) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Men have more right to scarce jobs?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V45-jobs.png")
## Saving 7 x 5 in image

V39 Neighbors, Immigrants

•   Nominal
•   I’ll dichotomize it by grouping those who agree or agree strongly, and those who disagree or disagree strongly.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    immigrants_t = V39,
    immigrants = ifelse(immigrants_t == 1, "Noway", "Yes!")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$immigrants_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$immigrants_t
## t = -47.82, df = 1997, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.6955708 -0.6407655
## sample estimates:
## mean of the differences 
##              -0.6681682
ggplot(wvs_mexjp) +
  aes(x = immigrants) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Immigrants as neighbors?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V39-immigrants.png")
## Saving 7 x 5 in image

V55 How much freedom over own life

•   Nominal
•   I’ll dichotomize it by grouping responses at each end of the scale.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    freedom_t = ifelse(V55 > 5, 2, 1),
    freedom = ifelse(freedom_t == 2, "FREE BIRD!", "Ball & Chain")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$freedom_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$freedom_t
## t = -48.81, df = 1988, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.7154174 -0.6601482
## sample estimates:
## mean of the differences 
##              -0.6877828
ggplot(wvs_mexjp) +
  aes(x = freedom) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "How Free do you Feel?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V55-freedom.png")
## Saving 7 x 5 in image

V58 How many children?

•   Scale
•   I don’t think I’ll have to recode this variable
•   Bivariate, Anova

V57 Marital Status

•   Nominal
•   I will bifurcate and reduce the responses to married/single
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    marital_t = ifelse(V57 <= 2, 1, 2),
    marital = ifelse(marital_t == 1, "Yoked", "Escaped!")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$marital_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$marital_t
## t = -9.2079, df = 1997, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1778802 -0.1154131
## sample estimates:
## mean of the differences 
##              -0.1466466
ggplot(wvs_mexjp) +
  aes(x = marital) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Marital Status?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V57-marital.png")
## Saving 7 x 5 in image

V54 Housewife just as fulfilling

•   Nominal
•   I’ll dichotomize it by grouping those who agree or agree strongly, and those who disagree or disagree strongly.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    housewife_t = ifelse(V54 <= 2, 1, 2),
    housewife = ifelse(housewife_t == 1, "I <3 Donna Reed", "Nope")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$housewife_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$housewife_t
## t = -11.989, df = 1956, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.2241554 -0.1611282
## sample estimates:
## mean of the differences 
##              -0.1926418
ggplot(wvs_mexjp) +
  aes(x = housewife) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Housewife?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V54-housewife.png")
## Saving 7 x 5 in image

V53 Men make better business

•   Nominal
•   I’ll dichotomize it by grouping those who agree or agree strongly, and those who disagree or disagree strongly.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    menbiz_t = ifelse(V53 <= 2, 1, 2),
    menbiz = ifelse(menbiz_t == 1, "I <3 Donald Trump!", "Nope")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$menbiz_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$menbiz_t
## t = -39.143, df = 1984, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.6067847 -0.5488828
## sample estimates:
## mean of the differences 
##              -0.5778338
ggplot(wvs_mexjp) +
  aes(x = menbiz) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Men are better at Biz?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V53-menbiz.png")
## Saving 7 x 5 in image

V51 Men make better political

•   Nominal
•   I’ll dichotomize it by grouping those who agree or agree strongly, and those who disagree or disagree strongly.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    menpoli_t = ifelse(V51 <= 2, 1, 2),
    menpoli = ifelse(menpoli_t == 1, "Yes", "No")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$menpoli_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$menpoli_t
## t = -36.428, df = 1978, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.5830985 -0.5235210
## sample estimates:
## mean of the differences 
##              -0.5533098
ggplot(wvs_mexjp) +
  aes(x = menpoli) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Men better Political Leaders?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V51-menpoli.png")
## Saving 7 x 5 in image

V95 Political scale

•   Nominal
•   I’ll create either two groups, left vs right, or three groups: left/left leaning, centrist, and right/right leaning.
•   Bivariate Anova, descriptive ttest
#TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     poli_t = ifelse(V95 <= 2, 1, 2), # Left/Middle/Right
#     poli = ifelse(poli_t == 1, "Yoked", "Escaped!")
#   )
# ANOVA
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = poli) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "Marital Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V95-poli.png")

V144 Religious Denomination

•   Nominal
•   I don’t think I’ll have to recode this variable
•   Bivariate Anova
#TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     denom_t = ifelse(V144 <= 2, 1, 2),
#     denom = ifelse(denom_t == 1, "Yoked", "Escaped!")
#   )
# 
# t.test(wvs_mexjp$V211, wvs_mexjp$denom_t, paired = TRUE, alternative = "two.sided")
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = denom) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "Marital Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V144-denom.png")

V154 Only Acceptable Religion

•   Nominal
•   I may bifurcate responses to focus just on “agree” vs “disagree”.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    relijun_t = ifelse(V154 <= 2, 1, 2),
    relijun = ifelse(relijun_t == 1, "Agree", "Disagree!")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$relijun_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$relijun_t
## t = -22.791, df = 1987, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.3993469 -0.3360656
## sample estimates:
## mean of the differences 
##              -0.3677062
ggplot(wvs_mexjp) +
  aes(x = relijun) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "My Religion is the BEST!") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V154-relijun.png")
## Saving 7 x 5 in image

V170 Secure in neighborhood

•   Nominal
•   I’ll bifurcate it to isolate the high and low ends of the spectrum if responses
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    secure_t = ifelse(V170 <= 2, 1, 2),
    secure = ifelse(secure_t == 1, "Bug in a Rug", "Gunshots!")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$secure_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$secure_t
## t = -7.3686, df = 1997, p-value = 2.512e-13
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.14638686 -0.08484437
## sample estimates:
## mean of the differences 
##              -0.1156156
ggplot(wvs_mexjp) +
  aes(x = secure) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Neighborhood Security?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V170-secure.png")
## Saving 7 x 5 in image

V203 Justifiable: Homosexuality

•   Nominal
•   I’ll dichotomize it by grouping those who say “never” and those who respond in the affirmative.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    okhomo_t = ifelse(V203 <= 4, 1, 2),
    okhomo = ifelse(okhomo_t == 1, "Yes", "No")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$okhomo_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$okhomo_t
## t = -16.637, df = 1956, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.3084600 -0.2434051
## sample estimates:
## mean of the differences 
##              -0.2759325
ggplot(wvs_mexjp) +
  aes(x = okhomo) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Homosexuality OK?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V203-okhomo.png")
## Saving 7 x 5 in image

V41 Neighbors, other religion

•   Nominal
•   I’ll dichotomize it by grouping those who agree or agree strongly, and those who disagree or disagree strongly.
•   Descriptive, ttest
wvs_mexjp <- wvs_mexjp %>%
  mutate(
    neighbors_t = V41,
    neighbors = ifelse(neighbors_t == 1, "No", "Yes!")
  )

t.test(wvs_mexjp$V211, wvs_mexjp$neighbors_t, paired = TRUE, alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  wvs_mexjp$V211 and wvs_mexjp$neighbors_t
## t = -42.967, df = 1997, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.6567978 -0.5994585
## sample estimates:
## mean of the differences 
##              -0.6281281
ggplot(wvs_mexjp) +
  aes(x = neighbors) +
  geom_bar(aes(fill=natlpride), position="dodge") +
  labs(y = "", x="", title = "Neighbors Other Religion?") +
  scale_color_manual(values=ggplot_scale) +
  theme_classic() +
  theme(text = element_text('HiraKakuProN-W3')) +
  coord_flip() +
  facet_wrap(~country)

ggsave("img/V41-neighbors.png")
## Saving 7 x 5 in image

V242 Age

•   Scale
•   I can subdivide variable data into young, middle age, and elderly; under 20, 21-40, 41-50, 51+
•   Bivariate Anova
#TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     age_t = ifelse(V242 <= 2, 1, 2),
#     age = ifelse(age_t == 1, "Yoked", "Escaped!")
#   )
# 
# t.test(wvs_mexjp$V211, wvs_mexjp$age_t, paired = TRUE, alternative = "two.sided")
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = age) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "age Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V242-age.png")

V254 Ethnic Group

•   Nominal
•   I can group by indiginous, minority, or majority
•   Bivariate Anova
#TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     ethn_t = ifelse(V254 <= 2, 1, 2),
#     ethn = ifelse(ethn_t == 1, "Yoked", "Escaped!")
#   )
# 
# t.test(wvs_mexjp$V211, wvs_mexjp$ethn_t, paired = TRUE, alternative = "two.sided")
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = ethn) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "ethn Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V254-ethn.png")

V256 Region

•   Nominal
•   I can group just by rural vs urban or by rural and urban, northern and southern, coastal and inland
•   Bivariate, Anova, descriptive, ttest
#TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     region_t = ifelse(V256 <= 2, 1, 2),
#     region = ifelse(region_t == 1, "Yoked", "Escaped!")
#   )
# 
# t.test(wvs_mexjp$V211, wvs_mexjp$region_t, paired = TRUE, alternative = "two.sided")
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = region) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "region Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V256-region.png")

V238 Social Class

•   Nominal
•   I can subdivide the variable into low, middle, and upper classes
•   Bivariate, Anova
#TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     socclass_t = ifelse(V238 <= 2, 1, 2),
#     socclass = ifelse(socclass_t == 1, "Yoked", "Escaped!")
#   )
# 
# t.test(wvs_mexjp$V211, wvs_mexjp$socclass_t, paired = TRUE, alternative = "two.sided")
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = socclass) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "socclass Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V238-socclass.png")

V239 Income Scale

•   Scale
•   I can subdivide the variable into low, middle, and upper classes
•   Bivariate, Anova
# #TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     income_t = ifelse(V239 <= 2, 1, 2),
#     income = ifelse(income_t == 1, "Yoked", "Escaped!")
#   )
# 
# t.test(wvs_mexjp$V211, wvs_mexjp$income_t, paired = TRUE, alternative = "two.sided")
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = income) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "income Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V239-income.png")

V248 Highest Education

•   Nominal
•   I can separate responses into three groups, no-high school, high school diploma, and college degree
•   Bivariate, Anova
#TODO
# wvs_mexjp <- wvs_mexjp %>%
#   mutate(
#     edu_t = ifelse(V57 <= 2, 1, 2),
#     edu = ifelse(edu_t == 1, "Yoked", "Escaped!")
#   )
# 
# t.test(wvs_mexjp$V211, wvs_mexjp$edu_t, paired = TRUE, alternative = "two.sided")
#TODO
# ggplot(wvs_mexjp) +
#   aes(x = edu) +
#   geom_bar(aes(fill=natlpride), position="dodge") +
#   labs(y = "", x="", title = "edu Status?") +
#   scale_color_manual(values=ggplot_scale) +
#   theme_classic() +
#   theme(text = element_text('HiraKakuProN-W3')) +
#   coord_flip() +
#   facet_wrap(~country)
# 
# ggsave("img/V239-edu.png")