AuRo
Rebecca
09/11/2021
Import Data
#Session Paramters
options(scipen=999)
Data Cleaning
dat_dvs <- dat %>%
select(subject,init_com, fin_com, no_prob, intervention, battery, com_interrupted)
ranks <- t(apply(dat_dvs[,-1], 1, function(x) rank(x, ties.method = "min") ))
colnames(ranks) <- paste(colnames(ranks), "_rank", sep="")
dat <- data.frame(dat, ranks)
# Reverse Coding Items
dat <- dat %>%
mutate_at(vars(grep("_rank$", names(.))),
dplyr::recode,
"6" = 1,
"5" = 2,
"4" = 3,
"3" = 4,
"2" = 5,
"1" = 6)
Friedman Tests by Animation
Initial Communication 1
dat_init_comm_1 <- dat %>%
dplyr::filter(animation == "init_comm_1") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
init_comm_1_melt <- melt(dat_init_comm_1, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank"))
init_comm_1_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 97.3 5 1.91e-19 Friedman test
init_comm_1_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.199 Kendall W small
init_comm_1_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value init_com~ fin_com~ 98 98 224. 2.03e- 9 2.84e- 8 ****
## 2 value init_com~ no_prob~ 98 98 402. 1.16e- 8 1.39e- 7 ****
## 3 value init_com~ interve~ 98 98 868. 1.8 e- 2 1.25e- 1 ns
## 4 value init_com~ battery~ 98 98 96 3.63e-12 5.44e-11 ****
## 5 value init_com~ com_int~ 98 98 408 8.13e- 9 1.06e- 7 ****
## 6 value fin_com_~ no_prob~ 98 98 746. 9.83e- 1 1 e+ 0 ns
## 7 value fin_com_~ interve~ 98 98 1790. 1.47e- 4 1 e- 3 **
## 8 value fin_com_~ battery~ 98 98 480. 8.5 e- 2 4.24e- 1 ns
## 9 value fin_com_~ com_int~ 98 98 682 6.03e- 1 1 e+ 0 ns
## 10 value no_prob_~ interve~ 98 98 1624. 2.88e- 4 2 e- 3 **
## 11 value no_prob_~ battery~ 98 98 374. 6.8 e- 2 4.07e- 1 ns
## 12 value no_prob_~ com_int~ 98 98 427 4.27e- 1 1 e+ 0 ns
## 13 value interven~ battery~ 98 98 246. 4.08e- 7 4.49e- 6 ****
## 14 value interven~ com_int~ 98 98 518. 3.33e- 5 3.33e- 4 ***
## 15 value battery_~ com_int~ 98 98 670. 1.54e- 1 6.16e- 1 ns
pwc <- init_comm_1_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE) %>%
arrange(p.adj)
pwc_stat <- pwc %>%
select(statistic)
t(pwc_stat)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
## statistic 96 224.5 408 402.5 245.5 517.5 1790.5 1624.5 867.5 374.5 480.5
## [,12] [,13] [,14] [,15]
## statistic 670.5 745.5 682 427
x <- c(402.5, 224.5, 408, 96, 1624.5, 1790.5, 517.5, 245.5, 867.5, 374.5, 480.5, 670.5, 745.5, 682, 42)
pwc <- pwc %>%
slice(match(x, statistic))
init_comm_1_melt <-
init_comm_1_melt %>%
mutate(Legend = case_when(variable == "init_com_rank" | variable == "intervention_rank" ~ "Highest Ranked Message/s", TRUE ~ "Other Messages"))
gg_init_comm_1 <- ggplot(init_comm_1_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(5.8, 5.9, 6, 6.1, 6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
ggtitle("Sequence 1") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
xlab("Message") +
ylab("Mean Ranking") +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_init_comm_1 <- gg_init_comm_1 + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_init_comm_1
Intervention 1
dat_intervention_1 <- dat %>%
dplyr::filter(animation == "intervention_1") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_intervention_1, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 5.0000000 6.0000000 6.0000000
## mean 49.500000 4.4387755 5.5408163 5.4795918
## SE.mean 2.872281 0.1728867 0.0985572 0.1241250
## CI.mean.0.95 5.700683 0.3431323 0.1956088 0.2463538
## var 808.500000 2.9292026 0.9519251 1.5098885
## std.dev 28.434134 1.7114913 0.9756665 1.2287752
## coef.var 0.574427 0.3855774 0.1760871 0.2242458
## intervention_rank battery_rank com_interrupted_rank
## median 3.0000000 3.0000000 6.0000000
## mean 3.1428571 3.4489796 4.5204082
## SE.mean 0.1823243 0.1729209 0.1807188
## CI.mean.0.95 0.3618633 0.3432001 0.3586768
## var 3.2577320 2.9303598 3.2006101
## std.dev 1.8049188 1.7118294 1.7890249
## coef.var 0.5742924 0.4963292 0.3957662
intervention_1_melt <- melt(dat_intervention_1, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank"))
intervention_1_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 142. 5 6.99e-29 Friedman test
intervention_1_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.290 Kendall W small
intervention_1_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value init_com~ fin_com~ 98 98 95 2.22e- 7 2.44e- 6 ****
## 2 value init_com~ no_prob~ 98 98 234. 1.09e- 5 8.72e- 5 ****
## 3 value init_com~ interve~ 98 98 2144. 1.15e- 5 8.72e- 5 ****
## 4 value init_com~ battery~ 98 98 2134. 1 e- 3 5 e- 3 **
## 5 value init_com~ com_int~ 98 98 1132. 8.05e- 1 1 e+ 0 ns
## 6 value fin_com_~ no_prob~ 98 98 282. 7.33e- 1 1 e+ 0 ns
## 7 value fin_com_~ interve~ 98 98 2563 1.79e-11 2.68e-10 ****
## 8 value fin_com_~ battery~ 98 98 2562. 1.96e-11 2.74e-10 ****
## 9 value fin_com_~ com_int~ 98 98 1055 9.41e- 6 8.47e- 5 ****
## 10 value no_prob_~ interve~ 98 98 2605 3.5 e-11 4.55e-10 ****
## 11 value no_prob_~ battery~ 98 98 2547 2.98e-10 3.58e- 9 ****
## 12 value no_prob_~ com_int~ 98 98 1051 2.49e- 4 1 e- 3 **
## 13 value interven~ battery~ 98 98 635 1.81e- 1 5.43e- 1 ns
## 14 value interven~ com_int~ 98 98 303 1.18e- 6 1.18e- 5 ****
## 15 value battery_~ com_int~ 98 98 302. 1.7 e- 5 1.02e- 4 ***
pwc_intervention_1 <- intervention_1_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE)
x_intervention_1 <- c(635, 2144.5, 303, 2605, 2563, 2133.5, 302.5, 2547, 2562.5, 1132.5, 234.5, 95, 1051, 1055, 282.5)
pwc_intervention_1 <- pwc_intervention_1 %>%
slice(match(x_intervention_1, statistic)) %>%
slice(1:9)
intervention_1_melt <-
intervention_1_melt %>%
mutate(Legend = case_when(variable == "intervention_rank" | variable == "battery_rank" ~ "Highest Ranked Message/s", TRUE ~ "Other Messages"))
gg_intervention_1 <- ggplot(intervention_1_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_intervention_1, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(5.8, 5.9, 6, 6.1, 6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab(" ") +
ylab(" ") +
ggtitle("Sequence 2") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_intervention_1 <- gg_intervention_1 + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_intervention_1
Battery 2
dat_battery_2 <- dat %>%
dplyr::filter(animation == "battery_2") %>%
select(subject,init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_battery_2, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 6.0000000 3.5000000 4.5000000
## mean 49.500000 4.6020408 3.7244898 4.0918367
## SE.mean 2.872281 0.1689934 0.1867596 0.1817966
## CI.mean.0.95 5.700683 0.3354051 0.3706661 0.3608160
## var 808.500000 2.7987587 3.4181570 3.2389017
## std.dev 28.434134 1.6729491 1.8488258 1.7996949
## coef.var 0.574427 0.3635233 0.4963971 0.4398257
## intervention_rank battery_rank com_interrupted_rank
## median 6.0000000 3.5000000 6.0000000
## mean 5.2346939 3.7959184 4.7346939
## SE.mean 0.1311884 0.1983305 0.1605738
## CI.mean.0.95 0.2603727 0.3936311 0.3186945
## var 1.6866190 3.8548285 2.5268252
## std.dev 1.2986990 1.9633717 1.5895991
## coef.var 0.2480945 0.5172323 0.3357343
battery_2_melt <- melt(dat_battery_2, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank")) %>%
mutate(variable = fct_relevel(variable, c("fin_com_rank", "battery_rank", "no_prob_rank", "init_com_rank", "com_interrupted_rank", "intervention_rank")))
battery_2_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 52.8 5 3.69e-10 Friedman test
battery_2_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.108 Kendall W small
battery_2_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value fin_com_~ battery_~ 98 98 1054. 7.41e-1 1 e+0 ns
## 2 value fin_com_~ no_prob_~ 98 98 803 2.23e-1 8.92e-1 ns
## 3 value fin_com_~ init_com~ 98 98 692 2 e-3 1.9 e-2 *
## 4 value fin_com_~ com_inte~ 98 98 479 4.49e-4 5 e-3 **
## 5 value fin_com_~ interven~ 98 98 348. 3.98e-7 5.97e-6 ****
## 6 value battery_~ no_prob_~ 98 98 1365 2.92e-1 8.92e-1 ns
## 7 value battery_~ init_com~ 98 98 684 4 e-3 3.4 e-2 *
## 8 value battery_~ com_inte~ 98 98 500. 8 e-4 9 e-3 **
## 9 value battery_~ interven~ 98 98 294. 5.43e-7 7.6 e-6 ****
## 10 value no_prob_~ init_com~ 98 98 782. 5.7 e-2 2.84e-1 ns
## 11 value no_prob_~ com_inte~ 98 98 673 1.4 e-2 9.5 e-2 ns
## 12 value no_prob_~ interven~ 98 98 218 5.54e-6 7.2 e-5 ****
## 13 value init_com~ com_inte~ 98 98 940. 6.39e-1 1 e+0 ns
## 14 value init_com~ interven~ 98 98 464. 4 e-3 3.4 e-2 *
## 15 value com_inte~ interven~ 98 98 633 3.7 e-2 2.2 e-1 ns
pwc_battery_2 <- battery_2_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE) %>%
slice(1:7, 9, 11, 12:14)
x_battery_2 <- c(692.0, 479.0, 347.5, 684.0, 500.5, 294.5, 782.5, 673.0, 218.0)
pwc_battery_2 <- pwc_battery_2 %>%
slice(match(x_battery_2, statistic)) %>%
slice(1:9)
battery_2_melt <-
battery_2_melt %>%
mutate(Legend = case_when(variable == "fin_com_rank" | variable == "battery_rank" | variable == "no_prob_rank" ~ "Highest Ranked Message/s", TRUE ~ "Other Messages"))
gg_battery_2 <- ggplot(battery_2_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_battery_2, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(6, 6.1, 6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab("Message") +
ylab(" ") +
ggtitle("Sequence 3") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_battery_2 <- gg_battery_2 + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_battery_2
Initial Communication 2
dat_init_comm_2 <- dat %>%
dplyr::filter(animation == "init_comm_2") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_init_comm_2, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 3.0000000 6.0000000 6.0000000
## mean 49.500000 3.3367347 4.9489796 4.7142857
## SE.mean 2.872281 0.2146261 0.1604567 0.1697760
## CI.mean.0.95 5.700683 0.4259734 0.3184622 0.3369584
## var 808.500000 4.5143068 2.5231433 2.8247423
## std.dev 28.434134 2.1246898 1.5884405 1.6806970
## coef.var 0.574427 0.6367572 0.3209632 0.3565115
## intervention_rank battery_rank com_interrupted_rank
## median 6.0000000 6.0000000 6.0000000
## mean 4.5204082 5.0714286 5.2244898
## SE.mean 0.1824568 0.1408175 0.1395272
## CI.mean.0.95 0.3621262 0.2794838 0.2769228
## var 3.2624658 1.9432990 1.9078477
## std.dev 1.8062297 1.3940226 1.3812486
## coef.var 0.3995723 0.2748777 0.2643796
init_comm_2_melt <- melt(dat_init_comm_2, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank")) %>%
mutate(variable = fct_relevel(variable, c("init_com_rank", "intervention_rank", "no_prob_rank", "fin_com_rank", "battery_rank", "com_interrupted_rank")))
init_comm_2_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 66.5 5 5.41e-13 Friedman test
init_comm_2_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.136 Kendall W small
init_comm_2_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value init_com~ interven~ 98 98 418. 1.32e-4 1 e-3 **
## 2 value init_com~ no_prob_~ 98 98 340. 1.16e-5 1.39e-4 ***
## 3 value init_com~ fin_com_~ 98 98 292 7.46e-7 9.7 e-6 ****
## 4 value init_com~ battery_~ 98 98 264. 6.08e-8 8.51e-7 ****
## 5 value init_com~ com_inte~ 98 98 177 2.33e-9 3.5 e-8 ****
## 6 value interven~ no_prob_~ 98 98 862. 4.23e-1 1 e+0 ns
## 7 value interven~ fin_com_~ 98 98 698 1.09e-1 6.54e-1 ns
## 8 value interven~ battery_~ 98 98 195 4 e-3 3.4 e-2 *
## 9 value interven~ com_inte~ 98 98 320. 3 e-3 3.4 e-2 *
## 10 value no_prob_~ fin_com_~ 98 98 351 3.03e-1 1 e+0 ns
## 11 value no_prob_~ battery_~ 98 98 482 8.8 e-2 6.12e-1 ns
## 12 value no_prob_~ com_inte~ 98 98 316. 2.3 e-2 1.82e-1 ns
## 13 value fin_com_~ battery_~ 98 98 619 6.79e-1 1 e+0 ns
## 14 value fin_com_~ com_inte~ 98 98 462 1.93e-1 9.65e-1 ns
## 15 value battery_~ com_inte~ 98 98 328. 5.44e-1 1 e+0 ns
pwc_init_comm_2 <- init_comm_2_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE) %>%
slice(1:5)
init_comm_2_melt <- init_comm_2_melt %>%
mutate(Legend = if_else(variable == "init_com_rank", "Highest Ranked Message/s", "Other Messages"))
gg_init_comm_2 <- ggplot(init_comm_2_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_init_comm_2, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(6.1, 6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab("Message") +
ylab("Mean Ranking") +
ggtitle("Sequence 4") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_init_comm_2 <- gg_init_comm_2 + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_init_comm_2
Intervention 2
dat_intervention_2 <- dat %>%
dplyr::filter(animation == "intervention_2") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_intervention_2, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 4.0000000 6.0000000 6.0000000
## mean 49.500000 4.1122449 5.1428571 5.2857143
## SE.mean 2.872281 0.1945408 0.1256165 0.1457729
## CI.mean.0.95 5.700683 0.3861097 0.2493140 0.2893188
## var 808.500000 3.7089207 1.5463918 2.0824742
## std.dev 28.434134 1.9258558 1.2435400 1.4430780
## coef.var 0.574427 0.4683223 0.2417994 0.2730148
## intervention_rank battery_rank com_interrupted_rank
## median 2.0000000 4.0000000 6.0000000
## mean 2.8571429 4.2551020 4.7448980
## SE.mean 0.1788290 0.1687264 0.1502584
## CI.mean.0.95 0.3549260 0.3348752 0.2982213
## var 3.1340206 2.7899222 2.2126026
## std.dev 1.7703165 1.6703060 1.4874820
## coef.var 0.6196108 0.3925419 0.3134908
intervention_2_melt <- melt(dat_intervention_2, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank")) %>%
mutate(variable = fct_relevel(variable, c("intervention_rank", "init_com_rank", "battery_rank", "com_interrupted_rank", "fin_com_rank", "no_prob_rank")))
intervention_2_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 107. 5 1.87e-21 Friedman test
intervention_2_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.218 Kendall W small
intervention_2_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value interven~ init_co~ 98 98 718 6.26e- 5 5.63e- 4 ***
## 2 value interven~ battery~ 98 98 196 1.72e- 7 2.06e- 6 ****
## 3 value interven~ com_int~ 98 98 302. 6.59e- 9 8.57e- 8 ****
## 4 value interven~ fin_com~ 98 98 150. 3.15e-12 4.73e-11 ****
## 5 value interven~ no_prob~ 98 98 328. 9.41e-11 1.32e- 9 ****
## 6 value init_com~ battery~ 98 98 1012 6.92e- 1 1 e+ 0 ns
## 7 value init_com~ com_int~ 98 98 747 2.1 e- 2 1.06e- 1 ns
## 8 value init_com~ fin_com~ 98 98 227 4.03e- 5 4.03e- 4 ***
## 9 value init_com~ no_prob~ 98 98 349 1.66e- 5 1.83e- 4 ***
## 10 value battery_~ com_int~ 98 98 496. 3.2 e- 2 1.3 e- 1 ns
## 11 value battery_~ fin_com~ 98 98 339 9.45e- 5 7.56e- 4 ***
## 12 value battery_~ no_prob~ 98 98 584. 4.58e- 4 3 e- 3 **
## 13 value com_inte~ fin_com~ 98 98 484. 6.1 e- 2 1.84e- 1 ns
## 14 value com_inte~ no_prob~ 98 98 427 1 e- 2 6 e- 2 ns
## 15 value fin_com_~ no_prob~ 98 98 462. 5.25e- 1 1 e+ 0 ns
pwc_intervention_2 <- intervention_2_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE) %>%
slice(1:4, 7)
intervention_2_melt <- intervention_2_melt %>%
mutate(Legend = if_else(variable == "intervention_rank", "Highest Ranked Message/s", "Other Messages"))
gg_intervention_2 <- ggplot(intervention_2_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_intervention_2, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab("Message") +
ylab(" ") +
ggtitle("Sequence 5") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_intervention_2 <- gg_intervention_2 + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_intervention_2
Battery 3
dat_battery_3 <- dat %>%
dplyr::filter(animation == "battery_3") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_battery_3, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 2.5000000 5.0000000 4.0000000
## mean 49.500000 3.1836735 4.4693878 4.0306122
## SE.mean 2.872281 0.1937086 0.1692821 0.1825861
## CI.mean.0.95 5.700683 0.3844580 0.3359782 0.3623829
## var 808.500000 3.6772565 2.8083316 3.2670945
## std.dev 28.434134 1.9176174 1.6758077 1.8075106
## coef.var 0.574427 0.6023285 0.3749524 0.4484457
## intervention_rank battery_rank com_interrupted_rank
## median 6.0000000 6.0000000 6.0000000
## mean 5.0612245 5.3877551 4.7142857
## SE.mean 0.1470778 0.1318536 0.1679069
## CI.mean.0.95 0.2919087 0.2616929 0.3332487
## var 2.1199243 1.7037660 2.7628866
## std.dev 1.4559960 1.3052839 1.6621933
## coef.var 0.2876766 0.2422686 0.3525865
battery_3_melt <- melt(dat_battery_3, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank")) %>%
mutate(variable = fct_relevel(variable, c("init_com_rank", "no_prob_rank", "fin_com_rank", "com_interrupted_rank", "intervention_rank", "battery_rank")))
battery_3_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 86.0 5 4.60e-17 Friedman test
battery_3_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.176 Kendall W small
battery_3_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value init_com~ no_prob_~ 98 98 634 2 e-3 1.7 e-2 *
## 2 value init_com~ fin_com_~ 98 98 426 1.02e-4 1 e-3 **
## 3 value init_com~ com_inte~ 98 98 598. 1.37e-6 1.78e-5 ****
## 4 value init_com~ interven~ 98 98 163 2.12e-9 2.97e-8 ****
## 5 value init_com~ battery_~ 98 98 280. 1.11e-9 1.66e-8 ****
## 6 value no_prob_~ fin_com_~ 98 98 885 7.6 e-2 3.06e-1 ns
## 7 value no_prob_~ com_inte~ 98 98 388. 5 e-3 3.3 e-2 *
## 8 value no_prob_~ interven~ 98 98 468 5.05e-4 5 e-3 **
## 9 value no_prob_~ battery_~ 98 98 287 4.8 e-6 5.76e-5 ****
## 10 value fin_com_~ com_inte~ 98 98 648. 3.07e-1 3.07e-1 ns
## 11 value fin_com_~ interven~ 98 98 484 1.6 e-2 7.9 e-2 ns
## 12 value fin_com_~ battery_~ 98 98 270. 4.26e-5 4.69e-4 ***
## 13 value com_inte~ interven~ 98 98 476. 7.9 e-2 3.06e-1 ns
## 14 value com_inte~ battery_~ 98 98 348. 2 e-3 1.4 e-2 *
## 15 value interven~ battery_~ 98 98 352. 1.45e-1 3.06e-1 ns
pwc_battery_3 <- battery_3_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE) %>%
slice(1:5)
battery_3_melt <- battery_3_melt %>%
mutate(Legend = if_else(variable == "init_com_rank", "Highest Ranked Message/s", "Other Messages"))
gg_battery_3 <- ggplot(battery_3_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_battery_3, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(6.1, 6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab("Message") +
ylab(" ") +
ggtitle("Sequence 6") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_battery_3 <- gg_battery_3 + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_battery_3
No Problem
dat_no_problem <- dat %>%
dplyr::filter(animation == "no_problem") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_no_problem, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 3.0000000 6.0000000 3.0000000
## mean 49.500000 3.2959184 5.1938776 3.6326531
## SE.mean 2.872281 0.1858724 0.1261665 0.1942730
## CI.mean.0.95 5.700683 0.3689052 0.2504055 0.3855782
## var 808.500000 3.3857564 1.5599621 3.6987166
## std.dev 28.434134 1.8400425 1.2489844 1.9232048
## coef.var 0.574427 0.5582791 0.2404724 0.5294215
## intervention_rank battery_rank com_interrupted_rank
## median 6.0000000 6.0000000 6.0000000
## mean 4.5510204 5.3571429 4.7959184
## SE.mean 0.1829708 0.1266590 0.1703693
## CI.mean.0.95 0.3631464 0.2513830 0.3381359
## var 3.2808752 1.5721649 2.8445193
## std.dev 1.8113186 1.2538600 1.6865703
## coef.var 0.3980028 0.2340539 0.3516678
no_problem_melt <- melt(dat_no_problem, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank")) %>%
mutate(variable = fct_relevel(variable, c("init_com_rank", "no_prob_rank", "intervention_rank", "com_interrupted_rank", "fin_com_rank", "battery_rank")))
no_problem_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 98.3 5 1.20e-19 Friedman test
no_problem_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.201 Kendall W small
no_problem_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value init_com~ no_prob~ 98 98 905 1.98e- 1 5.94e-1 ns
## 2 value init_com~ interve~ 98 98 538 2 e- 5 2 e-4 ***
## 3 value init_com~ com_int~ 98 98 474 1.26e- 6 1.39e-5 ****
## 4 value init_com~ fin_com~ 98 98 39.5 1.39e-10 1.95e-9 ****
## 5 value init_com~ battery~ 98 98 162. 1.27e-10 1.9 e-9 ****
## 6 value no_prob_~ interve~ 98 98 654. 1 e- 3 1 e-2 *
## 7 value no_prob_~ com_int~ 98 98 301 7.61e- 5 6.85e-4 ***
## 8 value no_prob_~ fin_com~ 98 98 184 2.14e- 8 2.57e-7 ****
## 9 value no_prob_~ battery~ 98 98 198. 5.19e- 9 6.75e-8 ****
## 10 value interven~ com_int~ 98 98 839 2.43e- 1 5.94e-1 ns
## 11 value interven~ fin_com~ 98 98 520 9 e- 3 4.4 e-2 *
## 12 value interven~ battery~ 98 98 237 8.08e- 4 6 e-3 **
## 13 value com_inte~ fin_com~ 98 98 457 5.2 e- 2 2.06e-1 ns
## 14 value com_inte~ battery~ 98 98 264 7 e- 3 3.9 e-2 *
## 15 value fin_com_~ battery~ 98 98 460. 3.75e- 1 5.94e-1 ns
pwc_no_problem <- no_problem_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE) %>%
slice(1:9)
no_problem_melt <-
no_problem_melt %>%
mutate(Legend = case_when(variable == "init_com_rank" | variable == "no_prob_rank" ~ "Highest Ranked Message/s", TRUE ~ "Other Messages"))
gg_no_problem <- ggplot(no_problem_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_no_problem, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(5.8, 5.9, 6, 6.1, 6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab("Message") +
ylab("Mean Ranking") +
ggtitle("Sequence 7") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_no_problem <- gg_no_problem + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_no_problem
Broken Communication
dat_broken_comm <- dat %>%
dplyr::filter(animation == "broken_comm") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_broken_comm, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 6.0000000 6.0000000 6.0000000
## mean 49.500000 4.9489796 4.8877551 5.3265306
## SE.mean 2.872281 0.1467600 0.1574857 0.1374343
## CI.mean.0.95 5.700683 0.2912779 0.3125655 0.2727690
## var 808.500000 2.1107721 2.4305702 1.8510414
## std.dev 28.434134 1.4528497 1.5590286 1.3605298
## coef.var 0.574427 0.2935655 0.3189662 0.2554251
## intervention_rank battery_rank com_interrupted_rank
## median 3.0000000 3.0000000 5.0000000
## mean 3.8979592 3.5714286 4.2448980
## SE.mean 0.1785286 0.1764603 0.1940961
## CI.mean.0.95 0.3543298 0.3502248 0.3852271
## var 3.1235009 3.0515464 3.6919840
## std.dev 1.7673429 1.7468676 1.9214536
## coef.var 0.4534021 0.4891229 0.4526501
broken_comm_melt <- melt(dat_broken_comm, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank")) %>%
mutate(variable = fct_relevel(variable, c("battery_rank", "intervention_rank", "com_interrupted_rank", "fin_com_rank", "init_com_rank", "no_prob_rank")))
broken_comm_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 79.1 5 1.28e-15 Friedman test
broken_comm_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.161 Kendall W small
broken_comm_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value battery_~ interven~ 98 98 578. 1.54e-1 3.48e-1 ns
## 2 value battery_~ com_inte~ 98 98 566 1 e-2 7.9 e-2 ns
## 3 value battery_~ fin_com_~ 98 98 368. 2.24e-6 3.14e-5 ****
## 4 value battery_~ init_com~ 98 98 504. 4.77e-6 5.72e-5 ****
## 5 value battery_~ no_prob_~ 98 98 218. 2.5 e-9 3.75e-8 ****
## 6 value interven~ com_inte~ 98 98 702 1.16e-1 3.48e-1 ns
## 7 value interven~ fin_com_~ 98 98 422. 5.38e-5 5.92e-4 ***
## 8 value interven~ init_com~ 98 98 408. 1 e-4 9 e-4 ***
## 9 value interven~ no_prob_~ 98 98 400. 3.38e-6 4.39e-5 ****
## 10 value com_inte~ fin_com_~ 98 98 483 1.6 e-2 9.3 e-2 ns
## 11 value com_inte~ init_com~ 98 98 530. 1.1 e-2 8 e-2 ns
## 12 value com_inte~ no_prob_~ 98 98 328. 6.81e-5 6.81e-4 ***
## 13 value fin_com_~ init_com~ 98 98 564. 8.04e-1 8.04e-1 ns
## 14 value fin_com_~ no_prob_~ 98 98 558. 7.4 e-2 3.44e-1 ns
## 15 value init_com~ no_prob_~ 98 98 430. 6.9 e-2 3.44e-1 ns
pwc_broken_comm <- broken_comm_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE)
broken_comm_melt <-
broken_comm_melt %>%
mutate(Legend = case_when(variable == "battery_rank" | variable == "intervention_rank" | variable == "com_interrupted_rank" ~ "Highest Ranked Message/s", TRUE ~ "Other Messages"))
gg_broken_comm <- ggplot(broken_comm_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_broken_comm, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(5.9, 6, 6.1, 6.2, 6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab("Message") +
ylab(" ") +
ggtitle("Sequence 8") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_broken_comm <- gg_broken_comm + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_broken_comm
Close Communication
dat_close_comm <- dat %>%
dplyr::filter(animation == "close_comm") %>%
select(subject, init_com_rank, fin_com_rank, no_prob_rank, intervention_rank, battery_rank, com_interrupted_rank)
stat.desc(dat_close_comm, basic = FALSE)
## subject init_com_rank fin_com_rank no_prob_rank
## median 49.500000 6.0000000 3.5000000 6.0000000
## mean 49.500000 5.2346939 3.7448980 4.9387755
## SE.mean 2.872281 0.1412286 0.2128381 0.1499115
## CI.mean.0.95 5.700683 0.2802996 0.4224248 0.2975328
## var 808.500000 1.9546602 4.4394067 2.2023985
## std.dev 28.434134 1.3980916 2.1069900 1.4840480
## coef.var 0.574427 0.2670818 0.5626295 0.3004891
## intervention_rank battery_rank com_interrupted_rank
## median 5.0000000 6.0000000 6.0000000
## mean 4.4795918 5.3163265 4.4285714
## SE.mean 0.1754017 0.1183704 0.1918824
## CI.mean.0.95 0.3481238 0.2349325 0.3808334
## var 3.0150431 1.3731328 3.6082474
## std.dev 1.7363880 1.1718075 1.8995387
## coef.var 0.3876219 0.2204168 0.4289281
close_comm_melt <- melt(dat_close_comm, id.vars = "subject", measure.vars = c("init_com_rank", "fin_com_rank", "no_prob_rank", "intervention_rank", "battery_rank", "com_interrupted_rank")) %>%
mutate(variable = fct_relevel(variable, c("fin_com_rank", "com_interrupted_rank", "intervention_rank", "no_prob_rank", "init_com_rank", "battery_rank")))
close_comm_melt %>%
friedman_test(value ~ variable | subject)
## # A tibble: 1 x 6
## .y. n statistic df p method
## * <chr> <int> <dbl> <dbl> <dbl> <chr>
## 1 value 98 58.6 5 2.38e-11 Friedman test
close_comm_melt %>%
friedman_effsize(value ~ variable | subject)
## # A tibble: 1 x 5
## .y. n effsize method magnitude
## * <chr> <int> <dbl> <chr> <ord>
## 1 value 98 0.120 Kendall W small
close_comm_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm")
## # A tibble: 15 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 value fin_com_~ com_inte~ 98 98 652 2.2 e-2 1.33e-1 ns
## 2 value fin_com_~ interven~ 98 98 512. 1.2 e-2 9.8 e-2 ns
## 3 value fin_com_~ no_prob_~ 98 98 236. 1.16e-5 1.51e-4 ***
## 4 value fin_com_~ init_com~ 98 98 257 7.77e-6 1.09e-4 ***
## 5 value fin_com_~ battery_~ 98 98 210. 1.79e-7 2.68e-6 ****
## 6 value com_inte~ interven~ 98 98 827 8.27e-1 1 e+0 ns
## 7 value com_inte~ no_prob_~ 98 98 334. 1.4 e-2 9.9 e-2 ns
## 8 value com_inte~ init_com~ 98 98 448. 2 e-3 1.5 e-2 *
## 9 value com_inte~ battery_~ 98 98 170. 7.61e-5 8.37e-4 ***
## 10 value interven~ no_prob_~ 98 98 328 5 e-2 2.02e-1 ns
## 11 value interven~ init_com~ 98 98 348. 3 e-3 2.7 e-2 *
## 12 value interven~ battery_~ 98 98 98.5 2.55e-5 3.06e-4 ***
## 13 value no_prob_~ init_com~ 98 98 412. 1.57e-1 4.71e-1 ns
## 14 value no_prob_~ battery_~ 98 98 390 4 e-2 2.02e-1 ns
## 15 value init_com~ battery_~ 98 98 464 7.19e-1 1 e+0 ns
pwc_close_comm <- close_comm_melt %>%
wilcox_test(value ~ variable, paired = TRUE, p.adjust.method = "holm", detailed = TRUE) %>%
slice(1:5)
close_comm_melt <- close_comm_melt %>%
mutate(Legend = if_else(variable == "fin_com_rank", "Highest Ranked Message/s", "Other Messages"))
gg_close_comm <- ggplot(close_comm_melt, aes(x = reorder(variable, value), y = value)) +
stat_summary(fun = mean, geom = "bar", width = 0.75, aes(fill = Legend)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar",
colour="black", position=position_dodge(1), width=.2) +
stat_pvalue_manual(pwc_close_comm, label = "p.adj.signif", tip.length = 0.02, step.increase = 0.05, hide.ns = TRUE, y.position = c(6.3, 6.4, 6.5), label.size = 3) +
scale_x_discrete(labels = c(init_com_rank = "Initial\nCommunication", intervention_rank = "Intervention\nNeeded", no_prob_rank = "No\nProblem", fin_com_rank = "Close\nCommunication", com_interrupted_rank = "Broken\nCommunication", battery_rank = "Low\nBattery")) +
xlab("Message") +
ylab(" ") +
ggtitle("Sequence 9") +
theme(plot.title = element_text(size=10, hjust = 0.5, face = "bold")) +
scale_y_continuous(breaks = seq(1,9,by = 1), labels = c("1", "2", "3", "4", "5", "6", "", "", ""), limits = c(-0, 9)) +
#theme(aspect.ratio = 1) +
theme(axis.text = element_text(size=10)) +
theme(axis.title = element_text(size=10, face = "bold")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.25))
gg_close_comm <- gg_close_comm + scale_fill_manual(values = c("Highest Ranked Message/s" = "#9E0142", "Other Messages" = "#FDAE61")) +
theme(legend.position = "none") + theme(axis.title.x=element_blank())
gg_close_comm
pdf("gg_close_comm.pdf")
ggdraw(gg_close_comm)
dev.off()
## png
## 2
figure <- ggarrange(gg_init_comm_1, gg_intervention_1, gg_battery_2, gg_init_comm_2, gg_intervention_2, gg_battery_3, gg_no_problem, gg_broken_comm, gg_close_comm, align = "hv",
common.legend = TRUE,
legend = "bottom")
pdf("figure.pdf", width = 10, height=12)
ggdraw(figure)
dev.off()
## png
## 2