All item x country subsets have 1500 participants.
d <- list.files("data/emd_ds/", pattern = "*.csv") %>%
purrr::map(function(x) paste0("data/emd_ds/", x)) %>%
purrr::map(read_csv) %>%
bind_rows()
cues = read_csv("data/extreme_cues.csv") %>%
select(cue, conc.bin)
d %<>% left_join(cues, by=c("word" = "cue")) %>%
mutate(conc.bin = as.factor(conc.bin),
dist = log(dist))
all_countries = unique(c(d$country2,d$country1))
# get same countries for every word
all.combos = combinations(n = length(all_countries),
r = 2,
repeats.allowed = F,
v = all_countries) %>%
as.data.frame() %>%
rename(country1 = V1, country2 = V2)
# get movers as matrix
all_movers_mats = get_movers_dist_mat(d, all.combos)
# take the mean movers distances across items
all.means = apply(simplify2array(all_movers_mats), c(1,2), mean, na.rm = T)
# plot
ggdendrogram(hclust(dist(all.means)), size = 2) +
ggtitle("all")
# get movers as matrix
all_movers.high = get_movers_dist_mat(filter(d, conc.bin == 6) , all.combos)
# take the mean movers distances across items
all.means.high = apply(simplify2array(all_movers.high), c(1,2), mean, na.rm = T)
# plot
ggdendrogram(hclust(dist(all.means.high)), size = 2)+
ggtitle("concrete")
# get movers as matrix
all_movers.low = get_movers_dist_mat(filter(d,conc.bin == 1) , all.combos)
# take the mean movers distances across items
all.means.low = apply(simplify2array(all_movers.low), c(1,2), mean, na.rm = T)
# plot
ggdendrogram(hclust(dist(all.means.low)), size = 2) +
ggtitle("abstract")
d %>%
ggplot(aes(x = dist, fill = conc.bin, color = conc.bin, group = conc.bin), ) +
geom_density(alpha = .2) +
theme_bw()
dist.means = d %>%
mutate(conc.bin = as.factor(conc.bin)) %>%
group_by(conc.bin) %>%
multi_boot_standard(column = "dist", na.rm = T)
ggplot(dist.means, aes(x = conc.bin, y = mean,
fill = conc.bin, color = conc.bin, group = conc.bin)) +
#geom_bar(position = "dodge", stat = "identity") +
geom_pointrange(aes(ymax = ci_upper, ymin = ci_lower),
position=position_dodge(.9), size = .4) +
ggtitle("Mean Distance")+
theme_bw()
dist.var = d %>%
mutate(conc.bin = as.factor(conc.bin)) %>%
group_by(conc.bin) %>%
multi_boot_standard(column = "dist",
na.rm = T, empirical_function = "var")
ggplot(dist.var, aes(x = conc.bin, y = var,
fill = conc.bin, color = conc.bin, group = conc.bin)) +
ggtitle("Distance Variance")+
geom_pointrange(aes(ymax = ci_upper, ymin = ci_lower),
position=position_dodge(.9), size = .4) +
theme_bw()
Abstract words show more variability between countries in terms of their similarity (movers distance).
Red indicates similarity (small distance).
d %>%
ggplot( aes(x = country2, y = country1)) +
facet_wrap(~word, ncol = 4, scales = "free") +
geom_raster(aes(fill = dist)) +
scale_fill_gradient2(low = "red",
high = "blue", na.value="black", name = "" ) +
ggtitle("country-wise movers distances") +
theme_bw() +
theme(axis.text.x = element_text(angle = 90,
hjust = 1, vjust =.25, size = 4),
axis.text.y = element_text(size = 4),
axis.title = element_blank())
library(circlize)
n = 18
hues = seq(15, 375, length = n + 1)
cols = hcl(h = hues, l = 65, c = 100)[1:n]
inverse.high = 1/all.means.high
inverse.high[is.infinite(inverse.high)] = 0
inverse.high[inverse.high < -1] = 0
chordDiagram(t(inverse.high), annotationTrack = "grid", preAllocateTracks = 1, grid.col = cols, col = "grey", directional = 0)
# add labels
circos.trackPlotRegion(track.index = 2, panel.fun = function(x, y) {
xlim = get.cell.meta.data("xlim")
ylim = get.cell.meta.data("ylim")
sector.index = get.cell.meta.data("sector.index")
circos.text(mean(xlim), mean(ylim), sector.index, col = "black", cex = 0.6, facing = "outside", niceFacing = TRUE)
}, bg.border = NA)
library(ggnetwork)
library(intergraph)
library(igraph)
graph <- dist.size %>%
select(country1, country2) %>%
graph_from_data_frame(directed = FALSE)
E(graph)$weight=dist.size$mean # add in weights
ggplot(ggnetwork(asNetwork(graph)),
aes(x = x, y = y, xend = xend, yend = yend)) +
geom_edges(aes(size = weight/100), color = "grey50") +
geom_nodes() +
#geom_nodelabel(aes(label = vertex.names , size = 2)) +
ggtitle("cathodal") +
theme_blank()
```