title: “SI_graphs” output: html_document — Horowitz, Mekler, Schneider, Frank, etc. Analyses for Scalar Implicature, Give-Quantifier, and DCCS
Set up Rmd parameters
library(knitr)
## Warning: package 'knitr' was built under R version 3.1.3
opts_chunk$set(cache=TRUE, message=FALSE, warning=FALSE)
Preliminaries
rm(list=ls())
library(ggplot2)
library(reshape)
library(plyr)
library(dplyr)
library(stringr)
library(tidyr)
library(markdown)
library(directlabels)
library(magrittr)
library(bootstrap)
library(RCurl)
library(langcog)
library(RColorBrewer)
theme_set(theme_bw())
Read in individual dataframes from all studies
Experiment 1: Adhoc and scalar items
d <- read.csv("../data/implicatures_adhocScalar_data.csv")
#fill in the selection types for easier analyses
d_exp1=melt.data.frame(d,c("Subj_ID", "age","agegroup", "list"),c("carrots", "hats", "cookies", "trains", "cats", "purses", "keys", "shirts", "breads", "horses", "bears", "frogs", "plates", "books", "elephants", "lamps", "bananas", "butterflies",
"carrots_condition", "hats_condition", "cookies_condition", "trains_condition", "cats_condition", "purses_condition", "keys_condition", "shirts_condition", "breads_condition", "horses_condition", "bears_condition", "frogs_condition", "plates_condition", "books_condition", "elephants_condition", "lamps_condition", "bananas_condition", "butterflies_condition",
"carrots_type", "hats_type", "cookies_type", "trains_type", "cats_type", "purses_type", "keys_type", "shirts_type", "breads_type", "horses_type", "bears_type", "frogs_type", "plates_type", "books_type", "elephants_type", "lamps_type", "bananas_type", "butterflies_type"))
data_exp1 <- d_exp1[1:864,]
data_exp1$condition <- d_exp1$value[865:1728]
data_exp1$type <- d_exp1$value[1729:2592]
names(data_exp1)[5] <- "item"
names(data_exp1)[6] <- "correct"
attach(data_exp1)
data_exp1$trial_type[type == "implicature"] <- "implicature"
data_exp1$trial_type[type != "implicature"] <- "control"
detach(data_exp1)
#rename agegroups for prettier graphs
data_exp1$agegroup %<>%
str_replace("4.0--4.5", "4-4.5 years")%>%
str_replace("4.5--5.0", "4.5-5 years")
data_exp1 %<>%
rename(Age = agegroup)
#age groups
# data_exp1 %<>%
# filter(Subj_ID != "", correct != "NA") %>%
# mutate(agesplit = cut(age, breaks=c(4, 4.5, 5)),
# agesplit = factor(agesplit,
# labels=c("4-4.5 years", "4.5-5 years"))) %>%
# filter(agesplit != "NA")
#renaming for graphs
data_exp1$type <- factor(data_exp1$type,
levels = c("implicature","control_comparison",
"control_distractor",
"control_none","control_unambiguous", "control_all"),
labels = c("Implicature","Comparison",
"Distractor",
"None","Unambig. Some", "All"))
data_exp1$condition <- factor(data_exp1$condition,
levels = c("adhoc","scalar"),
labels = c("Ad-hoc","Scalar"))
# data_exp1 %<>%
# dplyr::rename(Age = agesplit)
Experiment 2: Scalar items only
d2 <- read.csv("../data/implicatures_scalarOnly_data.csv")
data_exp2=melt.data.frame(d2,c("Subj_ID","age","agegroup","list"),c("carrots", "hats", "cookies", "trains", "cats", "purses", "keys", "shirts", "breads", "horses", "bears", "frogs", "plates", "books", "elephants", "lamps", "bananas", "butterflies",
"carrots_selectionType", "hats_selectionType", "cookies_selectionType", "trains_selectionType", "cats_selectionType", "purses_selectionType", "keys_selectionType", "shirts_selectionType", "breads_selectionType", "horses_selectionType", "bears_selectionType", "frogs_selectionType", "plates_selectionType", "books_selectionType", "elephants_selectionType", "lamps_selectionType", "bananas_selectionType", "butterflies_selectionType",
"carrots_type", "hats_type", "cookies_type", "trains_type", "cats_type", "purses_type", "keys_type", "shirts_type", "breads_type", "horses_type", "bears_type", "frogs_type", "plates_type", "books_type", "elephants_type", "lamps_type", "bananas_type", "butterflies_type"))
data <- data_exp2[1:918,]
data$selectionType <- data_exp2$value[919:1836]
data$type <- data_exp2$value[1837:2754]
names(data)[5] <- "item"
names(data)[6] <- "correct"
data_exp2 <- data
attach(data_exp2)
data_exp2$trial_type[type == "some"] <- "implicature"
data_exp2$trial_type[type != "some"] <- "control"
detach(data_exp2)
#rename agegroups
data_exp2$agegroup %<>%
str_replace("3.0--3.5", "3-3.5 years")%>%
str_replace("3.5--4.0", "3.5-4 years")%>%
str_replace("4.0--4.5", "4-4.5 years")%>%
str_replace("4.5--5.0", "4.5-5 years")
data_exp2 %<>%
rename(Age = agegroup)
# data_exp2 %<>%
# filter(Subj_ID != "", correct != "NA") %>%
# mutate(agesplit = cut(age, breaks=c(3, 3.5, 4, 4.5, 5)),
# agesplit = factor(agesplit,
# labels=c("3-3.5 years", "3.5-4 years", "4-4.5 years", "4.5-5 years"))) %>%
# filter(agesplit != "NA")
#renaming for graphs
data_exp2$type <- factor(data_exp2$type,
levels = c("all","none",
"some"),
labels = c("All","None",
"Some"))
data_exp2$selectionType <- factor(data_exp2$selectionType,
levels = c("all","none",
"some"),
labels = c("All","None",
"Some"))
# data_exp2$trial_type <- factor(data_exp2$trial_tyçpe,
# levels = c ("control", "implicature"),
# labels = c("Control", "Implicature"))
# data_exp2 %<>%
# rename(Age = agesplit)
Exp 2 age details
age2 <- data_exp2 %>%
group_by(Age)%>%
summarise(mean = mean(age), sd = sd(age), median = median(age))
Experiment 3: SI, GQ, DCCS Scalar Implicature first
#reading in the original wide-form dataframe
d1 <- read.csv("../data/SI_coding.csv")
#fill in the selection types for easier analyses
d1 %<>%
mutate(carrot_selection = factor(carrot_selection, levels=c(1, 2, 3), labels = c("none", "some", "all")),
hat_selection = factor(hat_selection, levels=c(1, 2, 3), labels = c("all", "some", "none")),
cookies_selection = factor(cookies_selection, levels=c(1, 2, 3), labels = c("none", "some", "all")),
trains_selection = factor(trains_selection, levels=c(1, 2, 3), labels = c("none", "all", "some")),
cats_selection = factor(cats_selection, levels=c(1, 2, 3), labels = c("all", "some", "none")),
purses_selection = factor(purses_selection, levels=c(1, 2, 3), labels = c("none", "some", "all")),
keys_selection = factor(keys_selection, levels=c(1, 2, 3), labels = c("none", "some", "all")),
shirts_selection = factor(shirts_selection, levels=c(1, 2, 3), labels = c("some", "all", "none")),
breads_selection = factor(breads_selection, levels=c(1, 2, 3), labels = c("all", "some", "none")),
horses_selection = factor(horses_selection, levels=c(1, 2, 3), labels = c("all", "some", "none")),
bears_selection= factor(bears_selection, levels=c(1, 2, 3), labels = c("none", "some", "all")),
frogs_selection = factor(frogs_selection, levels=c(1, 2, 3), labels = c("all", "some", "none")),
plates_selection = factor(plates_selection, levels=c(1, 2, 3), labels = c("all", "some", "none")),
books_selection = factor(books_selection, levels=c(1, 2, 3), labels = c("none", "all", "some")),
elephants_selection = factor(elephants_selection, levels=c(1, 2, 3), labels = c("some", "all", "none")),
lamps_selection = factor(lamps_selection, levels=c(1, 2, 3), labels = c("none", "all", "some")),
bananas_selection = factor(bananas_selection, levels=c(1, 2, 3), labels = c("some", "all", "none")),
butterflies_selection = factor(butterflies_selection, levels=c(1, 2, 3), labels = c("none", "some", "all")))
d2=melt.data.frame(d1,c("sub_ID","test_age", "agegroup","training"),c("carrot", "hat", "cookies", "trains", "cats", "purses", "keys", "shirts", "breads", "horses", "bears", "frogs", "plates", "books", "elephants", "lamps", "bananas", "butterflies", "carrot_selection", "hat_selection", "cookies_selection", "trains_selection", "cats_selection", "purses_selection", "keys_selection", "shirts_selection", "breads_selection", "horses_selection", "bears_selection", "frogs_selection", "plates_selection", "books_selection", "elephants_selection", "lamps_selection", "bananas_selection", "butterflies_selection", "carrot_type", "hat_type", "cookies_type", "trains_type", "cats_type", "purses_type", "keys_type", "shirts_type", "breads_type", "horses_type", "bears_type", "frogs_type", "plates_type", "books_type", "elephants_type", "lamps_type", "bananas_type", "butterflies_type"))
#making a respectable df
onethird <- (1/3)*nrow(d2)
data <- d2[1:onethird,]
data$selection <- d2$value[(onethird+1):(onethird*2)]
data$type <- d2$value[(2*onethird+1):nrow(d2)]
names(data)[5] <- "item"
names(data)[6] <- "SI_correct"
data$correct <- data$SI_correct==1
#filtering out NAs, adding agesplit
data %<>%
filter(sub_ID != "", correct != "NA")
data %<>%
rename(Age = agegroup)
#renaming for better-looking graphs
data$type %<>%
str_replace("control_all", "All")%>%
str_replace("control_none", "None")%>%
str_replace("implicature", "Implicature")
data$selection %<>%
str_replace("all", "All")%>%
str_replace("none", "None")%>%
str_replace("some", "Some")
#Find the Mean and median ages
age <- data %>%
dplyr::select(sub_ID, test_age, Age) %>%
dplyr::distinct() %>%
group_by(Age)%>%
summarise(n=n(), avg = mean(test_age))
#use this dataframe for stats
data_SIexp3 <- data %>%
mutate(test = "Scalar Implicature")
#age stats
age <- data %>%
group_by(Age)%>%
summarise(mean = mean(test_age), median = median(test_age), sd = sd(test_age))
GIVE-QUANTIFIER
#read in and establish dataframe
d1 <- read.csv("../data/GQ_coding.csv")
d1[,c(8,10,12,14,16,18,20,22, 31, 32, 33, 34)] <- sapply(d1[,c(8,10,12,14,16,18,20,22, 31, 32, 33, 34)],as.character) #for unknown reasons this is necessary for melt.data.frame now
#change to long form
d2=melt.data.frame(d1,c("sub_ID", "test_age","agegroup", "condition", "training"),c("X1_condition", "X2_condition", "X3_condition", "X4_condition", "X5_condition", "X6_condition", "X7_condition", "X8_condition", "X1_given", "X2_given", "X3_given", "X4_given", "X5_given", "X6_given", "X7_given", "X8_given", "X1_correct", "X2_correct", "X3_correct", "X4_correct", "X5_correct", "X6_correct", "X7_correct", "X8_correct"))
#making a respectable df
onethird <- (1/3)*nrow(d2)
data <- d2[1:onethird,]
data$selection <- d2$value[(onethird+1):(onethird*2)]
data$type <- d2$value[(2*onethird+1):nrow(d2)]
names(data)[6] <- "trial"
names(data)[7] <- "prompt"
names(data)[8] <- "num_given"
names(data)[9] <- "GQ_correct"
#filtering data, creating age breaks
data %<>%
filter(sub_ID != "", num_given != "N/A")%>%
rename(Age = agegroup)
#this is because num_given is a factor - need to change to a number - need to do this for standard error
data$num_given <- as.character(data$num_given)
data$num_given <- as.numeric(data$num_given)
data$GQ_correct <-as.character(data$GQ_correct)
data$GQ_correct <- as.numeric(data$GQ_correct)
#renaming things for prettier graphs
data$prompt %<>%
str_replace("all", "All")%>%
str_replace("most", "Most")%>%
str_replace("some", "Some")%>%
str_replace("none", "None")
#creating dataframe for analyses
data_gq <- data %>%
mutate(test = "Give-Quantifier")
DCCS
#wide-form
d1 <- read.csv("../data/DCCS_coding.csv")
#long form
d2=melt.data.frame(d1,c("sub_ID","test_age", "agegroup", "condition"),c("pre_1", "pre_2", "pre_3", "pre_4", "pre_5", "pre_6", "post_1", "post_2", "post_3", "post_4", "post_5", "post_6"))
#filtering data, creating age breaks
data <- d2 %>%
filter(sub_ID != "")
data %<>%
rename(Age = agegroup)
#renaming things
names(data)[5] <- "trial_type"
names(data)[6] <- "DCCS_correct"
#df for further analyses
data_dccs <- data
data_dccs$test <- "DCCS"
#rename trials
tmp1 <- unlist(data$trial_type)%>%
str_replace("pre_1", "pre")%>%
str_replace("pre_2", "pre")%>%
str_replace("pre_3", "pre")%>%
str_replace("pre_4", "pre")%>%
str_replace("pre_5", "pre")%>%
str_replace("pre_6", "pre")%>%
str_replace("post_1", "post")%>%
str_replace("post_2", "post")%>%
str_replace("post_3", "post")%>%
str_replace("post_4", "post")%>%
str_replace("post_5", "post")%>%
str_replace("post_6", "post")
tmp <- as.data.frame(tmp1) %>%
dplyr::rename(switch_type = tmp1)
tmp2 <- bind_cols(data, tmp)
data <- tmp2
#renaming for prettier graphs
data$switch_type %<>%
str_replace("post", "Post-switch")%>%
str_replace("pre", "Pre-switch")
data$switch_type <- as.factor(data$switch_type)
dccs <- data
GRAPHS
Performance on experiment 1
agg.1<- data_exp1 %>%
mutate(correct = as.integer(correct)) %>%
group_by(condition, type, trial_type, Age)%>%
multi_boot_standard("correct", na.rm=T)
# agg.data <- aggregate(data_exp1$correct, list(data_exp1$condition, data_exp1$type, data_exp1$trial_type, data_exp1$Age), FUN=sum)
# agg.data.len <- aggregate(data_exp1$correct, list(data_exp1$condition, data_exp1$type, data_exp1$trial_type, data_exp1$Age), FUN=length)
# agg.data$x <- agg.data$x
# names(agg.data) <- c("implicature_type", "type", "trial_type", "Age", "correct")
# agg.data$total <- agg.data.len$x
# agg.data$prop.corr <- agg.data$correct / agg.data$total
#
# #find the total number of kids in each age group and n total
# num_kids <- d_exp1 %>%
# dplyr::select(Subj_ID, agegroup) %>%
# dplyr::distinct() %>%
# dplyr::group_by(agegroup)%>%
# dplyr::summarize(n=n())%>%
# dplyr::mutate(total.n = sum(n))
#
# agg.data$sd <- sd(agg.data$prop.corr, na.rm = FALSE)
#
# #prop correct and standard error
# agg.data$q <- 1 - agg.data$prop.corr
# agg.data$err <- sqrt((agg.data$prop.corr * agg.data$q) / agg.data$total)
# agg.data$CIerr <- qnorm(0.975)*agg.data$error/sqrt(n)
# #limits for graphing
# dodge <- position_dodge(width=0.9)
# limits <- aes(ymax = ci_upper, ymin=ci_lower)
#save df for later
# agg.exp1 <- agg.data
#graph
quartz()
ggplot(data = agg.1,
aes(x=type, y=mean, fill=Age)) +
geom_bar(stat="identity", position = position_dodge(1)) +
geom_linerange(aes(ymin = ci_lower,
ymax = ci_upper),
size = .8,
show_guide = FALSE,
position=position_dodge(1)) +
ylab("Proportion correct") +
xlab("Trial Type") +
theme_bw(base_size = 17) + theme(axis.title.x = element_text(size=18),
axis.title.y = element_text(size=18)) +
scale_fill_manual(values = c("#4EB3D3", "#0868AC")) + facet_grid(~condition, scale="free_x") + geom_hline(yintercept = .5, linetype = "dashed")
Histogram of bimodal responses
imp_hist <- data_exp1 %>%
filter(condition == "Scalar" & type == "Implicature")%>%
group_by(Subj_ID)%>%
mutate(correct=as.numeric(correct))%>%
summarise(mean = mean(correct))
quartz()
hist(imp_hist$mean, main = paste('"Some" trials'), xlab = 'Performance on "some" trials', cex.lab=1.5, cex.axis=1.5, cex.main=1.5, cex.sub=1.5)
#ggplot
# quartz()
# ggplot(d, aes(x = correct), width = 50, fill = type) + geom_histogram(stat = "bin", position = "dodge") + ylab("Frequency") + xlab('Proportion of trials correct') + theme_bw(base_size=18) + facet_grid(~type)
none_hist <- data_exp1 %>%
filter(condition == "Scalar" & type == "None") %>%
group_by(Subj_ID)%>%
mutate(correct = as.numeric(correct))%>%
summarise(mean = mean(correct))
quartz()
hist(none_hist$mean, main = paste('"None" trials'), xlab = 'Performance on "none" trials', cex.lab=1.5, cex.axis=1.5, cex.main=1.5, cex.sub=1.5)
Individual differences
data_exp1 %<>%
mutate(correct = as.numeric(correct))
ms <- ddply(data_exp1, .(type, condition, Subj_ID), summarise,
mean = mean(correct),
Age = Age[1])
names(ms) <- c("type", "condition", "Subj_ID", "mean", "Age")
cs <- cast(ms, Subj_ID + Age ~ type + condition, value="mean")
#individual differences plot
quartz()
ggplot(cs, aes(x=None_Scalar, y=Implicature_Scalar, colour=Age)) +
geom_point(stat = "identity", position = position_jitter(.02), shape=16) +
geom_smooth(method="lm", col="black", lty=1) +
geom_smooth(aes(col=Age, group=Age),
se=FALSE, method="lm",lty=3) + scale_colour_manual(values = c("#4EB3D3", "#0868AC")) + theme_bw(base_size=20) + theme(axis.title.y = element_text(size = 18),
axis.title.x = element_text(size = 18)) +
labs(x = 'Proportion of "none" trials correct', y = 'Proportion of "some" trials correct')
Experiment 2
agg.2<- data_exp2 %>%
mutate(correct = as.integer(correct)) %>%
group_by(type, trial_type, Age)%>%
multi_boot_standard("correct", na.rm=T)
# agg.data <- aggregate(data_exp2$correct, list(data_exp2$type, data_exp2$trial_type, data_exp2$Age), FUN=sum)
# agg.data.len <- aggregate(data_exp2$correct, list(data_exp2$type, data_exp2$trial_type, data_exp2$Age), FUN=length)
# agg.data$x <- agg.data$x
# agg.data.len$x <- agg.data.len$x
#
# names(agg.data) <- c( "trial_type", "implicature", "Age", "correct")
# agg.data$total <- agg.data.len$x
# agg.data$prop.corr <- agg.data$correct / agg.data$total
#
# agg.data$q <- 1 - agg.data$prop.corr
# agg.data$err <- sqrt((agg.data$prop.corr * agg.data$q) / agg.data$total)
#
# #save df for later
# agg.exp2 <- agg.data
#graph
quartz()
ggplot(data = agg.2,
aes(x=type, y=mean, fill=Age)) +
geom_bar(stat="identity", position = position_dodge(1)) +
geom_linerange(aes(ymin = ci_lower,
ymax = ci_upper),
size = .8,
show_guide = FALSE,
position=position_dodge(1)) +
ylab("Proportion correct") +
xlab("Trial Type") +
theme_bw(base_size=17) + theme(axis.title.x = element_text(size=18),
axis.title.y = element_text(size=18)) +
scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081")) + geom_hline(yintercept = .5, linetype = "dashed")
# mss.acc <- data_exp2 %>%
# group_by(Subj_ID, type)%>%
# dplyr::summarise(correct=mean(correct),
# Age = Age[1])%>%
# spread(type, correct)
# #individual differences plot
# ggplot(mss.acc, aes(x=None, y=Some, colour=Age)) +
# geom_point(stat = "identity", position = position_jitter(.05), shape=16) +
# geom_smooth(method="lm", col="black", lty=1) +
# geom_smooth(aes(col=Age, group=Age),
# se=FALSE, method="lm",lty=3) +
# labs(x = "Proportion of SI 'none' trials correct", y = "Proportion of SI 'implicature' trials correct") + scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081"))
##analysis of what kinds of items kids chose when they picked the wrong thing
exp2_wrong <- data_exp2 %>%
filter(correct != 1) %>%
group_by(Age, type, selectionType)%>%
dplyr::summarise(n=n())%>%
mutate(n.total = sum(n), prop = n/n.total)
wrong <- exp2_wrong[c(1:12, 14:20),]
#now graph
quartz()
ggplot(data = wrong,
aes(x=selectionType, y=n, fill=Age)) +
geom_bar(stat="identity", position = position_dodge()) +
ylab("Count of children choosing") +
xlab("Selection Type") + facet_wrap(~type) + theme_bw(base_size=17) +
theme(axis.title.x = element_text(size=18),
axis.title.y = element_text(size=18))+
scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081"))
Experiment 3 Scalar Implicatures
# #accuracy by age group in different trials
# agg.data <- aggregate(data_SIexp3$correct, list(data_SIexp3$type, data_SIexp3$Age), FUN=sum)
# agg.data.len <- aggregate(data_SIexp3$correct, list(data_SIexp3$type, data_SIexp3$Age), FUN=length)
# agg.data$x <- agg.data$x
# agg.data.len$x <- agg.data.len$x
#
# names(agg.data) <- c("type", "Age", "correct")
# agg.data$total <- agg.data.len$x
# agg.data$prop.corr <- agg.data$correct / agg.data$total
#
# #prop correct and standard error
# agg.data$q <- 1 - agg.data$prop.corr
# agg.data$err <- sqrt((agg.data$prop.corr * agg.data$q) / agg.data$total)
#
# #save for later
# agg.exp3.si <- agg.data
agg.3 <- data_SIexp3 %>%
mutate(correct = as.integer(correct)) %>%
group_by(type, Age)%>%
multi_boot_standard("correct", na.rm=T)
#plot
quartz()
ggplot(data = agg.3,
aes(x=type, y=mean, fill=Age)) +
geom_bar(stat="identity", position = position_dodge(1)) +
geom_linerange(aes(ymin = ci_lower,
ymax = ci_upper),
size = .8,
show_guide = FALSE,
position=position_dodge(1)) +
ylab("Proportion correct") +
xlab("Trial Type") +
theme_bw(base_size=17) + theme(axis.title.x = element_text(size = 18),
axis.title.y = element_text(size = 18)) +
scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081")) + geom_hline(yintercept = .5, linetype = "dashed")
#What kinds of items are children giving in incorrect trials?
si_wrong <- data_SIexp3 %>%
filter(correct != "TRUE") %>%
group_by(Age, type, selection)%>%
dplyr::summarise(n=n())%>%
mutate(n.total = sum(n), prop = n/n.total)
si_wrong$selection %<>%
str_replace("all", "All")%>%
str_replace("none", "None")%>%
str_replace("some", "Some")
si_wrong$type %<>%
str_replace("Implicature", "Some")
quartz()
ggplot(data = si_wrong,
aes(x=selection, y=n, fill=Age)) +
geom_bar(stat="identity", position = position_dodge()) +
ylab("Count of children choosing") +
xlab("Selection Type") + facet_wrap(~type) + theme_bw(base_size=17) + theme(axis.title.x = element_text(size = 18),
axis.title.y = element_text(size = 18))+
scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081"))
DCCS
agg.DCCS <- dccs %>%
mutate(DCCS_correct = as.integer(DCCS_correct)) %>%
group_by(switch_type, Age)%>%
multi_boot_standard("DCCS_correct", na.rm=T)
agg.DCCS$switch_type <- factor(agg.DCCS$switch_type, levels=c("Pre-switch","Post-switch"))
agg.DCCS %<>%
filter(switch_type=="Post-switch")
quartz()
ggplot(data = agg.DCCS,
aes(x=switch_type, y=mean, fill=Age)) +
geom_bar(stat="identity", position = position_dodge(1)) +
geom_linerange(aes(ymin = ci_lower,
ymax = ci_upper),
size = .8,
show_guide = FALSE,
position=position_dodge(1)) +
ylab("Proportion correct") +
xlab("Trial Type") +
theme_bw(base_size=17) + theme(axis.title.x = element_text(size = 18),
axis.title.y = element_text(size = 18)) +
scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081")) + geom_hline(yintercept = .5, linetype = "dashed")
GQ
agg.gq <- data_gq %>%
mutate(GQ_correct = as.integer(GQ_correct)) %>%
group_by(prompt, Age)%>%
multi_boot_standard("GQ_correct", na.rm=T)
quartz()
ggplot(data = agg.gq,
aes(x=prompt, y=mean, fill=Age)) +
geom_bar(stat="identity", position = position_dodge(1)) +
geom_linerange(aes(ymin = ci_lower,
ymax = ci_upper),
size = .8,
show_guide = FALSE,
position=position_dodge(1)) +
ylab("Proportion correct") +
xlab("Quantifier Prompt") +
theme_bw(base_size=17) + theme(axis.title.x = element_text(size=18),
axis.title.y = element_text(size=18)) +
scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081")) + geom_hline(yintercept = .5, linetype = "dashed")
hist_data <- data_gq %>%
filter(prompt != "Most")%>%
group_by(Age, prompt, num_given)%>%
dplyr::summarise(n = n()) %>%
group_by(Age, prompt) %>%
mutate(n.total = sum(n), prop = n/n.total)
quartz()
ggplot(data = hist_data,
aes(x=num_given, y=prop, fill=Age)) +
geom_bar(stat="identity", position = position_dodge(1)) +
ylab("Proportion of children giving number") +
xlab("Number of items") +
theme_bw(base_size=17) + theme(axis.title.x = element_text(size = 18),
axis.title.y = element_text(size=18)) +
scale_fill_manual(values = c("#4EB3D3", "#2B8CBE", "#0868AC", "#084081")) + facet_grid(prompt~Age) + theme(legend.position="none")