| Title: | Accessing the 'Wordbank' Database |
|---|---|
| Description: | Connecting to 'Wordbank' <https://wordbank.stanford.edu>, an open repository for developmental vocabulary data from the MacArthur-Bates Communicative Development Inventories (Frank et al. 2017 <doi:10.1017/S0305000916000209>). Data are read from a versioned dataset hosted on 'Redivis', so analyses can be pinned to a specific release. |
| Authors: | Mika Braginsky [aut, cre, cph], Daniel Yurovsky [ctb], Michael Frank [ctb], Danielle Kellier [ctb], Alvin Tan [ctb] |
| Maintainer: | Mika Braginsky <[email protected]> |
| License: | GPL-3 |
| Version: | 2.0.0 |
| Built: | 2026-09-30 19:54:06 UTC |
| Source: | https://github.com/langcog/wordbankr |
For each item in the input data, estimate its age of acquisition as the earliest age (in months) at which the proportion of children who understand/produce the item is greater than some threshold. The proportions used can be empirical or first smoothed by a model.
fit_aoa( instrument_data, measure = "produces", method = "glm", proportion = 0.5, age_min = min(instrument_data$age, na.rm = TRUE), age_max = max(instrument_data$age, na.rm = TRUE) )fit_aoa( instrument_data, measure = "produces", method = "glm", proportion = 0.5, age_min = min(instrument_data$age, na.rm = TRUE), age_max = max(instrument_data$age, na.rm = TRUE) )
instrument_data |
A data frame returned by |
measure |
One of "produces" or "understands" (defaults to "produces"). |
method |
A string indicating which smoothing method to use:
|
proportion |
A number between 0 and 1 indicating threshold proportion of children. |
age_min |
The minimum age to allow for an age of acquisition. Defaults
to the minimum age in |
age_max |
The maximum age to allow for an age of acquisition. Defaults
to the maximum age in |
A data frame where every row is an item, the item-level columns from
the input data are preserved, and the aoa column contains the age of
acquisition estimates.
eng_ws_data <- get_instrument_data(language = "English (American)", form = "WS", items = c("item_1", "item_42"), administration_info = TRUE) if (!is.null(eng_ws_data)) eng_ws_aoa <- fit_aoa(eng_ws_data)eng_ws_data <- get_instrument_data(language = "English (American)", form = "WS", items = c("item_1", "item_42"), administration_info = TRUE) if (!is.null(eng_ws_data)) eng_ws_aoa <- fit_aoa(eng_ws_data)
Fit quantiles to vocabulary sizes using quantile regression
fit_vocab_quantiles(vocab_data, measure, group, quantiles = "standard")fit_vocab_quantiles(vocab_data, measure, group, quantiles = "standard")
vocab_data |
A data frame returned by |
measure |
A column of |
group |
(Optional) A column of |
quantiles |
Either one of "standard" (default), "deciles", "quintiles", "quartiles", "median", or a numeric vector of quantile values. |
A data frame with the columns "language", "form", "age", group
(if specified), "quantile", and measure, where measure is the
fit vocabulary value for that quantile at that age.
eng_wg <- get_administration_data(language = "English (American)", form = "WG", include_demographic_info = TRUE) if (!is.null(eng_wg)) { vocab_quantiles <- fit_vocab_quantiles(eng_wg, production) vocab_quantiles_sex <- fit_vocab_quantiles(eng_wg, production, sex) vocab_quartiles <- fit_vocab_quantiles(eng_wg, production, quantiles = "quartiles") }eng_wg <- get_administration_data(language = "English (American)", form = "WG", include_demographic_info = TRUE) if (!is.null(eng_wg)) { vocab_quantiles <- fit_vocab_quantiles(eng_wg, production) vocab_quantiles_sex <- fit_vocab_quantiles(eng_wg, production, sex) vocab_quartiles <- fit_vocab_quantiles(eng_wg, production, quantiles = "quartiles") }
Get the Wordbank by-administration data
get_administration_data( language = NULL, form = NULL, filter_age = TRUE, include_demographic_info = FALSE, include_birth_info = FALSE, include_health_conditions = FALSE, include_language_exposure = FALSE, include_study_internal_id = FALSE, version = "current" )get_administration_data( language = NULL, form = NULL, filter_age = TRUE, include_demographic_info = FALSE, include_birth_info = FALSE, include_health_conditions = FALSE, include_language_exposure = FALSE, include_study_internal_id = FALSE, version = "current" )
language |
An optional string specifying which language's administrations to retrieve. |
form |
An optional string specifying which form's administrations to retrieve. |
filter_age |
A logical indicating whether to filter the administrations to ones in the instrument's age range. |
include_demographic_info |
A logical indicating whether to include the
child's demographic information ( |
include_birth_info |
A logical indicating whether to include the
child's birth information ( |
include_health_conditions |
A logical indicating whether to include
the child's health condition information (a nested dataframe under
|
include_language_exposure |
A logical indicating whether to include
the child's language exposure information at time of administration (a
nested dataframe under |
include_study_internal_id |
A logical indicating whether to include the child's ID in the original study data. |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A data frame where each row is a CDI administration and each column
is a variable about the administration or the corresponding child,
including which dataset_version it came from.
english_ws_admins <- get_administration_data("English (American)", "WS")english_ws_admins <- get_administration_data("English (American)", "WS")
Age-of-acquisition estimates for every word item on every instrument,
precomputed with fit_aoa (glm method, 50
data release. aoa is NA for items that do not reach the
threshold within the instrument's age range.
get_aoa(language = NULL, form = NULL, measure = NULL, version = "current")get_aoa(language = NULL, form = NULL, measure = NULL, version = "current")
language |
An optional string specifying which language's estimates to retrieve. |
form |
An optional string specifying which form's estimates to retrieve. |
measure |
An optional string ( |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A data frame with one row per instrument item and measure:
language, form, item_id, item_definition,
category, uni_lemma, measure, aoa,
dataset_version.
danish_aoa <- get_aoa(language = "Danish", form = "WS")danish_aoa <- get_aoa(language = "Danish", form = "WS")
Get item-by-age summary statistics for items across languages
get_crossling_data(uni_lemmas, version = "current")get_crossling_data(uni_lemmas, version = "current")
uni_lemmas |
A character vector of uni_lemmas. |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A dataframe with a row for each combination of language, item, and
age, and columns for summary statistics for the group: number of children
(n_children), means (comprehension, production),
standard deviations (comprehension_sd, production_sd); and
item-level variables (item_id, definition, uni_lemma,
lexical_category, lexical_class, dataset_version).
## Not run: # downloads item-level data from every instrument, which takes minutes crossling_data <- get_crossling_data(uni_lemmas = "dog") ## End(Not run)## Not run: # downloads item-level data from every instrument, which takes minutes crossling_data <- get_crossling_data(uni_lemmas = "dog") ## End(Not run)
Get the uni_lemmas available in Wordbank
get_crossling_items(version = "current")get_crossling_items(version = "current")
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A data frame with the columns uni_lemma and
dataset_version.
uni_lemmas <- get_crossling_items()uni_lemmas <- get_crossling_items()
Get the Wordbank data sources
get_datasets( language = NULL, form = NULL, admin_data = FALSE, version = "current" )get_datasets( language = NULL, form = NULL, admin_data = FALSE, version = "current" )
language |
An optional string specifying which language's datasets to retrieve. |
form |
An optional string specifying which form's datasets to retrieve. |
admin_data |
A logical indicating whether to include the number of administrations in the dataset. |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A data frame where each row is a particular dataset and its
characteristics, including which dataset_version it came from.
english_ws_datasets <- get_datasets("English (American)", "WS")english_ws_datasets <- get_datasets("English (American)", "WS")
Semantic embeddings for every unique word item definition, computed with
Google's multilingual gemini-embedding-001 model (768 dimensions).
All languages share one embedding space, so cosine similarities are
meaningful both within and across languages.
get_embeddings(language = NULL, version = "current")get_embeddings(language = NULL, version = "current")
language |
An optional string specifying which language's embeddings to retrieve. |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A data frame with one row per unique item definition:
language, item_definition, embedding (a
list-column of numeric vectors), and dataset_version.
danish_embeddings <- get_embeddings(language = "Danish")danish_embeddings <- get_embeddings(language = "Danish")
Get the Wordbank administration-by-item data
get_instrument_data( language, form, items = NULL, administration_info = FALSE, item_info = FALSE, version = "current", ... )get_instrument_data( language, form, items = NULL, administration_info = FALSE, item_info = FALSE, version = "current", ... )
language |
A string of the instrument's language. |
form |
A string of the instrument's form. |
items |
A character vector of item ids (e.g. |
administration_info |
Either a logical indicating whether to include
administration data or a data frame of administration data (as returned
by |
item_info |
Either a logical indicating whether to include item data
or a data frame of item data (as returned by |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
... |
Additional arguments, ignored (for backward compatibility). |
A data frame where each row contains the values (value,
produces, understands) of a given item (item_id) for
a given administration (data_id), with additional columns of
variables about the administration and item, as specified, and
dataset_version.
eng_ws_data <- get_instrument_data(language = "English (American)", form = "WS", items = c("item_1", "item_42"))eng_ws_data <- get_instrument_data(language = "English (American)", form = "WS", items = c("item_1", "item_42"))
Get the Wordbank instruments
get_instruments(version = "current")get_instruments(version = "current")
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A data frame where each row is a CDI instrument and each column is
a variable about the instrument (instrument_id, language,
form, form_type, age_min, age_max,
has_grammar, unilemma_coverage, dataset_version).
instruments <- get_instruments()instruments <- get_instruments()
Get the Wordbank by-item data
get_item_data(language = NULL, form = NULL, version = "current")get_item_data(language = NULL, form = NULL, version = "current")
language |
An optional string specifying which language's items to retrieve. |
form |
An optional string specifying which form's items to retrieve. |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A data frame where each row is a CDI item and each column is a
variable about it: item_id, item_kind,
item_definition, english_gloss, language,
form, form_type, category, lexical_category,
lexical_class, complexity_category, uni_lemma,
dataset_version.
english_ws_items <- get_item_data("English (American)", "WS")english_ws_items <- get_item_data("English (American)", "WS")
Get item-by-age summary statistics
summarise_items(item_data, version = "current")summarise_items(item_data, version = "current")
item_data |
A dataframe as returned by |
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A dataframe with a row for each combination of item and age, and
columns for summary statistics for the group: number of children
(n_children), means (comprehension, production),
standard deviations (comprehension_sd, production_sd); also
retains item-level variables from lang_items (item_id,
item_definition, uni_lemma, lexical_category) and
dataset_version.
italian_items <- get_item_data(language = "Italian", form = "WG") if (!is.null(italian_items)) { italian_dog <- dplyr::filter(italian_items, uni_lemma == "dog") italian_dog_summary <- summarise_items(italian_dog) }italian_items <- get_item_data(language = "Italian", form = "WG") if (!is.null(italian_items)) { italian_dog <- dplyr::filter(italian_items, uni_lemma == "dog") italian_dog_summary <- summarise_items(italian_dog) }
Returns a reference to the Wordbank Redivis dataset (https://stanford.redivis.com/datasets/627v-9ewzpdvz0).
wb_dataset(version = "current")wb_dataset(version = "current")
version |
A string specifying which version of the Wordbank dataset
to use, e.g. |
A redivis dataset reference.