Load packages and set plot theme
library(tidyverse)
library(ggthemes)
library(here)
library(DT)
theme_set(theme_few(base_size = 16))
knitr::opts_chunk$set(fig.width = 6, fig.height = 4, cache = TRUE,
message = FALSE, warn = FALSE)
Set up the model
word_difficulties <- tibble(word = 1:10000,
difficulty = rnorm(n = 10000, mean = 4000,
sd = 1000))
datatable(word_difficulties, rownames = FALSE)
ggplot(word_difficulties, aes(x = difficulty)) +
geom_freqpoly() +
labs(x = "ease of acquisition", y = "# of words")
How many words are learned by each time step?
timesteps <- tibble(time = 1:6000)
learned_by_timestep <- timesteps %>%
group_by(time) %>%
mutate(learned = sum(time >= pull(word_difficulties, difficulty)))
datatable(learned_by_timestep, rownames = FALSE)
ggplot(learned_by_timestep, aes(x = time, y = learned)) +
geom_line() +
scale_x_continuous(breaks = seq(0, 6000, 1000)) +
labs(x = "time step", y = "words learned")