# read data
library(readr)
tdata <- read_csv("tdata_final.csv")
Demographics
table(tdata$gender) #%>% sum()
##
## 1: male 2: female 3: non-binary
## 248 168 2
## 4: prefer not to say
## 2
#tdata$age <- as.numeric(tdata$age)
mean(tdata$age)
## [1] 38.27857
sd(tdata$age)
## [1] 13.8709
min(tdata$age)
## [1] 18
max(tdata$age)
## [1] 87
Data handling
# add a column that represents the transformations as a factor
tdata$Transformation <- factor(tdata$test_stimulus,
levels = c("img/Left_Y_Symmetry_Big.svg",
"img/Left_Y_Symmetry_Angle.svg",
"img/Left_Y_Symmetry_X_Rotation.svg",
"img/Left_Y_Symmetry_X_Rotation_180.svg",
"img/Left_Y_Symmetry_X_Symmetry.svg",
"img/Left_Y_Symmetry_Y_Translation.svg",
"img/Left_Y_Symmetry_X_Translation.svg",
"img/Right_Y_Symmetry_Big.svg",
"img/Right_Y_Symmetry_Angle.svg",
"img/Right_Y_Symmetry_X_Rotation.svg",
"img/Right_Y_Symmetry_X_Rotation_180.svg",
"img/Right_Y_Symmetry_X_Symmetry.svg",
"img/Right_Y_Symmetry_Y_Translation.svg",
"img/Right_Y_Symmetry_X_Translation.svg"),
labels = c("Size",
"Shape",
"90-Rot.",
"180-Rot.",
"X-Refl.",
"Y-Tran.",
"X-Tran.",
"Size",
"Shape",
"90-Rot.",
"180-Rot.",
"X-Refl.",
"Y-Tran.",
"X-Tran."))
# add another column that codes the side of the y-symm transformation as a factor
tdata$Side <- factor(tdata$Ysym_side, levels = c("left", "right"), labels = c("left", "right"))
tdata$selection_rec <- factor(tdata$dv_selection_rec, levels = c("Ysym", "None", "not-Ysym"), labels = c("Y-Refl.", "None", "Not-Y-Refl."))
table(tdata$condition)
##
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14
## 30 30 30 30 30 30 30 30 30 30 30 30 30 30
table(tdata$Transformation)
##
## Size Shape 90-Rot. 180-Rot. X-Refl. Y-Tran. X-Tran.
## 60 60 60 60 60 60 60
Graphs
# create a summary dataset that also contains the percentages
plotdata_between <- tdata %>%
group_by(Transformation, selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
plotdata_sub <- subset(plotdata_between, selection_rec == "Y-Refl.")
Get the CI values that will be plotted as error bars:
see: https://rcompanion.org/handbook/H_02.html
# create a summary dataset that also contains the percentages
plotdata_between <- tdata %>%
group_by(Transformation, selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
library(PropCIs)
library(DescTools)
library(purrr)
plotdata_between %>%
filter(Transformation == "Size") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> size_ci)
## est lwr.ci upr.ci
## [1,] 0.08333333 0.01666667 0.1825168
## [2,] 0.08333333 0.01666667 0.1825168
## [3,] 0.83333333 0.76666667 0.9325168
plotdata_between %>%
filter(Transformation == "Shape") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> shape_ci)
## est lwr.ci upr.ci
## [1,] 0.2000000 0.10000000 0.3279634
## [2,] 0.1333333 0.03333333 0.2612967
## [3,] 0.6666667 0.56666667 0.7946300
plotdata_between %>%
filter(Transformation == "90-Rot.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> ninerot_ci)
## est lwr.ci upr.ci
## [1,] 0.1833333 0.06666667 0.3214156
## [2,] 0.2833333 0.16666667 0.4214156
## [3,] 0.5333333 0.41666667 0.6714156
plotdata_between %>%
filter(Transformation == "180-Rot.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> huneightyrot_ci)
## est lwr.ci upr.ci
## [1,] 0.15 0.03333333 0.2768899
## [2,] 0.25 0.13333333 0.3768899
## [3,] 0.60 0.48333333 0.7268899
plotdata_between %>%
filter(Transformation == "X-Refl.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> xrefl_ci)
## est lwr.ci upr.ci
## [1,] 0.1500000 0.03333333 0.2803028
## [2,] 0.2666667 0.15000000 0.3969695
## [3,] 0.5833333 0.46666667 0.7136362
plotdata_between %>%
filter(Transformation == "Y-Tran.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> ytran_ci)
## est lwr.ci upr.ci
## [1,] 0.2166667 0.1000000 0.3634550
## [2,] 0.4000000 0.2833333 0.5467884
## [3,] 0.3833333 0.2666667 0.5301217
plotdata_between %>%
filter(Transformation == "X-Tran.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> xtran_ci)
## est lwr.ci upr.ci
## [1,] 0.1666667 0.05 0.3100649
## [2,] 0.4666667 0.35 0.6100649
## [3,] 0.3666667 0.25 0.5100649
ci_low <- c(size_ci[,2], shape_ci[,2], ninerot_ci[,2], huneightyrot_ci[,2], xrefl_ci[,2], ytran_ci[,2], xtran_ci[,2])
ci_up <- c(size_ci[,3], shape_ci[,3], ninerot_ci[,3], huneightyrot_ci[,3], xrefl_ci[,3], ytran_ci[,3], xtran_ci[,3])
plotdata$ci_low <- ci_low
plotdata$ci_up <- ci_up
library(scales)
theme_set(theme_light(base_size = 12, base_family = "Poppins"))
pvalues_x <- c(1:7)
pvalues <- c(rep("p < .001",6), "p = .057")
g<- ggplot(plotdata,
aes(x = Transformation,
y = pct,
fill = selection_rec)) +
geom_bar(stat = "identity",
position = "dodge") +
scale_y_continuous(limits = seq(0, 2),
breaks = seq(0, 1, .25),
expand = c(0,0),
label = percent) +
coord_cartesian(xlim =c(1, 7), ylim = c(0, 1.1))+
#coord_cartesian(clip = "off")+
geom_text(aes(label = lbl),
size = 3.5,
position = position_dodge(width = 1),
vjust = -7) +
scale_fill_brewer(palette = "Pastel1") +
labs(y = "Percentage",
fill = "Selected Object",
x = "Type of Transformation")+
geom_pointrange(ymin = ci_low, ymax = ci_up, position = position_dodge(width = 0.89), shape = 22, size = 0.3)+
#annotate(geom = "hline",yintercept = 0.5, y = 0.5, color = "black", size = 1, linetype='dotted')+
#annotate("pointrange", x = plotdata$Transformation, y = plotdata$pct,
# ymin = plotdata$ci_low,
# ymax = plotdata$ci_up,
# colour = "black", size = 0.8, shape = 22, fill = Transformation, fatten = 1)+
#annotate("text", x = pvalues_x, y = Inf, label = pvalues, size = 4, vjust = 1.8)+
theme(legend.position = "top", axis.title = element_text(size = 15), axis.text = element_text(size = 13, color = "black"),
legend.text = element_text(size = 13),legend.title = element_text(size = 13))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
g
#ggsave("selections_between.pdf",width=6,height=5)
ggsave("selections_dodged.svg",width=12,height=5)
ggsave("selections_dodged.pdf",width=12,height=5)
The method “sisongalz” is the default method. It is also the most
recently developed method, and we’ll go with it. We nonetheless may want
to check whether other methods lead immensely different results.
Data from pilot
study
The pilot study was mostly identical with the main study but tested
fewer subjects. One difference from the main study was that the pilot
study contained an additional “explanation” screen where subjects were
asked to write short explanations of their choice.
tdata_p <- read_csv("tdata_pilot.csv")
table(tdata_p$gender) #%>% sum()
##
## 1: male 2: female 3: non-binary
## 110 97 1
## 4: prefer not to say
## 2
#tdata_p$age <- as.numeric(tdata_p$age)
mean(tdata_p$age)
## [1] 36.74286
sd(tdata_p$age)
## [1] 12.04897
min(tdata_p$age)
## [1] 18
max(tdata_p$age)
## [1] 72
# add a column that represents the transformations as a factor
tdata_p$Transformation <- factor(tdata_p$test_stimulus,
levels = c("img/Left_Y_Symmetry_Big.svg",
"img/Left_Y_Symmetry_Angle.svg",
"img/Left_Y_Symmetry_X_Rotation.svg",
"img/Left_Y_Symmetry_X_Rotation_180.svg",
"img/Left_Y_Symmetry_X_Symmetry.svg",
"img/Left_Y_Symmetry_Y_Translation.svg",
"img/Left_Y_Symmetry_X_Translation.svg",
"img/Right_Y_Symmetry_Big.svg",
"img/Right_Y_Symmetry_Angle.svg",
"img/Right_Y_Symmetry_X_Rotation.svg",
"img/Right_Y_Symmetry_X_Rotation_180.svg",
"img/Right_Y_Symmetry_X_Symmetry.svg",
"img/Right_Y_Symmetry_Y_Translation.svg",
"img/Right_Y_Symmetry_X_Translation.svg"),
labels = c("Size",
"Shape",
"90-Rot.",
"180-Rot.",
"X-Refl.",
"Y-Tran.",
"X-Tran.",
"Size",
"Shape",
"90-Rot.",
"180-Rot.",
"X-Refl.",
"Y-Tran.",
"X-Tran."))
# add another column that codes the side of the y-symm transformation as a factor
tdata_p$Side <- factor(tdata_p$Ysym_side, levels = c("left", "right"), labels = c("left", "right"))
tdata_p$selection_rec <- factor(tdata_p$dv_selection_rec, levels = c("Ysym", "None", "not-Ysym"), labels = c("Y-Refl.", "None", "Not-Y-Refl."))
table(tdata_p$condition)
##
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14
## 15 15 15 15 15 15 15 15 15 15 15 15 15 15
table(tdata_p$Transformation)
##
## Size Shape 90-Rot. 180-Rot. X-Refl. Y-Tran. X-Tran.
## 30 30 30 30 30 30 30
# create a summary dataset that also contains the percentages
plotdata_between <- tdata_p %>%
group_by(Transformation, selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
plotdata_sub <- subset(plotdata_between, selection_rec == "Y-Refl.")
Get the CI values that will be plotted as error bars:
see: https://rcompanion.org/handbook/H_02.html
# create a summary dataset that also contains the percentages
plotdata_between <- tdata_p %>%
group_by(Transformation, selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
library(PropCIs)
library(DescTools)
library(purrr)
plotdata_between %>%
filter(Transformation == "Size") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> size_ci)
## est lwr.ci upr.ci
## [1,] 0.03333333 0.00000000 0.1863803
## [2,] 0.16666667 0.06666667 0.3197136
## [3,] 0.80000000 0.70000000 0.9530469
plotdata_between %>%
filter(Transformation == "Shape") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> shape_ci)
## est lwr.ci upr.ci
## [1,] 0.1 0.0 0.2505313
## [2,] 0.1 0.0 0.2505313
## [3,] 0.8 0.7 0.9505313
plotdata_between %>%
filter(Transformation == "90-Rot.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> ninerot_ci)
## est lwr.ci upr.ci
## [1,] 0.06666667 0.0 0.2408286
## [2,] 0.36666667 0.2 0.5408286
## [3,] 0.56666667 0.4 0.7408286
plotdata_between %>%
filter(Transformation == "180-Rot.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> huneightyrot_ci)
## est lwr.ci upr.ci
## [1,] 0.06666667 0.0 0.2408286
## [2,] 0.36666667 0.2 0.5408286
## [3,] 0.56666667 0.4 0.7408286
plotdata_between %>%
filter(Transformation == "X-Refl.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> xrefl_ci)
## est lwr.ci upr.ci
## [1,] 0.3000000 0.13333333 0.4950908
## [2,] 0.2333333 0.06666667 0.4284241
## [3,] 0.4666667 0.30000000 0.6617575
plotdata_between %>%
filter(Transformation == "Y-Tran.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> ytran_ci)
## est lwr.ci upr.ci
## [1,] 0.2666667 0.1 0.4620621
## [2,] 0.4666667 0.3 0.6620621
## [3,] 0.2666667 0.1 0.4620621
plotdata_between %>%
filter(Transformation == "X-Tran.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> xtran_ci)
## est lwr.ci upr.ci
## [1,] 0.1666667 0.03333333 0.3642141
## [2,] 0.2333333 0.10000000 0.4308808
## [3,] 0.6000000 0.46666667 0.7975475
ci_low <- c(size_ci[,2], shape_ci[,2], ninerot_ci[,2], huneightyrot_ci[,2], xrefl_ci[,2], ytran_ci[,2], xtran_ci[,2])
ci_up <- c(size_ci[,3], shape_ci[,3], ninerot_ci[,3], huneightyrot_ci[,3], xrefl_ci[,3], ytran_ci[,3], xtran_ci[,3])
plotdata$ci_low <- ci_low
plotdata$ci_up <- ci_up
library(scales)
theme_set(theme_light(base_size = 12, base_family = "Poppins"))
pvalues_x <- c(1:7)
pvalues <- c(rep("p < .001",6), "p = .057")
g<- ggplot(plotdata,
aes(x = Transformation,
y = pct,
fill = selection_rec)) +
geom_bar(stat = "identity",
position = "dodge") +
scale_y_continuous(limits = seq(0, 2),
breaks = seq(0, 1, .25),
expand = c(0,0),
label = percent) +
coord_cartesian(xlim =c(1, 7), ylim = c(0, 1.1))+
#coord_cartesian(clip = "off")+
geom_text(aes(label = lbl),
size = 3.5,
position = position_dodge(width = 1),
vjust = -7) +
scale_fill_brewer(palette = "Pastel1") +
labs(y = "Percentage",
fill = "Selected Object",
x = "Type of Transformation")+
geom_pointrange(ymin = ci_low, ymax = ci_up, position = position_dodge(width = 0.89), shape = 22, size = 0.3)+
#annotate(geom = "hline",yintercept = 0.5, y = 0.5, color = "black", size = 1, linetype='dotted')+
#annotate("pointrange", x = plotdata$Transformation, y = plotdata$pct,
# ymin = plotdata$ci_low,
# ymax = plotdata$ci_up,
# colour = "black", size = 0.8, shape = 22, fill = Transformation, fatten = 1)+
#annotate("text", x = pvalues_x, y = Inf, label = pvalues, size = 4, vjust = 1.8)+
theme(legend.position = "top", axis.title = element_text(size = 15), axis.text = element_text(size = 13, color = "black"),
legend.text = element_text(size = 13),legend.title = element_text(size = 13))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
g
#ggsave("selections_between.pdf",width=6,height=5)
ggsave("pilot_selections_dodged.svg",width=12,height=5)
ggsave("pilot_selections_dodged.pdf",width=12,height=5)
Aggregate Pilot and
Main
tdata_p <- subset(tdata_p, select = -c(explanation) )
tdata_t <- rbind(tdata, tdata_p)
table(tdata_t$condition)
##
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14
## 45 45 45 45 45 45 45 45 45 45 45 45 45 45
table(tdata_t$Transformation)
##
## Size Shape 90-Rot. 180-Rot. X-Refl. Y-Tran. X-Tran.
## 90 90 90 90 90 90 90
# create a summary dataset that also contains the percentages
plotdata_between <- tdata_t %>%
group_by(Transformation, selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
plotdata_sub <- subset(plotdata_between, selection_rec == "Y-Refl.")
Get the CI values that will be plotted as error bars
see: https://rcompanion.org/handbook/H_02.html
# create a summary dataset that also contains the percentages
plotdata_between <- tdata_t %>%
group_by(Transformation, selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
library(PropCIs)
library(DescTools)
library(purrr)
plotdata_between %>%
filter(Transformation == "Size") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> size_ci)
## est lwr.ci upr.ci
## [1,] 0.06666667 0.00000000 0.1442103
## [2,] 0.11111111 0.04444444 0.1886548
## [3,] 0.82222222 0.75555556 0.8997659
plotdata_between %>%
filter(Transformation == "Shape") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> shape_ci)
## est lwr.ci upr.ci
## [1,] 0.1666667 0.08888889 0.2663921
## [2,] 0.1222222 0.04444444 0.2219476
## [3,] 0.7111111 0.63333333 0.8108365
plotdata_between %>%
filter(Transformation == "90-Rot.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> ninerot_ci)
## est lwr.ci upr.ci
## [1,] 0.1444444 0.04444444 0.2532698
## [2,] 0.3111111 0.21111111 0.4199364
## [3,] 0.5444444 0.44444444 0.6532698
plotdata_between %>%
filter(Transformation == "180-Rot.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> huneightyrot_ci)
## est lwr.ci upr.ci
## [1,] 0.1222222 0.02222222 0.2247729
## [2,] 0.2888889 0.18888889 0.3914396
## [3,] 0.5888889 0.48888889 0.6914396
plotdata_between %>%
filter(Transformation == "X-Refl.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> xrefl_ci)
## est lwr.ci upr.ci
## [1,] 0.2000000 0.1000000 0.3091550
## [2,] 0.2555556 0.1555556 0.3647106
## [3,] 0.5444444 0.4444444 0.6535995
plotdata_between %>%
filter(Transformation == "Y-Tran.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> ytran_ci)
## est lwr.ci upr.ci
## [1,] 0.2333333 0.1333333 0.3516148
## [2,] 0.4222222 0.3222222 0.5405037
## [3,] 0.3444444 0.2444444 0.4627259
plotdata_between %>%
filter(Transformation == "X-Tran.") -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> xtran_ci)
## est lwr.ci upr.ci
## [1,] 0.1666667 0.06666667 0.2824704
## [2,] 0.3888889 0.28888889 0.5046926
## [3,] 0.4444444 0.34444444 0.5602481
ci_low <- c(size_ci[,2], shape_ci[,2], ninerot_ci[,2], huneightyrot_ci[,2], xrefl_ci[,2], ytran_ci[,2], xtran_ci[,2])
ci_up <- c(size_ci[,3], shape_ci[,3], ninerot_ci[,3], huneightyrot_ci[,3], xrefl_ci[,3], ytran_ci[,3], xtran_ci[,3])
plotdata$ci_low <- ci_low
plotdata$ci_up <- ci_up
library(scales)
theme_set(theme_light(base_size = 12, base_family = "Poppins"))
pvalues_x <- c(1:7)
pvalues <- c(rep("p < .001",6), "p = .057")
g<- ggplot(plotdata,
aes(x = Transformation,
y = pct,
fill = selection_rec)) +
geom_bar(stat = "identity",
position = "dodge") +
scale_y_continuous(limits = seq(0, 2),
breaks = seq(0, 1, .25),
expand = c(0,0),
label = percent) +
coord_cartesian(xlim =c(1, 7), ylim = c(0, 1.1))+
#coord_cartesian(clip = "off")+
geom_text(aes(label = lbl),
size = 3.5,
position = position_dodge(width = 1),
vjust = -7) +
scale_fill_brewer(palette = "Pastel1") +
labs(y = "Percentage",
fill = "Selected Object",
x = "Type of Transformation")+
geom_pointrange(ymin = ci_low, ymax = ci_up, position = position_dodge(width = 0.89), shape = 22, size = 0.3)+
#annotate(geom = "hline",yintercept = 0.5, y = 0.5, color = "black", size = 1, linetype='dotted')+
#annotate("pointrange", x = plotdata$Transformation, y = plotdata$pct,
# ymin = plotdata$ci_low,
# ymax = plotdata$ci_up,
# colour = "black", size = 0.8, shape = 22, fill = Transformation, fatten = 1)+
#annotate("text", x = pvalues_x, y = Inf, label = pvalues, size = 4, vjust = 1.8)+
theme(legend.position = "top", axis.title = element_text(size = 15), axis.text = element_text(size = 13, color = "black"),
legend.text = element_text(size = 13),legend.title = element_text(size = 13))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
g
#ggsave("selections_between.pdf",width=6,height=5)
ggsave("pilot_and_main_selections_dodged.svg",width=12,height=5)
ggsave("pilot_and_main_selections_dodged.pdf",width=12,height=5)
Graph averaging over
transformations
Main study
# create a summary dataset that also contains the percentages
plotdata_between <- tdata %>%
group_by(selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
library(PropCIs)
library(DescTools)
library(purrr)
plotdata_between -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> selection_ci)
## est lwr.ci upr.ci
## [1,] 0.1642857 0.1166667 0.2147623
## [2,] 0.2690476 0.2214286 0.3195242
## [3,] 0.5666667 0.5190476 0.6171432
ci_low <- c(selection_ci[,2])
ci_up <- c(selection_ci[,3])
plotdata <- plotdata_between
plotdata$ci_low <- ci_low
plotdata$ci_up <- ci_up
library(scales)
theme_set(theme_light(base_size = 12, base_family = "Poppins"))
pvalues_x <- c(1:7)
pvalues <- c(rep("p < .001",6), "p = .057")
g<- ggplot(plotdata,
aes(x = selection_rec,
y = pct,
fill = selection_rec)) +
geom_bar(stat = "identity",
position = "dodge") +
scale_y_continuous(limits = seq(0, 2),
breaks = seq(0, 1, .25),
expand = c(0,0),
label = percent) +
#coord_cartesian(xlim =c(1, 7), ylim = c(0, 1.1))+
#coord_cartesian(clip = "off")+
geom_text(aes(label = lbl),
size = 3.5,
position = position_dodge(width = 1),
vjust = -7) +
scale_fill_brewer(palette = "Pastel1") +
labs(y = "Percentage",
fill = "Selected Object",
x = "Selected Object ")+
geom_pointrange(ymin = ci_low, ymax = ci_up, position = position_dodge(width = 0.89), shape = 22, size = 0.3)+
#annotate(geom = "hline",yintercept = 0.5, y = 0.5, color = "black", size = 1, linetype='dotted')+
#annotate("pointrange", x = plotdata$Transformation, y = plotdata$pct,
# ymin = plotdata$ci_low,
# ymax = plotdata$ci_up,
# colour = "black", size = 0.8, shape = 22, fill = Transformation, fatten = 1)+
#annotate("text", x = pvalues_x, y = Inf, label = pvalues, size = 4, vjust = 1.8)+
theme(legend.position = "none", axis.title = element_text(size = 15), axis.text = element_text(size = 13, color = "black"),
legend.text = element_text(size = 13),legend.title = element_text(size = 13))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
ggtitle("Main Study (N = 420)")
g
#ggsave("selections_between.pdf",width=6,height=5)
ggsave("main_averaged_over_transformations.svg",width=5,height=5)
ggsave("main_averaged_over_transformations.pdf",width=5,height=5)
Pilot study
# create a summary dataset that also contains the percentages
plotdata_between <- tdata_p %>%
group_by(selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
library(PropCIs)
library(DescTools)
library(purrr)
plotdata_between -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> selection_ci)
## est lwr.ci upr.ci
## [1,] 0.1428571 0.07619048 0.2122141
## [2,] 0.2761905 0.20952381 0.3455474
## [3,] 0.5809524 0.51428571 0.6503093
ci_low <- c(selection_ci[,2])
ci_up <- c(selection_ci[,3])
plotdata <- plotdata_between
plotdata$ci_low <- ci_low
plotdata$ci_up <- ci_up
library(scales)
theme_set(theme_light(base_size = 12, base_family = "Poppins"))
pvalues_x <- c(1:7)
pvalues <- c(rep("p < .001",6), "p = .057")
g<- ggplot(plotdata,
aes(x = selection_rec,
y = pct,
fill = selection_rec)) +
geom_bar(stat = "identity",
position = "dodge") +
scale_y_continuous(limits = seq(0, 2),
breaks = seq(0, 1, .25),
expand = c(0,0),
label = percent) +
#coord_cartesian(xlim =c(1, 7), ylim = c(0, 1.1))+
#coord_cartesian(clip = "off")+
geom_text(aes(label = lbl),
size = 3.5,
position = position_dodge(width = 1),
vjust = -7) +
scale_fill_brewer(palette = "Pastel1") +
labs(y = "Percentage",
fill = "Selected Object",
x = "Selected Object ")+
geom_pointrange(ymin = ci_low, ymax = ci_up, position = position_dodge(width = 0.89), shape = 22, size = 0.3)+
#annotate(geom = "hline",yintercept = 0.5, y = 0.5, color = "black", size = 1, linetype='dotted')+
#annotate("pointrange", x = plotdata$Transformation, y = plotdata$pct,
# ymin = plotdata$ci_low,
# ymax = plotdata$ci_up,
# colour = "black", size = 0.8, shape = 22, fill = Transformation, fatten = 1)+
#annotate("text", x = pvalues_x, y = Inf, label = pvalues, size = 4, vjust = 1.8)+
theme(legend.position = "none", axis.title = element_text(size = 15), axis.text = element_text(size = 13, color = "black"),
legend.text = element_text(size = 13),legend.title = element_text(size = 13))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
ggtitle("Pilot Study (N = 215)")
g
#ggsave("selections_between.pdf",width=6,height=5)
ggsave("pilot_averaged_over_transformations.svg",width=5,height=5)
ggsave("pilot_averaged_over_transformations.pdf",width=5,height=5)
Pilot and Main
together
# create a summary dataset that also contains the percentages
plotdata_between <- tdata_t %>%
group_by(selection_rec) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct))
library(PropCIs)
library(DescTools)
library(purrr)
plotdata_between -> transf
(MultinomCI(transf$n,
conf.level=0.95,
method="sisonglaz") -> selection_ci)
## est lwr.ci upr.ci
## [1,] 0.1571429 0.1174603 0.1976336
## [2,] 0.2714286 0.2317460 0.3119193
## [3,] 0.5714286 0.5317460 0.6119193
ci_low <- c(selection_ci[,2])
ci_up <- c(selection_ci[,3])
plotdata <- plotdata_between
plotdata$ci_low <- ci_low
plotdata$ci_up <- ci_up
library(scales)
theme_set(theme_light(base_size = 12, base_family = "Poppins"))
pvalues_x <- c(1:7)
pvalues <- c(rep("p < .001",6), "p = .057")
g<- ggplot(plotdata,
aes(x = selection_rec,
y = pct,
fill = selection_rec)) +
geom_bar(stat = "identity",
position = "dodge") +
scale_y_continuous(limits = seq(0, 2),
breaks = seq(0, 1, .25),
expand = c(0,0),
label = percent) +
#coord_cartesian(xlim =c(1, 7), ylim = c(0, 1.1))+
#coord_cartesian(clip = "off")+
geom_text(aes(label = lbl),
size = 3.5,
position = position_dodge(width = 1),
vjust = -7) +
scale_fill_brewer(palette = "Pastel1") +
labs(y = "Percentage",
fill = "Selected Object",
x = "Selected Object ")+
geom_pointrange(ymin = ci_low, ymax = ci_up, position = position_dodge(width = 0.89), shape = 22, size = 0.3)+
#annotate(geom = "hline",yintercept = 0.5, y = 0.5, color = "black", size = 1, linetype='dotted')+
#annotate("pointrange", x = plotdata$Transformation, y = plotdata$pct,
# ymin = plotdata$ci_low,
# ymax = plotdata$ci_up,
# colour = "black", size = 0.8, shape = 22, fill = Transformation, fatten = 1)+
#annotate("text", x = pvalues_x, y = Inf, label = pvalues, size = 4, vjust = 1.8)+
theme(legend.position = "none", axis.title = element_text(size = 15), axis.text = element_text(size = 13, color = "black"),
legend.text = element_text(size = 13),legend.title = element_text(size = 13))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
ggtitle("Pilot and Main Study together (N = 635)")
g
#ggsave("selections_between.pdf",width=6,height=5)
ggsave("pilot_and_main_averaged_over_transformations.svg",width=5,height=5)
ggsave("pilot_and_main_averaged_over_transformations.pdf",width=5,height=5)