Replication of Xu and Tenenbaum 2007a, Experiment 1. N = 50 participants (original: N = 22).

Read in raw data and anonymize

files = dir("../production-results/")
d = data.frame()
for (i in 1:length(files)[1]) {
    s <- fromJSON(paste("../production-results/", files[i], sep = ""))
    s$answers$asses = ifelse (is.null(s$answers$asses), "NA", s$answers$asses)
    d = rbind(d, data.frame(s))
}
names(d) <- str_replace(names(d), "answers.", "")
d.anonymized <- anonymize.sids(d, "WorkerId")

write.csv(d.anonymized, "exp1_A.csv")

Munge

d = read.csv("exp1_A.csv")

d.long = d %>%
  gather(variable, value, contains("_")) %>%
  mutate(trial_num =  unlist(lapply(strsplit(as.character(variable),
                                      "_T"),function(x) x[2])),
         variable = unlist(lapply(strsplit(as.character(variable),
                                      "_"),function(x) x[1]))) %>%
  spread(variable, value) %>%
  mutate(trial_num = as.numeric(trial_num)) %>%
  mutate_if(is.character, funs(as.factor)) 

d.munged = d.long %>%
          select(subids, trial_num, category, condition, selected) %>%
          mutate(selected = lapply(str_split(selected, ","), 
                                   function(x) {str_sub(x, 4, 6)})) %>%
          mutate(prop_sub = lapply(selected, function(x){sum(x == "sub")/2}),
                 prop_bas = lapply(selected, function(x){sum(x == "bas")/2}),
                 prop_sup = lapply(selected, function(x){sum(x == "sup")/4})) %>%
          select(-selected)

Reproduce XT2007a Figure 5.

ms = d.munged %>%
  gather(variable, value, c(prop_sub, prop_bas, prop_sup)) %>%
  group_by(condition,variable) %>%
  mutate(value = as.numeric(value)) %>%
  multi_boot_standard(column = "value")  %>%
  mutate(variable = as.factor(variable))

ms$variable = factor(ms$variable,levels(ms$variable)[c(2,1,3)])
ms$condition = factor(ms$condition,levels(ms$condition)[c(1,3,2,4)])
ms$condition = plyr::mapvalues(ms$condition,
                               from = c("one", "three_basic", 
                                        "three_subordinate",
                                        "three_superordinate"), 
                               to = c("1", "3 basic", "3 sub.", "3 super."))

ggplot(ms, aes(x = condition, y = mean, group = variable, fill = variable)) +
  geom_bar(position = "dodge", stat = "identity") +
  geom_linerange(aes(ymin = ci_lower, 
                     ymax = ci_upper), 
                 position=position_dodge(width = .9)) +
  ylab("Proportion of \ntest objects chosen") +
  xlab("Examples") +
  theme_bw() +
  theme(legend.title = element_blank())

XT 2007a, Figure 5 (for reference)

XT 2007a, Figure 5 (for reference)

By category

ms = d.munged %>%
  gather(variable, value, c(prop_sub, prop_bas, prop_sup)) %>%
  mutate(variable = as.factor(variable)) %>%
  group_by(condition,variable,category) %>%
  mutate(value = as.numeric(value)) %>%
  multi_boot_standard(column = "value") 

ms$variable = factor(ms$variable,levels(ms$variable)[c(2,1,3)])
ms$condition = factor(ms$condition,levels(ms$condition)[c(1,3,2,4)])
ms$condition = plyr::mapvalues(ms$condition,
                               from = c("one", "three_basic", 
                                        "three_subordinate", "three_superordinate"), 
                               to = c("1", "3 basic", "3 sub.", "3 super."))

ggplot(ms, aes(x = condition, y = mean, group = variable, fill = variable)) +
  facet_grid(~category) +
  geom_bar(position = "dodge", stat = "identity") +
  geom_linerange(aes(ymin = ci_lower, 
                     ymax = ci_upper), 
                 position=position_dodge(width = .9)) +
  ylab("Proportion of \ntest objects chosen") +
  xlab("Examples") +
  theme_bw() +
  theme(legend.title = element_blank())

Post-task questions

d %>%
  group_by(education) %>%
  summarise(n = n()) %>%
  kable()
education n
0 1
1 6
2 14
3 27
4 2
d %>%
  group_by(enjoyment) %>%
  summarise(n = n()) %>%
  kable()
enjoyment n
1 16
2 34
d %>%
  mutate(language = tolower(language)) %>%
  group_by(language) %>%
  summarise(n = n()) %>%
  kable()
language n
english 49
italian 1
d %>%
  group_by(gender) %>%
  summarise(n = n()) %>%
  kable()
gender n
22
Female 13
Male 15
d %>%
  group_by(asses) %>%
  summarise(n = n()) %>%
  kable()
asses n
Confused 1
No 1
Yes 26
NA 22
d %>%
  mutate(age = as.numeric(as.character(age))) %>%
  ggplot(aes(x= age)) +
  geom_histogram() +
  theme_bw() +
  ggtitle("Age distribution")

unique(d$comments)
##  [1]                                                                                                                                                                                               
##  [2] It was interesting and I will probably wonder if I did it correctly or not. I don't think I did in the beginning.                                                                             
##  [3] It has been funny, I hope I understood correctly what I had to do                                                                                                                             
##  [4] None                                                                                                                                                                                          
##  [5] Thanks!                                                                                                                                                                                       
##  [6] I had no clue what was happening... At one point it didn't tell me what to even do. Just had blank images, then it had school buses and jalapeno images. I have no idea what just happened... 
##  [7] quite confusing.                                                                                                                                                                              
##  [8] Not enough attention to cats, ha ha!                                                                                                                                                          
##  [9] Thank you!                                                                                                                                                                                    
## [10] None thanks                                                                                                                                                                                   
## [11] Thanks!                                                                                                                                                                                       
## [12] Mr Frog is a demanding little guy.                                                                                                                                                            
## [13] Thank You                                                                                                                                                                                     
## [14] Enjoyed the hit, it was a fun challenge.                                                                                                                                                      
## [15] Thanks for letting me participate!                                                                                                                                                            
## [16] Thank you for the study it was fun : )                                                                                                                                                        
## [17] ty                                                                                                                                                                                            
## 17 Levels:  ... ty