library(knitr)
opts_chunk$set(echo = T, message = F, warning = F,
error = F, cache = F, tidy = F)
library(tidyverse)
library(langcog)
library(here)
library(broom)
theme_set(theme_classic(base_size = 10))
get_p_print <- function(p){
case_when(p < .0001 ~ "< .0001",
p < .001 ~ "< .001",
p < .01 ~ "< .01",
p < .05 ~ "< .05",
TRUE ~ paste0("= ", round(p, 2)))
}
theme_set(theme_classic(base_size = 12))
This analysis is identical to that reported in our manuscript draft. The only difference (I think) is that hypernyms is log transformed here, but isn’t for the mcdi analysis in the paper.
RATINGS_PATH <- here("data/ratings_tidy_childes.csv")
word_ratings <- read_csv(RATINGS_PATH)
HYPERNYMS_PATH <- here("exploratory_analyses/17_taxonomic_childes/data/childes_hypernyms_hyponyms_nouns_verbs_12_36_tidy.csv")
hypernyms <- read_csv(HYPERNYMS_PATH) %>%
filter(type == "all") %>%
select(-type) %>%
filter(!is.na(value))
all_words <- full_join(word_ratings, hypernyms, by = "word") %>%
mutate(log_value = log(value + .01)) %>%
filter(!is.na(mean_rating_subj_scaled))
all_words %>%
ggplot(aes(x = log_value)) +
geom_histogram() +
facet_wrap(~measure, scale = "free_x")
all_words_wide <- all_words %>%
select(word, mean_rating_subj_scaled,mean_rating, pos, measure, log_value) %>%
pivot_wider(names_from = "measure", values_from = "log_value")
hyponym_hypernym_cor_print <- cor.test(all_words_wide$hyponyms, all_words_wide$hypernyms) %>%
tidy() %>%
mutate(p_sig = get_p_print(p.value),
r_string = paste0("_r_(", parameter ,") = ", round(estimate, 2), ", _p_ ", p_sig)) %>%
pull(r_string)
# hypo
hyponym_human_cor <- cor.test(all_words_wide$hyponyms,
all_words_wide$mean_rating_subj_scaled) %>%
tidy()
hyponym_human_cor_print <- hyponym_human_cor %>%
mutate(p_sig = get_p_print(p.value),
r_string = paste0("_r_(", parameter ,") = ", round(estimate, 3), ", _p_ ", p_sig)) %>%
pull(r_string)
hypo_plot <- ggplot(all_words_wide %>% filter(!is.na(pos)), aes(x = hyponyms, y = mean_rating_subj_scaled)) +
geom_point(alpha = .3, aes(color = pos)) +
ylab("Human Generality Rating") +
annotate("text",
label = paste0("r = ", round(hyponym_human_cor$estimate, 2)),
y = -.75,
x = 6,
color = "red",
size = 5) +
ylim(-1.25, 1.5) +
xlab("Wordnet Superordinate Score") +
geom_smooth(method = "lm") +
theme(legend.position = "none")
# hyper
hypernym_human_cor <- cor.test(all_words_wide$hypernyms,
all_words_wide$mean_rating_subj_scaled) %>%
tidy()
hypernym_human_cor_print <- hypernym_human_cor %>%
mutate(p_sig = get_p_print(p.value),
r_string = paste0("_r_(", parameter ,") = ", round(estimate, 3), ", _p_ ", p_sig)) %>%
pull(r_string)
hyper_plot <- ggplot(all_words_wide %>% filter(!is.na(pos)), aes(x = hypernyms, y = mean_rating_subj_scaled)) +
geom_point(alpha = .23,aes(color = pos)) +
ylab("Human Generality Rating") +
annotate("text",
label = paste0("r = ", round(hypernym_human_cor$estimate, 2)),
y = -.75,
x = 2,
color = "red",
size = 5) +
ylim(-1.25, 1.5) +
xlab("Wordnet Subordinate Score") +
geom_smooth(method = "lm") +
scale_color_discrete(name = "Part of Speech",
label = c("Noun", "Verb"))
cowplot::plot_grid(hypo_plot, hyper_plot,
rel_widths = c(1, 1.35),
labels = c("a", "b"))
rating_model_raw <- lm(scale(mean_rating_subj_scaled) ~ scale(hypernyms) + scale(hyponyms), data = all_words_wide) %>%
summary()
rating_model <- rating_model_raw %>%
tidy() %>%
mutate(p_sig = get_p_print(p.value),
pretty_model = paste0(round(estimate,2), ", _SE_ = ", round(std.error,2),
", _Z_ = ", round(statistic,2), ", _p_ ", p_sig))
Generality (M = 0.91; SD = 3.1) and specificity scores (M = 1.31; SD = 0.92) calculated form Wordnet were weakly correlated with each other (r(761) = 0.08, p < .05). Human judgements of word generality (unscaled: M = 3; SD = 1; scaled: M = 0; SD = 1) were moderately correlated with both generality (r(761) = 0.278, p < .0001) and specificity scores (r(761) = -0.276, p < .0001): Words judged by human participants as more general tended to have more subordinate relations and fewer superordinate relations (Fig. @ref(fig:human-wordnet)). In an additive linear model predicting human generality judgements, both word generality (\(\beta\) = 0.3, SE = 0.03, Z = 9.08, p < .0001) and specificity (\(\beta\) = -0.3, SE = 0.03, Z = -9.04, p < .0001) predicted independent variance in judgements (R2 = 0.16).
pos_word_counts <- all_words_wide %>%
count(pos)
cor_by_pos <- all_words %>%
group_by(pos, measure) %>%
nest() %>%
mutate(temp = map(data, ~ cor.test(.$log_value, .$mean_rating_subj_scaled) %>% tidy())) %>%
select(-data) %>%
unnest() %>%
mutate(p_sig = get_p_print(p.value),
r_string = paste0("_r_(", parameter ,") = ",
round(estimate, 2), ", _p_ ", p_sig)) %>%
select(pos, measure, r_string)
We next asked whether the relationship between human judgements and generality/specificity scores differed by part of speech. There was a reliable relationship between human judgements and Wordnet generality scores for both nouns (r(379) = 0.34, p < .0001) and verbs (r(380) = 0.3, p < .0001). The relationship between human judgements and Wordnet specificity scores was stronger for nouns (r(379) = -0.47, p < .0001), than verbs (r(380) = -0.09, p = 0.08).
In sum, these analyses suggest that word generality is a psychological relevant variable and that lexical database measures are reasonble approximations of word generality.