Do you subscribe to the Data is Plural newsletter from Jeremy Singer-Vine? You probably should, because it is a treasure trove of interesting datasets arriving in your email inbox. In the November 28 edition, Jeremy linked to the Small World of Words project, and I was entranced. I love stuff like that, all about words and how people think of them. I have been mulling around a blog post ever since, and today I finally have my post done, so let’s see what’s up!
It’s a Small World
The Small World of Words project focuses on word associations. You can try it out for yourself to see how it works, but the general idea is that the participant is presented with a word (from “telephone” to “journalist” to “yoga”) and is then asked to give their immediate association with that word. The project has collected more than 15 million responses to date, and is still collecting data. You can check out some pre-built visualizations the researchers have put together to explore the dataset, or you can download the data for yourself.
library(tidyverse)
swow_raw %
select(-education, -X1) %__%
mutate(gender = case_when(gender == &quot;Fe&quot; ~ &quot;Women&quot;,
gender == &quot;Ma&quot; ~ &quot;Men&quot;,
gender == &quot;X&quot; ~ &quot;Non-binary&quot;),
gender = fct_infreq(gender))
swow_raw
## # A tibble: 1,228,200 x 11
## id participantID age gender nativeLanguage country created_at cue R1 R2 ## ## 1 29 3 33 Women United States Australia 2011-08-12 02:19:38 although nevertheless yet ## 2 30 3 33 Women United States Australia 2011-08-12 02:19:38 deal no cards ## 3 31 3 33 Women United States Australia 2011-08-12 02:19:38 music notes band ## 4 32 3 33 Women United States Australia 2011-08-12 02:19:38 inform tell rat on ## 5 33 3 33 Women United States Australia 2011-08-12 02:19:38 way path via ## 6 34 3 33 Women United States Australia 2011-08-12 02:19:38 none zilch nada ## 7 35 3 33 Women United States Australia 2011-08-12 02:19:38 extra plus special
## 8 36 3 33 Women United States Australia 2011-08-12 02:19:38 will free future ## 9 37 3 33 Women United States Australia 2011-08-12 02:19:38 paper book news ## 10 38 3 33 Women United States Australia 2011-08-12 02:19:38 w v x ## R3 ## ## 1 but ## 2 shake ## 3 rhythm ## 4 ## 5 method ## 6 zero ## 7 additional
## 8 death ## 9 writing ## 10 what ## # ... with 1,228,190 more rows
The available dataset as it exists when I downloaded it includes 1,228,200 word associations (each of which involve four words, i.e. three connections) by 83,864 unique participants. When a participant starts on a word association, this project has them move forward through three hops in a chain, from cue to R1 to R2 to R3, and then start over with a new cue. Participants can go through many cues in any given session.
Participants can also report other information about themselves. For example, what is the age distribution?
median_age %
distinct(participantID, age) %__% pull(age) %__% median()
swow_raw %__%
distinct(participantID, age) %__%
ggplot(aes(age)) +
geom_histogram(alpha = 0.8, binwidth = 5, fill = &quot;midnightblue&quot;) +
labs(title = &quot;Age distribution of Small World of Words participants&quot;,
subtitle = paste(&quot;The median age is&quot;, median_age))
There are lots of young folks represented in this project, as is typical for online surveys. What about gender?
swow_raw %__%
distinct(participantID, gender) %__%
count(gender) %__%
mutate(Percent = n / sum(n)) %__%
ggplot(aes(fct_reorder(gender, n), Percent)) +
geom_col(alpha = 0.8, fill = &quot;midnightblue&quot;) +
coord_flip() +
scale_y_continuous(labels = percent_format(),
expand = c(0,0)) +
labs(x = NULL, y = &quot;% of participants&quot;,
title = &quot;Gender distribution of Small World of Words participants&quot;,
subtitle = &quot;More than 60% of participants identify as women&quot;)
In this project, women were more likely to participate than other genders.
This project is international, pulling participants from many native languages. It also allows folks to specify whether they are a US English speaker, a UK English speaker, etc.
native_languages % distinct(participantID, nativeLanguage) %__% pull(nativeLanguage)
swow_raw %__%
distinct(participantID, nativeLanguage) %__%
count(nativeLanguage) %__%
top_n(15) %__%
ggplot(aes(fct_reorder(nativeLanguage, n), n)) +
geom_col(alpha = 0.8, fill = &quot;midnightblue&quot;) +
coord_flip() +
scale_y_continuous(labels = comma_format(),
expand = c(0,0)) +
labs(x = NULL, y = &quot;Number of participants&quot;,
title = &quot;Native languages of Small World of Words participants&quot;,
subtitle = paste(&quot;About&quot;, percent(mean(native_languages == &quot;United States&quot;)),
&quot;of participants say their native language is US English&quot;))
So that’s a little bit of EDA to understand this project and its participants. Now let’s dig into the word associations!
Building forward associations
This is a rich, detailed dataset and there are so many directions we could go with it. In taking a first stab, let’s look at all the forward associations in the whole project. This means we will treat the “hop” from the cue to the first association the same as the “hop” from the first to second association, which certainly isn’t entirely correct. It’s a choice to start from, though.
swow_forward % select(from = cue, to = R1, gender, age, nativeLanguage) %__%
bind_rows(
swow_raw %__% select(from = R1, to = R2, gender, age, nativeLanguage)
) %__%
bind_rows(
swow_raw %__% select(from = R2, to = R3, gender, age, nativeLanguage)
) %__%
filter(!is.na(to))
swow_forward
## # A tibble: 3,403,790 x 5
## from to gender age nativeLanguage
## ## 1 although nevertheless Women 33 United States ## 2 deal no Women 33 United States ## 3 music notes Women 33 United States ## 4 inform tell Women 33 United States ## 5 way path Women 33 United States ## 6 none zilch Women 33 United States ## 7 extra plus Women 33 United States ## 8 will free Women 33 United States ## 9 paper book Women 33 United States ## 10 w v Women 33 United States ## # ... with 3,403,780 more rows
Now that we have all the forward associations, we can find the most common associations for any individual word with some simple dplyr operations. What about… coffee? ☕
swow_forward %__%
filter(from == &quot;coffee&quot;) %__%
count(to, sort = TRUE)
## # A tibble: 711 x 2
## to n
## ## 1 tea 80
## 2 milk 33
## 3 drink 31
## 4 Starbucks 28
## 5 caffeine 15
## 6 cup 15
## 7 morning 15
## 8 hot 13
## 9 chocolate 12
## 10 island 12
## # ... with 701 more rows
via GIPHY
Or… maybe you are in a holiday Christmas celebratory mood, and want to know what people associate with the word “Christmas”.
swow_forward %__%
filter(from == &quot;Christmas&quot;) %__%
count(to, sort = TRUE)
## # A tibble: 759 x 2
## to n
## ## 1 birthday 56
## 2 holiday 45
## 3 tree 43
## 4 Santa 34
## 5 snow 33
## 6 happy 31
## 7 red 29
## 8 presents 28
## 9 winter 24
## 10 Jesus 19
## # ... with 749 more rows
via GIPHY
Comparing groups
This project recorded information about the participants themselves, so we can dig into how different kinds of people associate words. For example, let’s start with gender and comparing folks who identify as men and women. What differences do we see with the word “water”?
swow_forward %__%
filter(from == &quot;water&quot;,
gender %in% c(&quot;Men&quot;, &quot;Women&quot;)) %__%
group_by(to) %__%
filter(n() __ 30) %__%
ungroup %__%
count(gender, to, sort = TRUE) %__%
spread(gender, n, fill = 0) %__%
mutate_if(is.numeric, funs((. + 1) / (sum(.) + 1))) %__%
mutate(logratio = log2(Women / Men)) %__%
top_n(15, abs(logratio)) %__%
ggplot(aes(fct_reorder(to, logratio), logratio, fill = logratio __ 0)) +
geom_col(alpha = 0.8, show.legend = FALSE) +
coord_flip() +
labs(x = NULL, y = &quot;log odds ratio (Women/Men)&quot;,
title = &quot;What words do Small World of Words' participants associate with water?&quot;,
subtitle = &quot;Women are more likely to mention sinks and baths\nMen are more likely to say steam and air&quot;) Notice the dramatic contrasts between domestic water uses like sinks and baths with more scientific word about water like steam. We see how socialized and differentiated women’s language is, even with something that seems neutral like water.
What about differences between US and UK English?
swow_forward %__%
filter(from == &quot;love&quot;,
nativeLanguage %in% c(&quot;United States&quot;, &quot;United Kingdom&quot;)) %__%
group_by(to) %__%
filter(n() __ 30) %__%
ungroup %__%
count(nativeLanguage, to, sort = TRUE) %__%
spread(nativeLanguage, n, fill = 0) %__%
mutate_if(is.numeric, funs((. + 1) / (sum(.) + 1))) %__%
mutate(logratio = log2(`United States` / `United Kingdom`)) %__%
ggplot(aes(fct_reorder(to, logratio), logratio, fill = logratio __ 0)) +
geom_col(alpha = 0.8, show.legend = FALSE) +
coord_flip() +
labs(x = NULL, y = &quot;log odds ratio (US/UK)&quot;,
title = &quot;What words do Small World of Words' participants associate with love?&quot;,
subtitle = &quot;US participants associate love with hate\nUK participants feel more affectionate&quot;) Well, alrighty then. 😳
Changes with age
We can apply some functional programming and modeling to look at how these word associations change with age. Let’s take the word “money”, and start by calculating, for 5-year bins, the number and proportion of words associated for each bin.
swow_freq %
filter(from == &quot;money&quot;,
age __ 80) %__%
mutate(age = age %/% 5 * 5) %__%
count(age, to) %__%
complete(age, to, fill = list(n = 0)) %__%
group_by(age) %__%
mutate(age_total = sum(n),
percent = n / age_total) %__%
ungroup %__%
group_by(to) %__%
filter(sum(n) __ 25) %__%
ungroup
swow_freq
## # A tibble: 741 x 5
## age to n age_total percent
## ## 1 15 bank 47 1118 0.0420 ## 2 15 banks 7 1118 0.00626
## 3 15 bills 2 1118 0.00179
## 4 15 business 11 1118 0.00984
## 5 15 buy 7 1118 0.00626
## 6 15 car 4 1118 0.00358
## 7 15 cash 30 1118 0.0268 ## 8 15 change 5 1118 0.00447
## 9 15 charity 5 1118 0.00447
## 10 15 cheap 5 1118 0.00447
## # ... with 731 more rows
Now let’s fit some models using glm() since this is count data to predict the counts out of the total for each age bin from the age. We can then tidy() the output of the modeling, adjust the p-values for multiple comparisons since we looked at a bunch of words at one time, and make a volcano-style plot to compare the effect size with the p-value.
library(broom)
library(ggrepel)
slopes %
nest(-to) %__%
mutate(models = map(data, ~ glm(cbind(n, age_total) ~ age, ., family = &quot;binomial&quot;))) %__%
unnest(map(models, tidy)) %__%
filter(term == &quot;age&quot;) %__%
arrange(estimate) %__%
mutate(p.value = p.adjust(p.value))
slopes %__%
ggplot(aes(estimate, p.value)) +
geom_vline(xintercept = 0, lty = 2, alpha = 0.7, color = &quot;gray50&quot;) +
geom_point(color = &quot;midnightblue&quot;, alpha = 0.8, size = 2.5) +
scale_y_log10() +
geom_text(data = filter(slopes,
p.value __= 0.5),
aes(label = to),
family = &quot;IBMPlexSans&quot;,
vjust = 0, nudge_y = 0.02,
check_overlap = TRUE) +
geom_text_repel(data = filter(slopes,
p.value __ 0.5),
aes(label = to),
family = &quot;IBMPlexSans&quot;) +
labs(x = &quot;Estimated change with age&quot;,
y = &quot;Adjusted p-value&quot;,
title = &quot;What words do Small World of Words' participants associate with money?&quot;,
subtitle = &quot;Older participants are more likely to say stocks or dollars\nYounger participants are more likely to talk about a job or the color green&quot;)
The younger someone is, the more likely they are to associate money with a job, or the color green or gold. The older someone is, the more likely they are to associate money with dollars and stocks. Let’s look at the top terms associated with money that exhibit change with age in terms of a small p-value.
slopes %__%
top_n(6, -p.value) %__%
inner_join(swow_freq) %__%
ggplot(aes(age, percent)) +
geom_point() +
geom_smooth() +
facet_wrap(~ to) +
scale_y_continuous(labels = percent_format()) +
labs(x = &quot;Age of participant&quot;,
y = &quot;Frequency of word in association with money&quot;,
title = &quot;What words do Small World of Words' participants associate with money?&quot;,
subtitle = &quot;Words like debt and gold decrease in frequency with age&quot;)
Younger respondents were more likely to associate words like DEBT with money. 😵
The End
There is so much more that could be done with this dataset. You could build a network data structure between the words and do various kinds of network analysis, and I didn’t touch any of the differences in the intial cue vs. the later hops. Notice that this dataset is all about words, but I didn’t ever load the tidytext package for this analysis. The researchers who built this dataset have already done much of the hard work of processing this data, and it is more like structured data that happens to be about language, rather than unstructured text data. Let me know if you have any questions!