Closed tjmahr closed 6 years ago
Child did better on the nonwords than the mispronunciations. Something something Swingley and Aslin (2007).
library(L2TDatabase) library(dplyr) library(ggplot2) cnf_file <- file.path(getwd(), "inst/l2t_db.cnf") l2t <- l2t_connect(cnf_file, db_name = "l2t") results <- tbl(l2t, "MPNormingClosed_Items") %>% collect() %>% rename_all(stringr::str_replace, "MPNormingClosed_", "") ggplot(results) + aes(x = Type, y = Correct) + stat_summary( aes(group = ResearchID), position = position_jitter(width = .3, height = 0.02), color = "grey20") + stat_summary( aes(color = Type))
Okay, here are the participants' abilities as estimated in a Bayesian mixed effects item response model.
library(rstanarm) m <- stan_glmer( Correct ~ Type + (1 | ResearchID/Type) + (1 | Item), family = binomial, data = results, prior = normal(0, 1)) # Get one row per ID and condition so the prediction function # can condition on the ID and ID:Type effects but not the Item # effects try <- results %>% distinct(ResearchID, Type, Item, ItemNumber) %>% group_by(ResearchID, Type) %>% top_n(1, ItemNumber) %>% ungroup() # This is a helper from my personal Bayesian package :) p <- tristan::augment_posterior_linpred( m, newdata = try, re.form = ~ (1 | ResearchID/Type), transform = TRUE) p_mean <- tristan::augment_posterior_linpred( m, newdata = try %>% filter(ResearchID == "001L"), re.form = NA, transform = TRUE) ggplot(p) + aes(x = Type, y = .posterior_value) + stat_summary( aes(group = ResearchID), fun.data = median_hilow, fun.args = list(conf.int = .9), position = position_jitter(width = .25), alpha = .4) + stat_summary( aes(color = Type), data = p_mean, fun.data = median_hilow, fun.args = list(conf.int = .9), size = 1) + guides(color = FALSE) + labs( x = NULL, y = "Proportion correct", caption = "Points: Posterior median and 90% intervals")
Child did better on the nonwords than the mispronunciations. Something something Swingley and Aslin (2007).
Okay, here are the participants' abilities as estimated in a Bayesian mixed effects item response model.