knitr::opts_chunk$set(echo = TRUE,
message = F,
warning = F)
library(tidyverse)
library(here)
library(RColorBrewer)
library(janitor)
library(psych)
library(ggtext)
library(knitr)
library(kableExtra)
library(forcats)
library(gtools)
library(ggrepel)
library(DT)
library(papeR)
library(compareGroups)
library(ggcorrplot)
cb_colors = brewer.pal(n = 8, name = "Dark2")
custom_theme = theme_minimal() +
theme(strip.text = element_text(size = 16),
axis.text=element_text(size=16),
axis.title=element_text(size=16,face="bold"),
panel.spacing = unit(1, "lines"),
legend.title = element_text(size=16,face="bold"),
legend.text = element_text(size=16),
plot.title = element_text(size = 20, face = "bold"),
plot.title.position = "plot",
plot.subtitle = element_text(size = 16),
plot.caption = element_text(size = 16))
df_full = read.csv("Share_Your_Voice_2023_01_11_19_08_50.csv")
df_retarget = df_full %>%
filter(pilot_version == 'retarget_pilot_regular_ads')
Question: On a scale from 1 to 5, how much would you say you trust the follwing people or organizations to give you good information about the vaccine?
Takeaway:
df_retarget =
df_retarget %>%
mutate(
vax_status_retarget = case_when(
num_dose == "0" ~ 0,
num_dose %in% c("1", "2", "3") ~ 1
),
vax_status_retarget_4 = case_when(
num_dose == "0" ~ 0,
num_dose == "1" ~ 1,
num_dose == "2" ~ 2,
num_dose == "3" ~ 3
)
)
df_retarget$vax_status_retarget = factor(df_retarget$vax_status_retarget, levels = c(0, 1))
df_retarget$vax_status_retarget_4 = factor(df_retarget$vax_status_retarget_4, levels = c(0,1,2,3))
df_retarget$country_answer[!df_retarget$country_answer %in% c("South Africa","Kenya","Nigeria","Ghana")] = NA
df_retarget$country_answer = factor(df_retarget$country_answer, levels = c("South Africa","Kenya","Nigeria","Ghana"))
df_retarget = df_retarget %>% filter(!is.na(country_answer))
## clean data
df_retarget$doctor[!df_retarget$doctor %in% c("1","2","3","4","5")] = NA
df_retarget$doctor = strtoi(df_retarget$doctor)
df_retarget$family[!df_retarget$family %in% c("1","2","3","4","5")] = NA
df_retarget$family = strtoi(df_retarget$family)
df_retarget$friends[!df_retarget$friends %in% c("1","2","3","4","5")] = NA
df_retarget$friends = strtoi(df_retarget$friends)
df_retarget$minister_religious_leader[!df_retarget$minister_religious_leader %in% c("1","2","3","4","5")] = NA
df_retarget$minister_religious_leader = strtoi(df_retarget$minister_religious_leader)
df_retarget$community_leader[!df_retarget$community_leader %in% c("1","2","3","4","5")] = NA
df_retarget$community_leader = strtoi(df_retarget$community_leader)
df_retarget$clinic_worker[!df_retarget$clinic_worker %in% c("1","2","3","4","5")] = NA
df_retarget$clinic_worker = strtoi(df_retarget$clinic_worker)
df_retarget$community_based_org[!df_retarget$community_based_org %in% c("1","2","3","4","5")] = NA
df_retarget$community_based_org = strtoi(df_retarget$community_based_org)
df_retarget$health_department[!df_retarget$health_department %in% c("1","2","3","4","5")] = NA
df_retarget$health_department = strtoi(df_retarget$health_department)
df_retarget$WHO[!df_retarget$WHO %in% c("1","2","3","4","5")] = NA
df_retarget$WHO = strtoi(df_retarget$WHO)
df_retarget$african_scientist[!df_retarget$african_scientist %in% c("1","2","3","4","5")] = NA
df_retarget$african_scientist = strtoi(df_retarget$african_scientist)
df_retarget$international_scientist[!df_retarget$international_scientist %in% c("1","2","3","4","5")] = NA
df_retarget$international_scientist = strtoi(df_retarget$international_scientist)
df_retarget$international_ngo[!df_retarget$international_ngo %in% c("1","2","3","4","5")] = NA
df_retarget$international_ngo = strtoi(df_retarget$international_ngo)
df_retarget$local_news_media[!df_retarget$local_news_media %in% c("1","2","3","4","5")] = NA
df_retarget$local_news_media = strtoi(df_retarget$local_news_media)
df_retarget$international_news_media[!df_retarget$international_news_media %in% c("1","2","3","4","5")] = NA
df_retarget$international_news_media = strtoi(df_retarget$international_news_media)
Note: Sort by Mean
df_retarget %>%
#select_if(is.numeric) %>%
select(doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>%
describe(quant = c(.25,.75) ) %>%
select(n, mean, sd, se, min, min, first_quartile = Q0.25, median, third_quartile = Q0.75, max) %>%
clean_names(case = "title") %>%
rename(SD = Sd, SE = Se) %>%
arrange(desc(Mean)) %>%
kable(caption = "Summary Statistics for 'Who do they trust'", digits = 3)%>%
kable_styling(bootstrap_options = c("striped", "hover")) %>%
row_spec(c(1,2,3,4,5,6,8,9,12,13), bold = T, color = "black", background = "lightgrey")
| N | Mean | SD | SE | Min | First Quartile | Median | Third Quartile | Max | |
|---|---|---|---|---|---|---|---|---|---|
| WHO | 1521 | 3.862 | 1.492 | 0.038 | 1 | 3 | 5 | 5 | 5 |
| doctor | 1602 | 3.721 | 1.443 | 0.036 | 1 | 3 | 4 | 5 | 5 |
| Department of Health | 1526 | 3.635 | 1.504 | 0.039 | 1 | 2 | 4 | 5 | 5 |
| Local Health Clinic Worker | 1544 | 3.498 | 1.384 | 0.035 | 1 | 2 | 4 | 5 | 5 |
| International Scientists | 1509 | 3.318 | 1.486 | 0.038 | 1 | 2 | 4 | 5 | 5 |
| African scientists | 1517 | 3.178 | 1.457 | 0.037 | 1 | 2 | 3 | 5 | 5 |
| family | 1580 | 3.175 | 1.482 | 0.037 | 1 | 2 | 3 | 5 | 5 |
| International NGOs | 1500 | 3.096 | 1.394 | 0.036 | 1 | 2 | 3 | 4 | 5 |
| Community-Based Organizations | 1531 | 2.937 | 1.370 | 0.035 | 1 | 2 | 3 | 4 | 5 |
| International News/Media | 1493 | 2.903 | 1.388 | 0.036 | 1 | 2 | 3 | 4 | 5 |
| Local News/Media | 1496 | 2.721 | 1.381 | 0.036 | 1 | 1 | 3 | 4 | 5 |
| Ministers/Religious Leaders | 1561 | 2.689 | 1.442 | 0.036 | 1 | 1 | 3 | 4 | 5 |
| Community Leaders | 1553 | 2.459 | 1.336 | 0.034 | 1 | 1 | 2 | 3 | 5 |
| friends | 1568 | 2.416 | 1.300 | 0.033 | 1 | 1 | 2 | 3 | 5 |
Note: Sort by South Africa-Mean
df_retarget %>%
select(country_answer, doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>%
split(.$country_answer) %>%
map(describe) %>%
do.call(rbind, .) %>%
data.frame() %>%
select(n, mean , se) %>%
rownames_to_column() %>%
separate(rowname, c("country_answer", "variable"), sep = "\\.") %>%
filter(variable != "country_answer*") %>%
pivot_longer(cols = c("n", "mean", "se")) %>%
mutate(column = paste(country_answer, name, sep = "_")) %>%
select(column, variable, value) %>%
pivot_wider(names_from = column) %>%
arrange(desc(`South Africa_mean`)) %>%
kable(digits = 3,caption = "Summary Statistics for Trust Variables by Country",
col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
kable_styling(bootstrap_options = c("striped", "hover")) %>%
add_header_above(c(" " = 1, "South Africa" = 3, "Kenya" = 3, "Nigeria" = 3, "Ghana" = 3)) %>%
row_spec(c(1,2,3,4,6,7,8,9,12,13), bold = T, color = "black", background = "lightgrey")
| N | Mean | SE | N | Mean | SE | N | Mean | SE | N | Mean | SE | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| doctor | 435 | 3.667 | 0.073 | 408 | 3.652 | 0.075 | 334 | 3.793 | 0.075 | 425 | 3.786 | 0.066 |
| WHO | 409 | 3.592 | 0.081 | 400 | 3.902 | 0.072 | 319 | 4.163 | 0.073 | 393 | 3.858 | 0.075 |
| Local Health Clinic Worker | 417 | 3.585 | 0.070 | 402 | 3.557 | 0.068 | 324 | 3.373 | 0.076 | 401 | 3.449 | 0.069 |
| Department of Health | 411 | 3.545 | 0.078 | 401 | 3.626 | 0.073 | 320 | 3.747 | 0.082 | 394 | 3.647 | 0.075 |
| family | 429 | 3.086 | 0.074 | 405 | 3.264 | 0.071 | 331 | 3.387 | 0.080 | 415 | 3.010 | 0.073 |
| African scientists | 409 | 3.042 | 0.078 | 399 | 3.043 | 0.070 | 317 | 3.334 | 0.079 | 392 | 3.332 | 0.071 |
| International Scientists | 407 | 2.943 | 0.076 | 399 | 3.328 | 0.072 | 314 | 3.640 | 0.078 | 389 | 3.440 | 0.075 |
| Community-Based Organizations | 414 | 2.819 | 0.069 | 401 | 3.182 | 0.068 | 320 | 2.878 | 0.073 | 396 | 2.861 | 0.068 |
| International NGOs | 404 | 2.703 | 0.070 | 398 | 3.234 | 0.070 | 313 | 3.383 | 0.072 | 385 | 3.132 | 0.071 |
| International News/Media | 399 | 2.536 | 0.068 | 396 | 3.008 | 0.069 | 312 | 3.106 | 0.076 | 386 | 3.010 | 0.071 |
| Local News/Media | 401 | 2.476 | 0.070 | 397 | 2.844 | 0.069 | 312 | 2.753 | 0.076 | 386 | 2.821 | 0.070 |
| Ministers/Religious Leaders | 421 | 2.373 | 0.069 | 403 | 2.826 | 0.070 | 328 | 2.963 | 0.077 | 409 | 2.658 | 0.074 |
| Community Leaders | 418 | 2.165 | 0.064 | 402 | 2.724 | 0.064 | 326 | 2.442 | 0.074 | 407 | 2.514 | 0.068 |
| friends | 423 | 2.156 | 0.061 | 404 | 2.522 | 0.064 | 329 | 2.581 | 0.069 | 412 | 2.447 | 0.066 |
df_retarget$doctor = as.factor(df_retarget$doctor)
doctor_df = df_retarget %>% filter(!is.na(doctor))
doctor_plot <- doctor_df %>% count(doctor) %>% mutate(percentage = n / nrow(doctor_df))
ggplot(doctor_plot, aes(x = fct_inorder(doctor), y = n, fill = doctor)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'doctor' (n = ", sum(doctor_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$WHO = as.factor(df_retarget$WHO)
WHO_df = df_retarget %>% filter(!is.na(WHO))
WHO_plot <- WHO_df %>% count(WHO) %>% mutate(percentage = n / nrow(WHO_df))
ggplot(WHO_plot, aes(x = fct_inorder(WHO), y = n, fill = WHO)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'WHO' (n = ", sum(WHO_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$minister_religious_leader = as.factor(df_retarget$minister_religious_leader)
minister_religious_leader_df = df_retarget %>% filter(!is.na(minister_religious_leader))
minister_religious_leaderO_plot <- minister_religious_leader_df %>% count(minister_religious_leader) %>% mutate(percentage = n / nrow(minister_religious_leader_df))
ggplot(minister_religious_leaderO_plot, aes(x = fct_inorder(minister_religious_leader), y = n, fill = minister_religious_leader)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'Ministers/Religious Leaders' (n = ", sum(minister_religious_leaderO_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$community_leader = as.factor(df_retarget$community_leader)
graph_df = df_retarget %>% filter(!is.na(community_leader))
graph_plot <- graph_df %>% count(community_leader) %>% mutate(percentage = n / nrow(graph_df))
ggplot(graph_plot, aes(x = fct_inorder(community_leader), y = n, fill = community_leader)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'Community Leaders' (n = ", sum(graph_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$clinic_worker = as.factor(df_retarget$clinic_worker)
graph_df = df_retarget %>% filter(!is.na(clinic_worker))
graph_plot <- graph_df %>% count(clinic_worker) %>% mutate(percentage = n / nrow(graph_df))
ggplot(graph_plot, aes(x = fct_inorder(clinic_worker), y = n, fill = clinic_worker)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'Local Health Clinic Worker' (n = ", sum(graph_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$community_based_org = as.factor(df_retarget$community_based_org)
graph_df = df_retarget %>% filter(!is.na(community_based_org))
graph_plot <- graph_df %>% count(community_based_org) %>% mutate(percentage = n / nrow(graph_df))
ggplot(graph_plot, aes(x = fct_inorder(community_based_org), y = n, fill = community_based_org)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'Community-Based Organizations' (n = ", sum(graph_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$health_department = as.factor(df_retarget$health_department)
graph_df = df_retarget %>% filter(!is.na(health_department))
graph_plot <- graph_df %>% count(health_department) %>% mutate(percentage = n / nrow(graph_df))
ggplot(graph_plot, aes(x = fct_inorder(health_department), y = n, fill = health_department)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'Department of Health' (n = ", sum(graph_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$african_scientist = as.factor(df_retarget$african_scientist)
graph_df = df_retarget %>% filter(!is.na(african_scientist))
graph_plot <- graph_df %>% count(african_scientist) %>% mutate(percentage = n / nrow(graph_df))
ggplot(graph_plot, aes(x = fct_inorder(african_scientist), y = n, fill = african_scientist)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'African scientists' (n = ", sum(graph_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$international_scientist = as.factor(df_retarget$international_scientist)
graph_df = df_retarget %>% filter(!is.na(international_scientist))
graph_plot <- graph_df %>% count(international_scientist) %>% mutate(percentage = n / nrow(graph_df))
ggplot(graph_plot, aes(x = fct_inorder(international_scientist), y = n, fill = international_scientist)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'International Scientists' (n = ", sum(graph_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_retarget$international_ngo = as.factor(df_retarget$international_ngo)
graph_df = df_retarget %>% filter(!is.na(international_ngo))
graph_plot <- graph_df %>% count(international_ngo) %>% mutate(percentage = n / nrow(graph_df))
ggplot(graph_plot, aes(x = fct_inorder(international_ngo), y = n, fill = international_ngo)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
ggtitle(paste0("Trust in 'International NGOs' (n = ", sum(graph_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
## clean data
df_retarget$doctor[!df_retarget$doctor %in% c("1","2","3","4","5")] = NA
df_retarget$doctor = strtoi(df_retarget$doctor)
df_retarget$family[!df_retarget$family %in% c("1","2","3","4","5")] = NA
df_retarget$family = strtoi(df_retarget$family)
df_retarget$friends[!df_retarget$friends %in% c("1","2","3","4","5")] = NA
df_retarget$friends = strtoi(df_retarget$friends)
df_retarget$minister_religious_leader[!df_retarget$minister_religious_leader %in% c("1","2","3","4","5")] = NA
df_retarget$minister_religious_leader = strtoi(df_retarget$minister_religious_leader)
df_retarget$community_leader[!df_retarget$community_leader %in% c("1","2","3","4","5")] = NA
df_retarget$community_leader = strtoi(df_retarget$community_leader)
df_retarget$clinic_worker[!df_retarget$clinic_worker %in% c("1","2","3","4","5")] = NA
df_retarget$clinic_worker = strtoi(df_retarget$clinic_worker)
df_retarget$community_based_org[!df_retarget$community_based_org %in% c("1","2","3","4","5")] = NA
df_retarget$community_based_org = strtoi(df_retarget$community_based_org)
df_retarget$health_department[!df_retarget$health_department %in% c("1","2","3","4","5")] = NA
df_retarget$health_department = strtoi(df_retarget$health_department)
df_retarget$WHO[!df_retarget$WHO %in% c("1","2","3","4","5")] = NA
df_retarget$WHO = strtoi(df_retarget$WHO)
df_retarget$african_scientist[!df_retarget$african_scientist %in% c("1","2","3","4","5")] = NA
df_retarget$african_scientist = strtoi(df_retarget$african_scientist)
df_retarget$international_scientist[!df_retarget$international_scientist %in% c("1","2","3","4","5")] = NA
df_retarget$international_scientist = strtoi(df_retarget$international_scientist)
df_retarget$international_ngo[!df_retarget$international_ngo %in% c("1","2","3","4","5")] = NA
df_retarget$international_ngo = strtoi(df_retarget$international_ngo)
df_retarget$local_news_media[!df_retarget$local_news_media %in% c("1","2","3","4","5")] = NA
df_retarget$local_news_media = strtoi(df_retarget$local_news_media)
df_retarget$international_news_media[!df_retarget$international_news_media %in% c("1","2","3","4","5")] = NA
df_retarget$international_news_media = strtoi(df_retarget$international_news_media)
Takeaway:
df_trust_corr = df_retarget %>%
select(doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media)
ggcorrplot(cor(df_trust_corr, use = "pairwise.complete.obs"), type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2]), hc.order = TRUE) +
labs(y = "", x = "", title = "Correlation Matrix: \nTrust Variables",
caption = paste("Number of Observations:", scales::comma(nrow(df_trust_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
df_trust_corr_inst = df_retarget %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo)
ggcorrplot(cor(df_trust_corr_inst, use = "pairwise.complete.obs"), type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2]), hc.order = TRUE) +
labs(y = "", x = "", title = "Correlation Matrix: \nInstitutional Trust Variables",
caption = paste("Number of Observations:", scales::comma(nrow(df_trust_corr_inst))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
df_trust_corr = df_retarget %>%
select(doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media)
df_trust_corr_int = data.frame(cor(df_trust_corr, use = "pairwise.complete.obs"))
df_trust_corr_int = df_trust_corr_int %>%
select(friends, family, `Local.News.Media`, `International.News.Media`)
df_trust_corr_int = df_trust_corr_int[!(row.names(df_trust_corr_int) %in% c("friends", "family", "Local News/Media", "International News/Media")),]
ggcorrplot(df_trust_corr_int, lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nInstitutional Trust Variables vs Non-Institutional Trust Variables",
caption = paste("Number of Observations:", scales::comma(nrow(df_trust_corr_int))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
#data.frame(cor(df_trust_corr, use = "pairwise.complete.obs"))
Questions: Tell me more about what YOU believe by telling me how much you agree or disagree with the statements you’re about to read.
Takeaway:
afraid needle is slightly negatively correlated with
trust variables## clean data
df_retarget$covid_is_a_problem[!df_retarget$covid_is_a_problem %in% c("1","2","3","4","5")] = NA
df_retarget$covid_is_a_problem = strtoi(df_retarget$covid_is_a_problem)
df_retarget$covid_is_problem_my_country[!df_retarget$covid_is_problem_my_country %in% c("1","2","3","4","5")] = NA
df_retarget$covid_is_problem_my_country = strtoi(df_retarget$covid_is_problem_my_country)
df_retarget$vax_is_safe[!df_retarget$vax_is_safe %in% c("1","2","3","4","5")] = NA
df_retarget$vax_is_safe = strtoi(df_retarget$vax_is_safe)
df_retarget$vax_prevent_sick_death[!df_retarget$vax_prevent_sick_death %in% c("1","2","3","4","5")] = NA
df_retarget$vax_prevent_sick_death = strtoi(df_retarget$vax_prevent_sick_death)
df_retarget$need_vax_for_protection[!df_retarget$need_vax_for_protection %in% c("1","2","3","4","5")] = NA
df_retarget$need_vax_for_protection = strtoi(df_retarget$need_vax_for_protection)
df_retarget$vax_safer_covid[!df_retarget$vax_safer_covid %in% c("1","2","3","4","5")] = NA
df_retarget$vax_safer_covid = strtoi(df_retarget$vax_safer_covid)
df_retarget$developer_want_to_help[!df_retarget$developer_want_to_help %in% c("1","2","3","4","5")] = NA
df_retarget$developer_want_to_help = strtoi(df_retarget$developer_want_to_help)
df_retarget$health_worker_want_to_help[!df_retarget$health_worker_want_to_help %in% c("1","2","3","4","5")] = NA
df_retarget$health_worker_want_to_help = strtoi(df_retarget$health_worker_want_to_help)
df_retarget$gov_want_to_help[!df_retarget$gov_want_to_help %in% c("1","2","3","4","5")] = NA
df_retarget$gov_want_to_help = strtoi(df_retarget$gov_want_to_help)
df_retarget$important_to_protect_myself[!df_retarget$important_to_protect_myself %in% c("1","2","3","4","5")] = NA
df_retarget$important_to_protect_myself = strtoi(df_retarget$important_to_protect_myself)
df_retarget$important_to_protect_other[!df_retarget$important_to_protect_other %in% c("1","2","3","4","5")] = NA
df_retarget$important_to_protect_other = strtoi(df_retarget$important_to_protect_other)
df_retarget$vax_moral[!df_retarget$vax_moral %in% c("1","2","3","4","5")] = NA
df_retarget$vax_moral = strtoi(df_retarget$vax_moral)
df_retarget$worry_short_term_side_effect[!df_retarget$worry_short_term_side_effect %in% c("1","2","3","4","5")] = NA
df_retarget$worry_short_term_side_effect = strtoi(df_retarget$worry_short_term_side_effect)
df_retarget$worry_long_term_side_effect[!df_retarget$worry_long_term_side_effect %in% c("1","2","3","4","5")] = NA
df_retarget$worry_long_term_side_effect = strtoi(df_retarget$worry_long_term_side_effect)
df_retarget$covid_is_real[!df_retarget$covid_is_real %in% c("1","2","3","4","5")] = NA
df_retarget$covid_is_real = strtoi(df_retarget$covid_is_real)
df_retarget$probably_exposed[!df_retarget$probably_exposed %in% c("1","2","3","4","5")] = NA
df_retarget$probably_exposed = strtoi(df_retarget$probably_exposed)
df_retarget$afraid_needle[!df_retarget$afraid_needle %in% c("1","2","3","4","5")] = NA
df_retarget$afraid_needle = strtoi(df_retarget$afraid_needle)
df_retarget$deeply_religious[!df_retarget$deeply_religious %in% c("1","2","3","4","5")] = NA
df_retarget$deeply_religious = strtoi(df_retarget$deeply_religious)
df_retarget$important_moral[!df_retarget$important_moral %in% c("1","2","3","4","5")] = NA
df_retarget$important_moral = strtoi(df_retarget$important_moral)
df_retarget$fit_in_group_importance[!df_retarget$fit_in_group_importance %in% c("1","2","3","4","5")] = NA
df_retarget$fit_in_group_importance = strtoi(df_retarget$fit_in_group_importance)
df_retarget$responsible_importance[!df_retarget$responsible_importance %in% c("1","2","3","4","5")] = NA
df_retarget$responsible_importance = strtoi(df_retarget$responsible_importance)
df_sort_corr = df_retarget %>%
select(doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media,
covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance)
df_sort_corr = data.frame(cor(df_sort_corr, use = "pairwise.complete.obs"))
df_sort_corr = df_sort_corr %>%
select(friends, family, `Local.News.Media`, `International.News.Media`, doctor, `Ministers.Religious.Leaders`, `Community.Leaders`, `Local.Health.Clinic.Worker`, `Community.Based.Organizations`, `Department.of.Health`, `African.scientists`, `International.Scientists`, `International.NGOs`, WHO)
df_sort_corr = df_sort_corr[!(row.names(df_sort_corr) %in% c("friends", "family", "Local News/Media", "International News/Media", "doctor", "Ministers/Religious Leaders", "Community Leaders", "Local Health Clinic Worker", "Community-Based Organizations", "Department of Health", "African scientists", "International Scientists", "International NGOs", "WHO")),]
ggcorrplot(df_sort_corr, lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nTrust Variables vs Sorting Questions",
caption = paste("Number of Observations:", scales::comma(nrow(df_sort_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
Variable Descriptions:
covid_is_a_problem: People are still dying from
COVIDcovid_is_problem_my_country: COVID is a problem in [my
country]vax_is_safe: I think the COVID vaccines are safevax_prevent_sick_death: COVID vaccines help prevent
serious sickness and deathneed_vax_for_protection: You need a vaccine for
protection from sickness (not because you are sick)vax_safer_covid: Getting the vaccine is much safer than
getting COVIDdeveloper_want_to_help: I think the people who
developed the vaccine wanted to help peoplehealth_worker_want_to_help: I think my local healthcare
workers want me to be healthy and wellgov_want_to_help: I think my government’s department of
health workers want me to be healthy and wellimportant_to_protect_myself: It is important to me that
I protect myself from the effects of COVIDimportant_to_protect_other: It is important to me that
I protect others from the effects of COVIDvax_moral: Getting vaccinated is a moral issueworry_short_term_side_effect: I worry about short-term
side effects of the COVID vaccineworry_long_term_side_effect: I worry about long-term
side effects of the COVID vaccinecovid_is_real: COVID has killed millions of people
worldwideprobably_exposed: I will probably be exposed to someone
with COVID over the next yearafraid_needle: I am very afraid of needlesdeeply_religious: I am a deeply religious personimportant_moral: It is important to me that I be a
moral personfit_in_group_importance: It is important to me to feel
like I “fit in” in with my groupresponsible_importance: It is important to me to feel
like I am a responsible member of my communitydf_sort_corr = df_retarget %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance)
df_sort_corr = data.frame(cor(df_sort_corr, use = "pairwise.complete.obs"))
df_sort_corr = df_sort_corr %>%
select(doctor, `Ministers.Religious.Leaders`, `Community.Leaders`, `Local.Health.Clinic.Worker`, `Community.Based.Organizations`, `Department.of.Health`, `African.scientists`, `International.Scientists`, `International.NGOs`, WHO)
df_sort_corr = df_sort_corr[!(row.names(df_sort_corr) %in% c("doctor", "Ministers/Religious Leaders", "Community Leaders", "Local Health Clinic Worker", "Community-Based Organizations", "Department of Health", "African scientists", "International Scientists", "International NGOs", "WHO")),]
ggcorrplot(df_sort_corr, lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nInstitutional Trust Variables vs Sorting Questions",
caption = paste("Number of Observations:", scales::comma(nrow(df_sort_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
Variable Descriptions:
covid_is_a_problem: People are still dying from
COVIDcovid_is_problem_my_country: COVID is a problem in [my
country]vax_is_safe: I think the COVID vaccines are safevax_prevent_sick_death: COVID vaccines help prevent
serious sickness and deathneed_vax_for_protection: You need a vaccine for
protection from sickness (not because you are sick)vax_safer_covid: Getting the vaccine is much safer than
getting COVIDdeveloper_want_to_help: I think the people who
developed the vaccine wanted to help peoplehealth_worker_want_to_help: I think my local healthcare
workers want me to be healthy and wellgov_want_to_help: I think my government’s department of
health workers want me to be healthy and wellimportant_to_protect_myself: It is important to me that
I protect myself from the effects of COVIDimportant_to_protect_other: It is important to me that
I protect others from the effects of COVIDvax_moral: Getting vaccinated is a moral issueworry_short_term_side_effect: I worry about short-term
side effects of the COVID vaccineworry_long_term_side_effect: I worry about long-term
side effects of the COVID vaccinecovid_is_real: COVID has killed millions of people
worldwideprobably_exposed: I will probably be exposed to someone
with COVID over the next yearafraid_needle: I am very afraid of needlesdeeply_religious: I am a deeply religious personimportant_moral: It is important to me that I be a
moral personfit_in_group_importance: It is important to me to feel
like I “fit in” in with my groupresponsible_importance: It is important to me to feel
like I am a responsible member of my communityTakeaway:
Note: Sort by Unvaccinated-Mean
df_retarget %>%
select(vax_status_retarget, doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>%
split(.$vax_status_retarget) %>%
map(describe) %>%
do.call(rbind, .) %>%
data.frame() %>%
select(n, mean , se) %>%
rownames_to_column() %>%
separate(rowname, c("vax_status_retarget", "variable"), sep = "\\.") %>%
filter(variable != "vax_status_retarget*") %>%
pivot_longer(cols = c("n", "mean", "se")) %>%
mutate(column = paste(vax_status_retarget, name, sep = "_")) %>%
select(column, variable, value) %>%
pivot_wider(names_from = column) %>%
arrange(desc(`0_mean`)) %>%
kable(digits = 3,caption = "Summary Statistics for Trust Variables by Vaccination Status",
col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
kable_styling(bootstrap_options = c("striped", "hover"))%>%
add_header_above(c(" " = 1, "Unvaccinated" = 3, "Vaccinated" = 3)) %>%
row_spec(c(1,2,3,5,6,7,8,9,11,13), bold = T, color = "black", background = "lightgrey")
| N | Mean | SE | N | Mean | SE | |
|---|---|---|---|---|---|---|
| WHO | 292 | 3.767 | 0.085 | 795 | 4.169 | 0.046 |
| doctor | 291 | 3.629 | 0.079 | 795 | 4.020 | 0.045 |
| Department of Health | 292 | 3.295 | 0.088 | 795 | 3.980 | 0.047 |
| family | 292 | 3.192 | 0.085 | 795 | 3.360 | 0.051 |
| International Scientists | 292 | 3.188 | 0.082 | 795 | 3.628 | 0.049 |
| Local Health Clinic Worker | 292 | 3.134 | 0.076 | 795 | 3.845 | 0.044 |
| African scientists | 292 | 3.075 | 0.078 | 795 | 3.459 | 0.049 |
| International NGOs | 291 | 2.993 | 0.078 | 795 | 3.316 | 0.048 |
| Community-Based Organizations | 292 | 2.760 | 0.071 | 795 | 3.157 | 0.047 |
| International News/Media | 292 | 2.723 | 0.075 | 795 | 3.116 | 0.049 |
| Ministers/Religious Leaders | 292 | 2.705 | 0.084 | 795 | 2.808 | 0.050 |
| Local News/Media | 292 | 2.455 | 0.073 | 795 | 2.923 | 0.048 |
| Community Leaders | 292 | 2.260 | 0.074 | 795 | 2.605 | 0.046 |
| friends | 292 | 2.226 | 0.068 | 795 | 2.600 | 0.046 |
Note: Sort by Unvaccinated-Mean
df_retarget %>%
select(vax_status_retarget_4, doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>%
split(.$vax_status_retarget_4) %>%
map(describe) %>%
do.call(rbind, .) %>%
data.frame() %>%
select(n, mean , se) %>%
rownames_to_column() %>%
separate(rowname, c("vax_status_retarget_4", "variable"), sep = "\\.") %>%
filter(variable != "vax_status_retarget_4*") %>%
pivot_longer(cols = c("n", "mean", "se")) %>%
mutate(column = paste(vax_status_retarget_4, name, sep = "_")) %>%
select(column, variable, value) %>%
pivot_wider(names_from = column) %>%
arrange(desc(`0_mean`)) %>%
kable(digits = 3,caption = "Summary Statistics for Trust Variables by Vaccination Dose",
col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
kable_styling(bootstrap_options = c("striped", "hover")) %>%
add_header_above(c(" " = 1, "Unvaccinated" = 3, "1 dose" = 3, "2 doses" = 3, "3 doses" = 3)) %>%
row_spec(c(1,2,3,5,6,7,8,9,11,13), bold = T, color = "black", background = "lightgrey")
| N | Mean | SE | N | Mean | SE | N | Mean | SE | N | Mean | SE | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WHO | 292 | 3.767 | 0.085 | 231 | 4.091 | 0.088 | 376 | 4.269 | 0.063 | 188 | 4.064 | 0.102 |
| doctor | 291 | 3.629 | 0.079 | 231 | 4.026 | 0.079 | 376 | 4.008 | 0.066 | 188 | 4.037 | 0.095 |
| Department of Health | 292 | 3.295 | 0.088 | 231 | 3.913 | 0.089 | 376 | 4.045 | 0.065 | 188 | 3.931 | 0.103 |
| family | 292 | 3.192 | 0.085 | 231 | 3.281 | 0.094 | 376 | 3.410 | 0.072 | 188 | 3.356 | 0.110 |
| International Scientists | 292 | 3.188 | 0.082 | 231 | 3.662 | 0.090 | 376 | 3.662 | 0.069 | 188 | 3.516 | 0.108 |
| Local Health Clinic Worker | 292 | 3.134 | 0.076 | 231 | 3.684 | 0.084 | 376 | 3.949 | 0.059 | 188 | 3.835 | 0.096 |
| African scientists | 292 | 3.075 | 0.078 | 231 | 3.424 | 0.094 | 376 | 3.503 | 0.069 | 188 | 3.415 | 0.102 |
| International NGOs | 291 | 2.993 | 0.078 | 231 | 3.234 | 0.089 | 376 | 3.465 | 0.065 | 188 | 3.117 | 0.106 |
| Community-Based Organizations | 292 | 2.760 | 0.071 | 231 | 3.039 | 0.086 | 376 | 3.279 | 0.068 | 188 | 3.059 | 0.100 |
| International News/Media | 292 | 2.723 | 0.075 | 231 | 3.017 | 0.090 | 376 | 3.184 | 0.071 | 188 | 3.101 | 0.101 |
| Ministers/Religious Leaders | 292 | 2.705 | 0.084 | 231 | 2.740 | 0.091 | 376 | 2.819 | 0.074 | 188 | 2.867 | 0.102 |
| Local News/Media | 292 | 2.455 | 0.073 | 231 | 2.779 | 0.091 | 376 | 3.029 | 0.069 | 188 | 2.888 | 0.102 |
| Community Leaders | 292 | 2.260 | 0.074 | 231 | 2.481 | 0.083 | 376 | 2.646 | 0.068 | 188 | 2.676 | 0.099 |
| friends | 292 | 2.226 | 0.068 | 231 | 2.502 | 0.082 | 376 | 2.598 | 0.066 | 188 | 2.723 | 0.102 |
Question: On a scale from 1 -5, How likely are you to get a COVID vaccine/booster next year? (1 = very unlikely, 2 = somewhat unlikely, 3 = unsure, 4 = probably will, 5 = definitely will)
df_retarget$vax_next_year = strtoi(df_retarget$vax_next_year)
df_retarget$vax_next_year[!df_retarget$vax_next_year %in% c("1","2","3","4","5")] = NA
df_future_corr = df_retarget %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
vax_next_year)
df_future_corr = data.frame(cor(df_future_corr, use = "pairwise.complete.obs"))
df_future_corr = df_future_corr %>%
select(vax_next_year)
#df_future_corr = df_future_corr[!(row.names(df_future_corr) %in% c("vax_next_year")),]
ggcorrplot(df_future_corr, type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nInstitutional Trust Variables vs Vax Future",
caption = paste("Number of Observations:", scales::comma(nrow(df_future_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
Question: Have you ever received any other vaccines? Options: yes; no
df_retarget$receive_other_vax[df_retarget$receive_other_vax == "yes"] = 1
df_retarget$receive_other_vax[df_retarget$receive_other_vax == "no"] = 0
df_retarget$receive_other_vax[!df_retarget$receive_other_vax %in% c("0","1")] = NA
df_retarget$receive_other_vax = strtoi(df_retarget$receive_other_vax, base = 0L)
df_future_corr = df_retarget %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
receive_other_vax)
df_future_corr = data.frame(cor(df_future_corr, use = "pairwise.complete.obs"))
df_future_corr = df_future_corr %>%
select(receive_other_vax)
#df_future_corr = df_future_corr[!(row.names(df_future_corr) %in% c("vax_next_year")),]
ggcorrplot(df_future_corr, type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nInstitutional Trust Variables vs Received any other vaccines",
caption = paste("Number of Observations:", scales::comma(nrow(df_future_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
Takeaway:
Starred variables have a corresponding variable, with the suffix
_num (ie education_num) that provides a
numeric ordering of the variables. This order is listed in
parenthesis.
| Variable | Description |
|---|---|
| gender* | male (0) or female (1) |
| age | integer 18 to 99 |
| education* | < high school (1), high school (2), some college (3), 2-year degree (4), 4-year degree (5), graduate degree (6), other, prefer not to say |
| location* | rural(1), suburban (2), urban(3), other, prefer not to say |
| religiosity* | not very religious (1), somewhat religious (2), very religious (3), other, prefer not to say |
| white | 1 if the participant is a white or caucasian, 0 if not |
| ethnicity | asian or indian, black or african, coloured, white or caucasian, other, prefer not to say |
## clean demographic data
numeric_cols <- function(df){
out <- df %>%
mutate(
age = as.numeric(ifelse(demog_age %in% paste(18:99), demog_age, "")),
gender_num = case_when(
gender == "female" ~ 1,
gender == "male" ~ 0
),
education_num = case_when(
demog_education == "< High school" ~ 1,
demog_education == "High school" ~ 2,
demog_education == "Some college" ~ 3,
demog_education == "2-year degree" ~ 4,
demog_education == "4-year degree" ~ 5,
demog_education == "Graduate degree" ~ 6,
),
religiosity_num = case_when(
religiosity == "Not very religious" ~ 1,
religiosity == "Somewhat religious" ~ 2,
religiosity == "Very religious" ~ 3,
),
location_num = case_when(
location == "Rural" ~ 1,
location == "Suburban" ~ 2,
location == "Urban" ~ 3,
),
location =factor(location, levels = c("Urban", "Suburban", "Rural", "Prefer not to say")),
white = ifelse(ethnicity == "White or Caucasian", 1, 0),
ethnicity = factor(ethnicity, levels=c("Asian or Indian",
"Black or African",
"coloured",
"White or Caucasian",
"Other",
"Prefer not to say")
))
return(out)
}
df_retarget_num = numeric_cols(df_retarget)
df_demog_corr = df_retarget_num %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
age, education = education_num, location=location_num, religiosity = religiosity_num, gender = gender_num, white)
df_demog_corr = data.frame(cor(df_demog_corr, use = "pairwise.complete.obs"))
df_demog_corr = df_demog_corr %>%
select(-c(doctor, `Ministers.Religious.Leaders`, `Community.Leaders`, `Local.Health.Clinic.Worker`, `Community.Based.Organizations`, `Department.of.Health`, `African.scientists`, `International.Scientists`, `International.NGOs`, WHO))
df_demog_corr = df_demog_corr[(row.names(df_demog_corr) %in% c("doctor", "Ministers/Religious Leaders", "Community Leaders", "Local Health Clinic Worker", "Community-Based Organizations", "Department of Health", "African scientists", "International Scientists", "International NGOs", "WHO")),]
ggcorrplot(df_demog_corr, lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nInstitutional Trust Variables vs Continuous Demographics",
caption = paste("Number of Observations:", scales::comma(nrow(df_future_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
df_retarget$ethnicity[!df_retarget$ethnicity %in% c("Black or African","White or Caucasian", "Asian or Indian", "Other", "Prefer not to say")] = NA
df_retarget$ethnicity = factor(df_retarget$ethnicity, levels=c("Black or African","White or Caucasian", "Asian or Indian", "Other", "Prefer not to say"))
ethnicity_df = df_retarget %>%
filter(!is.na(ethnicity)) %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
ethnicity) %>%
group_by(ethnicity) %>%
drop_na() %>%
dplyr::summarise(
doctor = mean(doctor),
`Ministers/Religious Leaders` = mean(`Ministers/Religious Leaders`),
`Community Leaders` = mean(`Community Leaders`),
`Local Health Clinic Worker` = mean(`Local Health Clinic Worker`),
`Community-Based Organizations` = mean(`Community-Based Organizations`),
`Department of Health` = mean(`Department of Health`),
`African scientists` = mean(`African scientists`),
`International Scientists` = mean(`International Scientists`),
`International NGOs` = mean(`International NGOs`),
WHO = mean(WHO)
)
ethnicity_df %>%
kable(caption = "Ethnicity and institutional Trust", digits = 3)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
| ethnicity | doctor | Ministers/Religious Leaders | Community Leaders | Local Health Clinic Worker | Community-Based Organizations | Department of Health | African scientists | International Scientists | International NGOs | WHO |
|---|---|---|---|---|---|---|---|---|---|---|
| Black or African | 3.928 | 2.779 | 2.523 | 3.652 | 3.063 | 3.809 | 3.379 | 3.523 | 3.251 | 4.071 |
| White or Caucasian | 3.700 | 2.250 | 1.900 | 3.050 | 2.850 | 3.150 | 2.450 | 2.850 | 2.600 | 3.400 |
| Asian or Indian | 3.667 | 3.667 | 2.667 | 3.889 | 3.556 | 3.667 | 3.444 | 3.222 | 3.222 | 4.222 |
| Other | 3.600 | 2.600 | 2.160 | 3.640 | 2.400 | 3.200 | 2.880 | 2.880 | 2.760 | 3.600 |
| Prefer not to say | 3.833 | 3.500 | 2.750 | 4.250 | 3.333 | 4.417 | 3.417 | 3.917 | 3.750 | 4.583 |
df_retarget$demog_religion[!df_retarget$demog_religion %in% c("Christianity","Islam", "African traditional", "Hinduism", "Judaism", "No religion", "Other", "Prefer not to say")] = NA
df_retarget$demog_religion = factor(df_retarget$demog_religion, levels=c("Christianity","Islam", "African traditional", "Hinduism", "Judaism", "No religion", "Other", "Prefer not to say"))
religion_df = df_retarget %>%
filter(!is.na(demog_religion)) %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
demog_religion) %>%
group_by(demog_religion) %>%
drop_na() %>%
dplyr::summarise(
doctor = mean(doctor),
`Ministers/Religious Leaders` = mean(`Ministers/Religious Leaders`),
`Community Leaders` = mean(`Community Leaders`),
`Local Health Clinic Worker` = mean(`Local Health Clinic Worker`),
`Community-Based Organizations` = mean(`Community-Based Organizations`),
`Department of Health` = mean(`Department of Health`),
`African scientists` = mean(`African scientists`),
`International Scientists` = mean(`International Scientists`),
`International NGOs` = mean(`International NGOs`),
WHO = mean(WHO)
)
religion_df %>%
kable(caption = "Religion and institutional Trust", digits = 3)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
| demog_religion | doctor | Ministers/Religious Leaders | Community Leaders | Local Health Clinic Worker | Community-Based Organizations | Department of Health | African scientists | International Scientists | International NGOs | WHO |
|---|---|---|---|---|---|---|---|---|---|---|
| Christianity | 3.920 | 2.816 | 2.502 | 3.664 | 3.066 | 3.815 | 3.331 | 3.522 | 3.238 | 4.092 |
| Islam | 4.007 | 2.941 | 2.787 | 3.676 | 3.147 | 3.963 | 3.596 | 3.735 | 3.434 | 4.162 |
| African traditional | 3.640 | 2.120 | 2.280 | 3.320 | 2.720 | 3.360 | 3.520 | 2.960 | 2.720 | 3.400 |
| Hinduism | 3.000 | 4.000 | 2.750 | 3.250 | 3.250 | 3.500 | 2.750 | 2.500 | 2.500 | 3.750 |
| Judaism | 5.000 | 4.000 | 5.000 | 5.000 | 5.000 | 4.000 | 4.000 | 5.000 | 4.000 | 5.000 |
| No religion | 3.920 | 1.920 | 1.960 | 3.560 | 2.840 | 3.280 | 3.600 | 3.400 | 2.960 | 3.600 |
| Other | 3.000 | 1.750 | 1.500 | 3.250 | 1.500 | 3.250 | 2.750 | 2.750 | 2.500 | 3.750 |
| Prefer not to say | 3.533 | 1.800 | 2.000 | 3.200 | 2.400 | 3.200 | 2.667 | 2.733 | 2.867 | 3.400 |
df_SA = df_retarget %>% filter(country_answer == "South Africa")
df_SA$demog_income[!df_SA$demog_income %in% c("< R5,000","R5,000 - R9,999", "R10,000 - R29,999", "R30,000 - R49,999", "R50,000 - R99,999", "> R100,000")] = NA
df_SA$demog_income = factor(df_SA$demog_income, levels=c("< R5,000","R5,000 - R9,999", "R10,000 - R29,999", "R30,000 - R49,999", "R50,000 - R99,999", "> R100,000"))
SA = df_SA %>%
filter(!is.na(demog_income)) %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
demog_income) %>%
group_by(demog_income) %>%
drop_na() %>%
dplyr::summarise(
doctor = mean(doctor),
`Ministers/Religious Leaders` = mean(`Ministers/Religious Leaders`),
`Community Leaders` = mean(`Community Leaders`),
`Local Health Clinic Worker` = mean(`Local Health Clinic Worker`),
`Community-Based Organizations` = mean(`Community-Based Organizations`),
`Department of Health` = mean(`Department of Health`),
`African scientists` = mean(`African scientists`),
`International Scientists` = mean(`International Scientists`),
`International NGOs` = mean(`International NGOs`),
WHO = mean(WHO)
)
SA %>%
kable(caption = "Income and institutional Trust", digits = 3)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
| demog_income | doctor | Ministers/Religious Leaders | Community Leaders | Local Health Clinic Worker | Community-Based Organizations | Department of Health | African scientists | International Scientists | International NGOs | WHO |
|---|---|---|---|---|---|---|---|---|---|---|
| < R5,000 | 3.813 | 2.488 | 2.130 | 3.805 | 2.821 | 3.618 | 3.098 | 2.976 | 2.675 | 3.797 |
| R5,000 - R9,999 | 4.030 | 2.576 | 2.030 | 3.606 | 2.818 | 3.848 | 3.697 | 3.364 | 3.091 | 4.061 |
| R10,000 - R29,999 | 4.045 | 2.591 | 2.182 | 4.000 | 3.136 | 4.227 | 3.909 | 3.818 | 3.136 | 4.182 |
| R30,000 - R49,999 | 3.714 | 3.571 | 2.857 | 3.857 | 3.000 | 3.429 | 3.571 | 3.571 | 3.429 | 3.571 |
| R50,000 - R99,999 | 4.333 | 2.583 | 2.750 | 3.583 | 2.917 | 3.500 | 3.333 | 3.000 | 3.083 | 3.417 |
| > R100,000 | 3.800 | 2.200 | 2.200 | 3.700 | 2.700 | 3.300 | 3.100 | 3.300 | 2.900 | 3.700 |
df_Kenya = df_retarget %>% filter(country_answer == "Kenya")
df_Kenya$demog_income[!df_Kenya$demog_income %in% c("< 50k KSh","50k KSh - 100k KSh", "100k KSh - 300k KSh", "300k KSh - 500k Ksh", "500k Ksh-1,000k KSh", "> 1,000k KSh")] = NA
df_Kenya$demog_income = factor(df_Kenya$demog_income, levels=c("< 50k KSh","50k KSh - 100k KSh", "100k KSh - 300k KSh", "300k KSh - 500k Ksh", "500k Ksh-1,000k KSh", "> 1,000k KSh"))
Kenya = df_Kenya %>%
filter(!is.na(demog_income)) %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
demog_income) %>%
group_by(demog_income) %>%
drop_na() %>%
dplyr::summarise(
doctor = mean(doctor),
`Ministers/Religious Leaders` = mean(`Ministers/Religious Leaders`),
`Community Leaders` = mean(`Community Leaders`),
`Local Health Clinic Worker` = mean(`Local Health Clinic Worker`),
`Community-Based Organizations` = mean(`Community-Based Organizations`),
`Department of Health` = mean(`Department of Health`),
`African scientists` = mean(`African scientists`),
`International Scientists` = mean(`International Scientists`),
`International NGOs` = mean(`International NGOs`),
WHO = mean(WHO)
)
Kenya %>%
kable(caption = "Income and institutional Trust", digits = 3)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
| demog_income | doctor | Ministers/Religious Leaders | Community Leaders | Local Health Clinic Worker | Community-Based Organizations | Department of Health | African scientists | International Scientists | International NGOs | WHO |
|---|---|---|---|---|---|---|---|---|---|---|
| < 50k KSh | 3.851 | 2.817 | 2.691 | 3.566 | 3.229 | 3.686 | 3.069 | 3.343 | 3.297 | 3.931 |
| 50k KSh - 100k KSh | 3.735 | 2.985 | 2.868 | 3.779 | 3.456 | 3.721 | 3.250 | 3.353 | 3.250 | 3.882 |
| 100k KSh - 300k KSh | 4.214 | 2.893 | 2.821 | 3.750 | 3.429 | 3.786 | 3.179 | 3.786 | 3.464 | 4.214 |
| 300k KSh - 500k Ksh | 3.333 | 2.000 | 2.000 | 2.500 | 2.167 | 3.667 | 3.333 | 3.500 | 3.000 | 3.833 |
| 500k Ksh-1,000k KSh | 3.857 | 2.429 | 3.143 | 3.714 | 3.143 | 3.714 | 3.429 | 4.000 | 3.857 | 4.000 |
| > 1,000k KSh | 3.900 | 2.500 | 2.600 | 4.000 | 3.100 | 3.900 | 3.000 | 3.800 | 3.800 | 4.400 |
df_Nigeria = df_retarget %>% filter(country_answer == "Nigeria")
df_Nigeria$demog_income[!df_Nigeria$demog_income %in% c("< 50,000₦","50,000 - 99,999₦", "100,000₦ - 299,999₦", "300,000₦ - 499,999₦", "500,000₦ - 999,999₦", "> 1,000,000₦")] = NA
df_Nigeria$demog_income = factor(df_Nigeria$demog_income, levels=c("< 50,000₦","50,000 - 99,999₦", "100,000₦ - 299,999₦", "300,000₦ - 499,999₦", "500,000₦ - 999,999₦", "> 1,000,000₦"))
Nigeria = df_Nigeria %>%
filter(!is.na(demog_income)) %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
demog_income) %>%
group_by(demog_income) %>%
drop_na() %>%
dplyr::summarise(
doctor = mean(doctor),
`Ministers/Religious Leaders` = mean(`Ministers/Religious Leaders`),
`Community Leaders` = mean(`Community Leaders`),
`Local Health Clinic Worker` = mean(`Local Health Clinic Worker`),
`Community-Based Organizations` = mean(`Community-Based Organizations`),
`Department of Health` = mean(`Department of Health`),
`African scientists` = mean(`African scientists`),
`International Scientists` = mean(`International Scientists`),
`International NGOs` = mean(`International NGOs`),
WHO = mean(WHO)
)
Nigeria %>%
kable(caption = "Income and institutional Trust", digits = 3)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
| demog_income | doctor | Ministers/Religious Leaders | Community Leaders | Local Health Clinic Worker | Community-Based Organizations | Department of Health | African scientists | International Scientists | International NGOs | WHO |
|---|---|---|---|---|---|---|---|---|---|---|
| < 50,000₦ | 3.963 | 3.157 | 2.787 | 3.556 | 3.120 | 4.028 | 3.685 | 3.926 | 3.556 | 4.278 |
| 50,000 - 99,999₦ | 3.521 | 2.854 | 2.208 | 3.333 | 2.708 | 3.438 | 3.167 | 3.458 | 3.333 | 4.271 |
| 100,000₦ - 299,999₦ | 4.364 | 3.061 | 2.424 | 3.606 | 2.939 | 3.939 | 3.545 | 3.788 | 3.394 | 4.303 |
| 300,000₦ - 499,999₦ | 4.400 | 3.467 | 2.600 | 3.533 | 3.200 | 4.067 | 3.667 | 4.067 | 3.867 | 4.600 |
| 500,000₦ - 999,999₦ | 4.077 | 2.769 | 2.000 | 3.385 | 2.769 | 4.077 | 3.308 | 4.000 | 3.846 | 4.615 |
| > 1,000,000₦ | 4.833 | 3.500 | 3.000 | 4.000 | 4.000 | 4.333 | 4.167 | 4.667 | 4.167 | 4.667 |
df_Ghana = df_retarget %>% filter(country_answer == "Ghana")
df_Ghana$demog_income[!df_Ghana$demog_income %in% c("< 5,000GH₵","5,000GH₵ - 9,999GH₵", "10,000GH₵ - 29,999GH", "30,000GH₵ - 49,999GH", "50,000GH₵-99,999GH₵", "> 100,000GH₵")] = NA
df_Ghana$demog_income = factor(df_Ghana$demog_income, levels=c("< 5,000GH₵","5,000GH₵ - 9,999GH₵", "10,000GH₵ - 29,999GH", "30,000GH₵ - 49,999GH", "50,000GH₵-99,999GH₵", "> 100,000GH₵"))
Ghana = df_Ghana %>%
filter(!is.na(demog_income)) %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
demog_income) %>%
group_by(demog_income) %>%
drop_na() %>%
dplyr::summarise(
doctor = mean(doctor),
`Ministers/Religious Leaders` = mean(`Ministers/Religious Leaders`),
`Community Leaders` = mean(`Community Leaders`),
`Local Health Clinic Worker` = mean(`Local Health Clinic Worker`),
`Community-Based Organizations` = mean(`Community-Based Organizations`),
`Department of Health` = mean(`Department of Health`),
`African scientists` = mean(`African scientists`),
`International Scientists` = mean(`International Scientists`),
`International NGOs` = mean(`International NGOs`),
WHO = mean(WHO)
)
Ghana %>%
kable(caption = "Income and institutional Trust", digits = 3)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
| demog_income | doctor | Ministers/Religious Leaders | Community Leaders | Local Health Clinic Worker | Community-Based Organizations | Department of Health | African scientists | International Scientists | International NGOs | WHO |
|---|---|---|---|---|---|---|---|---|---|---|
| < 5,000GH₵ | 3.904 | 2.637 | 2.555 | 3.610 | 3.007 | 3.849 | 3.534 | 3.699 | 3.219 | 4.048 |
| 5,000GH₵ - 9,999GH₵ | 3.926 | 2.037 | 2.148 | 4.000 | 3.000 | 3.741 | 3.296 | 3.407 | 3.185 | 4.259 |
| 10,000GH₵ - 29,999GH | 4.333 | 3.167 | 2.917 | 4.167 | 3.667 | 4.167 | 4.333 | 4.000 | 3.667 | 4.333 |
| 30,000GH₵ - 49,999GH | 4.333 | 3.000 | 3.000 | 4.000 | 3.000 | 3.333 | 3.000 | 3.000 | 3.000 | 4.000 |
Takeaway:
Question: Have you heard of “herd immunity? - yes(1); no(0)
df_retarget$herd_immunity[df_retarget$herd_immunity == "yes"] = 1
df_retarget$herd_immunity[df_retarget$herd_immunity == "no"] = 0
df_retarget$herd_immunity[!df_retarget$herd_immunity %in% c("0","1")] = NA
df_retarget$herd_immunity = strtoi(df_retarget$herd_immunity, base = 0L)
df_heard_corr = df_retarget %>%
select(doctor, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo,
herd_immunity)
df_heard_corr = data.frame(cor(df_heard_corr, use = "pairwise.complete.obs"))
df_heard_corr = df_heard_corr %>%
select(herd_immunity)
#df_future_corr = df_future_corr[!(row.names(df_future_corr) %in% c("vax_next_year")),]
ggcorrplot(df_heard_corr, type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nInstitutional Trust Variables vs 'herd immunity'",
caption = paste("Number of Observations:", scales::comma(nrow(df_heard_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
df_retarget %>%
select(vax_status_retarget, herd_immunity) %>%
split(.$vax_status_retarget) %>%
map(describe) %>%
do.call(rbind, .) %>%
data.frame() %>%
select(n, mean , se) %>%
rownames_to_column() %>%
separate(rowname, c("vax_status_retarget", "variable"), sep = "\\.") %>%
filter(variable != "vax_status_retarget*") %>%
pivot_longer(cols = c("n", "mean", "se")) %>%
mutate(column = paste(vax_status_retarget, name, sep = "_")) %>%
select(column, variable, value) %>%
pivot_wider(names_from = column) %>%
arrange(desc(`0_mean`)) %>%
kable(digits = 3,caption = "Summary Statistics for Trust Variables by Vaccination Status",
col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
kable_styling(bootstrap_options = c("striped", "hover"))%>%
add_header_above(c(" " = 1, "Unvaccinated" = 3, "Vaccinated" = 3))
| N | Mean | SE | N | Mean | SE | |
|---|---|---|---|---|---|---|
| herd_immunity | 279 | 0.272 | 0.027 | 760 | 0.353 | 0.017 |
According to the Trust Factor Analysis script here, we
aggregate the following variables into one and perform analysis in this
section:
health_departmentWHOdoctorclinic_workerdf_retarget$institutional_trust_raw = (df_retarget$WHO+df_retarget$doctor+df_retarget$clinic_worker+df_retarget$health_department)/4
df_retarget$institutional_trust_raw = as.factor(df_retarget$institutional_trust_raw)
institutional_trust_df = df_retarget %>% filter(!is.na(institutional_trust_raw))
institutional_trust_plot <- institutional_trust_df %>% count(institutional_trust_raw) %>% mutate(percentage = n / nrow(WHO_df))
ggplot(institutional_trust_plot, aes(x = fct_inorder(institutional_trust_raw), y = n, fill = institutional_trust_raw)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(" (", round(percentage * 100,2), "%)")), vjust = -0.25, size=3) +
ggtitle(paste0("Institutional Trust - Aggregated (n = ", sum(institutional_trust_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
We classify the institutional_trust into 3 levels: -
High: score \(\geq\) 4.0 - Median: 2.5
\(\geq\) score \(\geq\) 3.75 = Low: score \(\leq\) 2.25
df_retarget$institutional_trust_raw = as.numeric(as.character(df_retarget$institutional_trust_raw))
df_retarget$institutional_trust = with(df_retarget,
ifelse(institutional_trust_raw > 3.75, "High",
ifelse(institutional_trust_raw > 2.49, "Medium",
"Low")))
institutional_trust_df = df_retarget %>% filter(!is.na(institutional_trust))
institutional_trust_plot <- institutional_trust_df %>% count(institutional_trust) %>% mutate(percentage = n / nrow(WHO_df))
ggplot(institutional_trust_plot, aes(x = fct_inorder(institutional_trust), y = n, fill = institutional_trust)) +
geom_bar(stat = "identity") +
geom_text(aes(label = paste0(" (", round(percentage * 100,2), "%)")), vjust = -0.25, size=3) +
ggtitle(paste0("Institutional Trust - Aggregated (n = ", sum(institutional_trust_plot$n), ")")) +
theme(plot.title = element_text(face = "bold"), legend.position = "none") +
labs(x = "trust score", y = "count")
df_heard_corr = df_retarget %>%
select(institutional_trust_raw, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Community-Based Organizations` = community_based_org, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media)
df_heard_corr = data.frame(cor(df_heard_corr, use = "pairwise.complete.obs"))
df_heard_corr = df_heard_corr %>%
select(institutional_trust_raw)
#df_future_corr = df_future_corr[!(row.names(df_future_corr) %in% c("vax_next_year")),]
ggcorrplot(df_heard_corr, type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nAggregated Institutional Trust vs Other Trust variables",
caption = paste("Number of Observations:", scales::comma(nrow(df_heard_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
df_retarget %>%
select(institutional_trust, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Community-Based Organizations` = community_based_org, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>%
split(.$institutional_trust) %>%
map(describe) %>%
do.call(rbind, .) %>%
data.frame() %>%
select(n, mean , se) %>%
rownames_to_column() %>%
separate(rowname, c("institutional_trust", "variable"), sep = "\\.") %>%
filter(variable != "institutional_trust*") %>%
pivot_longer(cols = c("n", "mean", "se")) %>%
mutate(column = paste(institutional_trust, name, sep = "_")) %>%
select(column, variable, value) %>%
pivot_wider(names_from = column) %>%
arrange(desc(`High_mean`)) %>%
kable(digits = 3,caption = "Summary Statistics for Trust Variables by Aggregated Institutional Trust",
col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
kable_styling(bootstrap_options = c("striped", "hover")) %>%
add_header_above(c(" " = 1, "High" = 3, "Low" = 3, "Medium" = 3))
| N | Mean | SE | N | Mean | SE | N | Mean | SE | |
|---|---|---|---|---|---|---|---|---|---|
| International Scientists | 828 | 4.037 | 0.042 | 268 | 1.694 | 0.059 | 412 | 2.927 | 0.063 |
| African scientists | 830 | 3.808 | 0.044 | 272 | 1.765 | 0.061 | 414 | 2.841 | 0.065 |
| International NGOs | 826 | 3.723 | 0.042 | 262 | 1.634 | 0.055 | 411 | 2.766 | 0.059 |
| family | 830 | 3.573 | 0.047 | 273 | 2.095 | 0.081 | 417 | 3.151 | 0.072 |
| Community-Based Organizations | 830 | 3.567 | 0.042 | 272 | 1.688 | 0.058 | 417 | 2.504 | 0.056 |
| International News/Media | 826 | 3.489 | 0.044 | 258 | 1.655 | 0.056 | 408 | 2.502 | 0.059 |
| Local News/Media | 826 | 3.249 | 0.046 | 260 | 1.592 | 0.059 | 409 | 2.369 | 0.058 |
| Ministers/Religious Leaders | 830 | 3.164 | 0.049 | 273 | 1.758 | 0.069 | 417 | 2.374 | 0.062 |
| Community Leaders | 830 | 2.902 | 0.047 | 273 | 1.659 | 0.061 | 417 | 2.067 | 0.055 |
| friends | 830 | 2.708 | 0.046 | 273 | 1.861 | 0.071 | 417 | 2.235 | 0.055 |
df_heard_corr = df_retarget %>%
select(institutional_trust_raw, covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance)
df_heard_corr = data.frame(cor(df_heard_corr, use = "pairwise.complete.obs"))
df_heard_corr = df_heard_corr %>%
select(institutional_trust_raw)
#df_future_corr = df_future_corr[!(row.names(df_future_corr) %in% c("vax_next_year")),]
ggcorrplot(df_heard_corr, type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nAggregated Institutional Trust vs Sorting Questions",
caption = paste("Number of Observations:", scales::comma(nrow(df_heard_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
Variable Descriptions:
covid_is_a_problem: People are still dying from
COVIDcovid_is_problem_my_country: COVID is a problem in [my
country]vax_is_safe: I think the COVID vaccines are safevax_prevent_sick_death: COVID vaccines help prevent
serious sickness and deathneed_vax_for_protection: You need a vaccine for
protection from sickness (not because you are sick)vax_safer_covid: Getting the vaccine is much safer than
getting COVIDdeveloper_want_to_help: I think the people who
developed the vaccine wanted to help peoplehealth_worker_want_to_help: I think my local healthcare
workers want me to be healthy and wellgov_want_to_help: I think my government’s department of
health workers want me to be healthy and wellimportant_to_protect_myself: It is important to me that
I protect myself from the effects of COVIDimportant_to_protect_other: It is important to me that
I protect others from the effects of COVIDvax_moral: Getting vaccinated is a moral issueworry_short_term_side_effect: I worry about short-term
side effects of the COVID vaccineworry_long_term_side_effect: I worry about long-term
side effects of the COVID vaccinecovid_is_real: COVID has killed millions of people
worldwideprobably_exposed: I will probably be exposed to someone
with COVID over the next yearafraid_needle: I am very afraid of needlesdeeply_religious: I am a deeply religious personimportant_moral: It is important to me that I be a
moral personfit_in_group_importance: It is important to me to feel
like I “fit in” in with my groupresponsible_importance: It is important to me to feel
like I am a responsible member of my communitydf_retarget %>%
select(institutional_trust, covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>%
split(.$institutional_trust) %>%
map(describe) %>%
do.call(rbind, .) %>%
data.frame() %>%
select(n, mean , se) %>%
rownames_to_column() %>%
separate(rowname, c("institutional_trust", "variable"), sep = "\\.") %>%
filter(variable != "institutional_trust*") %>%
pivot_longer(cols = c("n", "mean", "se")) %>%
mutate(column = paste(institutional_trust, name, sep = "_")) %>%
select(column, variable, value) %>%
pivot_wider(names_from = column) %>%
arrange(desc(`High_mean`)) %>%
kable(digits = 3,caption = "Summary Statistics for Trust Variables by Aggregated Institutional Trust",
col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
kable_styling(bootstrap_options = c("striped", "hover")) %>%
add_header_above(c(" " = 1, "High" = 3, "Low" = 3, "Medium" = 3))
| N | Mean | SE | N | Mean | SE | N | Mean | SE | |
|---|---|---|---|---|---|---|---|---|---|
| important_to_protect_myself | 659 | 4.595 | 0.027 | 144 | 3.771 | 0.115 | 312 | 4.295 | 0.052 |
| important_to_protect_other | 657 | 4.542 | 0.028 | 144 | 3.792 | 0.109 | 310 | 4.290 | 0.050 |
| vax_safer_covid | 661 | 4.365 | 0.036 | 148 | 3.095 | 0.116 | 315 | 3.854 | 0.064 |
| covid_is_real | 655 | 4.344 | 0.037 | 142 | 3.423 | 0.119 | 306 | 3.987 | 0.064 |
| responsible_importance | 647 | 4.338 | 0.035 | 140 | 3.679 | 0.110 | 303 | 4.013 | 0.061 |
| health_worker_want_to_help | 660 | 4.312 | 0.033 | 146 | 3.281 | 0.110 | 314 | 3.844 | 0.054 |
| gov_want_to_help | 661 | 4.300 | 0.031 | 146 | 3.048 | 0.108 | 314 | 3.653 | 0.060 |
| important_moral | 650 | 4.229 | 0.036 | 140 | 3.679 | 0.112 | 303 | 4.030 | 0.058 |
| need_vax_for_protection | 662 | 4.192 | 0.041 | 149 | 3.208 | 0.112 | 316 | 3.696 | 0.072 |
| developer_want_to_help | 661 | 4.150 | 0.038 | 146 | 2.959 | 0.110 | 314 | 3.669 | 0.058 |
| vax_is_safe | 663 | 3.840 | 0.042 | 151 | 2.576 | 0.116 | 316 | 3.282 | 0.061 |
| worry_long_term_side_effect | 657 | 3.828 | 0.045 | 141 | 3.504 | 0.115 | 307 | 3.831 | 0.067 |
| vax_moral | 658 | 3.653 | 0.043 | 143 | 2.825 | 0.112 | 310 | 3.161 | 0.067 |
| deeply_religious | 652 | 3.647 | 0.048 | 140 | 3.264 | 0.122 | 304 | 3.467 | 0.073 |
| vax_prevent_sick_death | 662 | 3.613 | 0.045 | 151 | 2.689 | 0.112 | 315 | 3.098 | 0.063 |
| fit_in_group_importance | 650 | 3.558 | 0.052 | 140 | 3.043 | 0.114 | 303 | 3.333 | 0.075 |
| worry_short_term_side_effect | 657 | 3.531 | 0.045 | 142 | 3.352 | 0.114 | 308 | 3.640 | 0.064 |
| covid_is_a_problem | 665 | 3.325 | 0.046 | 152 | 2.638 | 0.109 | 319 | 3.100 | 0.063 |
| covid_is_problem_my_country | 664 | 3.280 | 0.052 | 151 | 2.424 | 0.113 | 318 | 2.909 | 0.074 |
| afraid_needle | 653 | 2.758 | 0.057 | 141 | 2.730 | 0.123 | 305 | 2.856 | 0.084 |
| probably_exposed | 654 | 2.622 | 0.048 | 142 | 2.599 | 0.110 | 306 | 2.490 | 0.069 |
Variable Descriptions:
covid_is_a_problem: People are still dying from
COVIDcovid_is_problem_my_country: COVID is a problem in [my
country]vax_is_safe: I think the COVID vaccines are safevax_prevent_sick_death: COVID vaccines help prevent
serious sickness and deathneed_vax_for_protection: You need a vaccine for
protection from sickness (not because you are sick)vax_safer_covid: Getting the vaccine is much safer than
getting COVIDdeveloper_want_to_help: I think the people who
developed the vaccine wanted to help peoplehealth_worker_want_to_help: I think my local healthcare
workers want me to be healthy and wellgov_want_to_help: I think my government’s department of
health workers want me to be healthy and wellimportant_to_protect_myself: It is important to me that
I protect myself from the effects of COVIDimportant_to_protect_other: It is important to me that
I protect others from the effects of COVIDvax_moral: Getting vaccinated is a moral issueworry_short_term_side_effect: I worry about short-term
side effects of the COVID vaccineworry_long_term_side_effect: I worry about long-term
side effects of the COVID vaccinecovid_is_real: COVID has killed millions of people
worldwideprobably_exposed: I will probably be exposed to someone
with COVID over the next yearafraid_needle: I am very afraid of needlesdeeply_religious: I am a deeply religious personimportant_moral: It is important to me that I be a
moral personfit_in_group_importance: It is important to me to feel
like I “fit in” in with my groupresponsible_importance: It is important to me to feel
like I am a responsible member of my communityStarred variables have a corresponding variable, with the suffix
_num (ie education_num) that provides a
numeric ordering of the variables. This order is listed in
parenthesis.
| Variable | Description |
|---|---|
| gender* | male (0) or female (1) |
| age | integer 18 to 99 |
| education* | < high school (1), high school (2), some college (3), 2-year degree (4), 4-year degree (5), graduate degree (6), other, prefer not to say |
| location* | rural(1), suburban (2), urban(3), other, prefer not to say |
| religiosity* | not very religious (1), somewhat religious (2), very religious (3), other, prefer not to say |
| white | 1 if the participant is a white or caucasian, 0 if not |
| ethnicity | asian or indian, black or african, coloured, white or caucasian, other, prefer not to say |
df_retarget_num = numeric_cols(df_retarget)
df_heard_corr = df_retarget_num %>%
select(institutional_trust_raw, age, education = education_num, location=location_num, religiosity = religiosity_num, gender = gender_num, white)
df_heard_corr = data.frame(cor(df_heard_corr, use = "pairwise.complete.obs"))
df_heard_corr = df_heard_corr %>%
select(institutional_trust_raw)
#df_future_corr = df_future_corr[!(row.names(df_future_corr) %in% c("vax_next_year")),]
ggcorrplot(df_heard_corr, type = "lower", lab = TRUE, lab_size = 5/.pt, tl.cex = 7, colors= c(cb_colors[1], "white", cb_colors[2])) +
labs(y = "", x = "", title = "Correlation Matrix: \nAggregated Institutional Trust vs Demographics",
caption = paste("Number of Observations:", scales::comma(nrow(df_heard_corr))))+
theme(axis.text.x = element_text(angle = 45, hjust=1))
df_retarget %>%
drop_na(institutional_trust, ethnicity) %>%
count(institutional_trust, ethnicity) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = ethnicity)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "ethnicity",
title = "Distribution of ethnicity by each institutional trust level"
)
df_retarget %>%
drop_na(institutional_trust, demog_religion) %>%
count(institutional_trust, demog_religion) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = demog_religion)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "religion",
title = "Distribution of religion by each institutional trust level"
)
df_SA = df_retarget %>% filter(country_answer == "South Africa")
df_SA$demog_income[!df_SA$demog_income %in% c("< R5,000","R5,000 - R9,999", "R10,000 - R29,999", "R30,000 - R49,999", "R50,000 - R99,999", "> R100,000")] = NA
df_SA$demog_income = factor(df_SA$demog_income, levels=c("< R5,000","R5,000 - R9,999", "R10,000 - R29,999", "R30,000 - R49,999", "R50,000 - R99,999", "> R100,000"))
df_SA %>%
drop_na(institutional_trust, demog_income) %>%
count(institutional_trust, demog_income) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = demog_income)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "income",
title = "Distribution of income by each institutional trust level"
)
df_Kenya = df_retarget %>% filter(country_answer == "Kenya")
df_Kenya$demog_income[!df_Kenya$demog_income %in% c("< 50k KSh","50k KSh - 100k KSh", "100k KSh - 300k KSh", "300k KSh - 500k Ksh", "500k Ksh-1,000k KSh", "> 1,000k KSh")] = NA
df_Kenya$demog_income = factor(df_Kenya$demog_income, levels=c("< 50k KSh","50k KSh - 100k KSh", "100k KSh - 300k KSh", "300k KSh - 500k Ksh", "500k Ksh-1,000k KSh", "> 1,000k KSh"))
df_Kenya %>%
drop_na(institutional_trust, demog_income) %>%
count(institutional_trust, demog_income) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = demog_income)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "income",
title = "Distribution of income by each institutional trust level"
)
df_Nigeria = df_retarget %>% filter(country_answer == "Nigeria")
df_Nigeria$demog_income[!df_Nigeria$demog_income %in% c("< 50,000₦","50,000 - 99,999₦", "100,000₦ - 299,999₦", "300,000₦ - 499,999₦", "500,000₦ - 999,999₦", "> 1,000,000₦")] = NA
df_Nigeria$demog_income = factor(df_Nigeria$demog_income, levels=c("< 50,000₦","50,000 - 99,999₦", "100,000₦ - 299,999₦", "300,000₦ - 499,999₦", "500,000₦ - 999,999₦", "> 1,000,000₦"))
df_Nigeria %>%
drop_na(institutional_trust, demog_income) %>%
count(institutional_trust, demog_income) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = demog_income)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "income",
title = "Distribution of income by each institutional trust level"
)
df_Ghana = df_retarget %>% filter(country_answer == "Ghana")
df_Ghana$demog_income[!df_Ghana$demog_income %in% c("< 5,000GH₵","5,000GH₵ - 9,999GH₵", "10,000GH₵ - 29,999GH", "30,000GH₵ - 49,999GH", "50,000GH₵-99,999GH₵", "> 100,000GH₵")] = NA
df_Ghana$demog_income = factor(df_Ghana$demog_income, levels=c("< 5,000GH₵","5,000GH₵ - 9,999GH₵", "10,000GH₵ - 29,999GH", "30,000GH₵ - 49,999GH", "50,000GH₵-99,999GH₵", "> 100,000GH₵"))
df_Ghana %>%
drop_na(institutional_trust, demog_income) %>%
count(institutional_trust, demog_income) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = demog_income)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "income",
title = "Distribution of income by each institutional trust level"
)
df_retarget %>%
drop_na(institutional_trust, vax_status_retarget) %>%
count(institutional_trust, vax_status_retarget) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = vax_status_retarget)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "vaccine status",
title = "Distribution of vaccine status by each institutional trust level"
)
df_retarget %>%
drop_na(institutional_trust, vax_status_retarget_4) %>%
count(institutional_trust, vax_status_retarget_4) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = vax_status_retarget_4)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "vaccine dose",
title = "Distribution of vaccine dose by each institutional trust level"
)
df_retarget$vax_next_year = as.factor(df_retarget$vax_next_year)
df_retarget %>%
drop_na(institutional_trust, vax_next_year) %>%
count(institutional_trust, vax_next_year) %>%
arrange(institutional_trust) %>%
ggplot(aes(institutional_trust, n, fill = vax_next_year)) +
geom_col(position = "dodge", alpha = 0.8, color="black") +
theme_bw() +
theme(legend.position = "bottom") +
labs(
x = "institutional trust level",
y = "Count",
fill = "intention to get vaccine",
title = "Distribution of intention to get vaccine in future by each institutional trust level"
)
library(glmnet)
Regularized regressions predicting intentions to vaccinate from all the different institutional trust variables and sorting questions
df_Regularized = df_retarget %>%
select(vax_next_year,
doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media,
covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>%
na.omit()
df_Regularized$vax_next_year = strtoi(df_Regularized$vax_next_year)
df_Regularized$vax_next_year[!df_Regularized$vax_next_year %in% c("1","2","3","4","5")] = NA
x = df_Regularized %>%
select(doctor, `Local Health Clinic Worker`, `Department of Health`, WHO, family, friends, `Ministers/Religious Leaders`, `Community Leaders`, `Community-Based Organizations`, `African scientists`, `International Scientists`, `International NGOs`, `Local News/Media`, `International News/Media`,
covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>%
mutate_if(is.character, as.numeric)
#x = as.numeric(x)
x = data.matrix(x)
y = df_Regularized$vax_next_year
cvfit = cv.glmnet(x, y)
print(cvfit)
##
## Call: cv.glmnet(x = x, y = y)
##
## Measure: Mean-Squared Error
##
## Lambda Index Measure SE Nonzero
## min 0.05802 27 1.606 0.04254 15
## 1se 0.14710 17 1.644 0.04045 10
coef(cvfit, s = "lambda.min")
## 36 x 1 sparse Matrix of class "dgCMatrix"
## s1
## (Intercept) -0.048807649
## doctor .
## Local Health Clinic Worker .
## Department of Health 0.066824688
## WHO .
## family .
## friends .
## Ministers/Religious Leaders .
## Community Leaders .
## Community-Based Organizations 0.056618375
## African scientists .
## International Scientists .
## International NGOs .
## Local News/Media .
## International News/Media 0.002843443
## covid_is_a_problem .
## covid_is_problem_my_country 0.024929571
## vax_is_safe 0.214425733
## vax_prevent_sick_death 0.080354398
## need_vax_for_protection 0.043472237
## vax_safer_covid 0.078846333
## developer_want_to_help 0.096599587
## health_worker_want_to_help .
## gov_want_to_help 0.041978636
## important_to_protect_myself .
## important_to_protect_other .
## vax_moral 0.075961889
## worry_short_term_side_effect .
## worry_long_term_side_effect .
## covid_is_real .
## probably_exposed 0.041808640
## afraid_needle .
## deeply_religious 0.011900046
## important_moral .
## fit_in_group_importance 0.005327352
## responsible_importance 0.042700674
df_Regularized = df_retarget %>%
select(vax_next_year,
institutional_trust_raw, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Community-Based Organizations` = community_based_org, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media,
covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>%
na.omit()
df_Regularized$vax_next_year = strtoi(df_Regularized$vax_next_year)
df_Regularized$vax_next_year[!df_Regularized$vax_next_year %in% c("1","2","3","4","5")] = NA
x = df_Regularized %>%
select(institutional_trust_raw, family, friends, `Ministers/Religious Leaders`, `Community Leaders`, `Community-Based Organizations`, `African scientists`, `International Scientists`, `International NGOs`, `Local News/Media`, `International News/Media`,
covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>%
mutate_if(is.character, as.numeric)
#x = as.numeric(x)
x = data.matrix(x)
y = df_Regularized$vax_next_year
cvfit = cv.glmnet(x, y)
print(cvfit)
##
## Call: cv.glmnet(x = x, y = y)
##
## Measure: Mean-Squared Error
##
## Lambda Index Measure SE Nonzero
## min 0.04817 29 1.607 0.06993 15
## 1se 0.17718 15 1.671 0.06407 9
coef(cvfit, s = "lambda.min")
## 33 x 1 sparse Matrix of class "dgCMatrix"
## s1
## (Intercept) -0.188344863
## institutional_trust_raw 0.054739125
## family .
## friends .
## Ministers/Religious Leaders .
## Community Leaders .
## Community-Based Organizations 0.062431561
## African scientists .
## International Scientists .
## International NGOs .
## Local News/Media .
## International News/Media 0.011182500
## covid_is_a_problem .
## covid_is_problem_my_country 0.029398872
## vax_is_safe 0.216371920
## vax_prevent_sick_death 0.077431535
## need_vax_for_protection 0.045570901
## vax_safer_covid 0.084175135
## developer_want_to_help 0.099093909
## health_worker_want_to_help .
## gov_want_to_help 0.046951354
## important_to_protect_myself .
## important_to_protect_other .
## vax_moral 0.076755843
## worry_short_term_side_effect .
## worry_long_term_side_effect .
## covid_is_real .
## probably_exposed 0.047743904
## afraid_needle .
## deeply_religious 0.016622301
## important_moral .
## fit_in_group_importance 0.009360354
## responsible_importance 0.047646207
Regularized regressions predicting trust in WHO from all the different sorting questions and continuous demographic variables
df_retarget_num = numeric_cols(df_retarget)
df_Regularized = df_retarget_num %>%
select(WHO,
covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance,
age, education = education_num, location=location_num, religiosity = religiosity_num, gender = gender_num, white) %>%
na.omit()
x = df_Regularized %>%
select(covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance,
age, education, location, religiosity, gender, white) %>%
mutate_if(is.character, as.numeric)
#x = as.numeric(x)
x = data.matrix(x)
y = as.numeric(df_Regularized$WHO)
cvfit = cv.glmnet(x, y)
print(cvfit)
##
## Call: cv.glmnet(x = x, y = y)
##
## Measure: Mean-Squared Error
##
## Lambda Index Measure SE Nonzero
## min 0.03251 31 1.412 0.08034 15
## 1se 0.19041 12 1.488 0.07547 5
coef(cvfit, s = "lambda.min")
## 28 x 1 sparse Matrix of class "dgCMatrix"
## s1
## (Intercept) 1.529528958
## covid_is_a_problem 0.015983094
## covid_is_problem_my_country 0.040545196
## vax_is_safe 0.090509791
## vax_prevent_sick_death .
## need_vax_for_protection 0.010718201
## vax_safer_covid 0.141460171
## developer_want_to_help 0.100097074
## health_worker_want_to_help .
## gov_want_to_help 0.196787543
## important_to_protect_myself 0.002515641
## important_to_protect_other .
## vax_moral .
## worry_short_term_side_effect .
## worry_long_term_side_effect .
## covid_is_real 0.105457155
## probably_exposed -0.087973193
## afraid_needle .
## deeply_religious 0.010433955
## important_moral .
## fit_in_group_importance .
## responsible_importance 0.053436090
## age -0.009197975
## education .
## location .
## religiosity .
## gender 0.119538942
## white -0.111750891