Created
October 11, 2024 19:27
-
-
Save mcfrank/8aa14ca358b2ddf636c2987fa4ed49eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(wordbankr) | |
eng_wg_inst <- wordbankr::get_instrument_data(form = "WG", language = "English (American)", | |
item_info = TRUE, administration_info = TRUE) | |
by_cat <- eng_wg_inst |> | |
filter(item_kind == "word") |> | |
group_by(data_id, lexical_category, age) |> | |
summarise(prod = sum(produces), | |
comp = sum(understands), | |
prod_comp_ratio = prod / (prod + comp)) | |
ggplot(filter(by_cat, !(lexical_category == "function_words")), | |
aes(x = age, y = prod_comp_ratio, col = lexical_category)) + | |
geom_jitter(alpha = .2, size = 0.7) + | |
geom_smooth() + | |
scale_x_continuous(breaks = seq(8, 18, 1)) + | |
xlab("Age (months)") + | |
ylab("Productivity ratio") | |
by_sem <- eng_wg_inst |> | |
filter(item_kind == "word") |> | |
group_by(data_id, category, age) |> | |
summarise(prod = sum(produces), | |
comp = sum(understands), | |
prod_comp_ratio = prod / (prod + comp)) | |
ggplot(filter(by_sem, !(category %in% c("question_words","quantifiers","pronouns"))), | |
aes(x = age, y = prod_comp_ratio, col = category)) + | |
geom_jitter(alpha = .2, size = 0.7) + | |
geom_smooth() + | |
scale_x_continuous(breaks = seq(8, 18, 1)) + | |
xlab("Age (months)") + | |
ylab("Productivity ratio") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment