library(knitr)

opts_chunk$set(echo = T, message = F, warning = F, 
               error = F, cache = F, tidy = F)

library(tidyverse)
library(data.table)
library(broom)
library(langcog)
theme_set(theme_classic(base_size = 10))
wordstosurvey <- read_csv("words_to_survey.csv") %>%
  select(-1) %>%
  janitor::clean_names()  %>%
  select(word, type) %>%
  distinct()

DT::datatable(wordstosurvey)
t_values <- read_csv("/Users/mollylewis/Documents/research/Projects/1_in_progress/VOCAB_SEEDS/analyses/9_t_value_interpolation/data/word_coeffs_log_mtld_diff_24_30.csv")
#t_values <- read_csv("/Users/mollylewis/Documents/research/Projects/1_in_progress/VOCAB_SEEDS/analyses/9_t_value_interpolation/data/word_coeffs_cdi_24_30.csv")


target_ts <- t_values %>%
  right_join(wordstosurvey) 

target_ts %>%
  filter(!is.na(t))%>%
  count(type)
## # A tibble: 2 x 2
##   type        n
##   <chr>   <int>
## 1 control   101
## 2 seed       37
ggplot(target_ts, aes(x = t, fill = type)) +
  geom_density(alpha = .5)

target_ts %>%
  filter(!is.na(t))%>%
  group_by(type) %>%
  multi_boot_standard(col = "t")
## # A tibble: 2 x 4
## # Groups:   type [2]
##   type    ci_lower ci_upper   mean
##   <chr>      <dbl>    <dbl>  <dbl>
## 1 control    0.175    0.403 0.296 
## 2 seed      -0.162    0.303 0.0741