library(psych)
library(tidyverse)
library(ggpubr)
Google Presentation
Libraries
ggplot Theme
library(showtext)
font_add_google(name="Poppins", family="Poppins")
font_add_google(name="DM Serif Text", family="DM Serif Text")
<- function() {
theme_ssk ::theme_bw() +
ggplot2::theme(
ggplot2axis.text = element_text(colour = "#0c4846", family = "Poppins", size = 12),
axis.title = element_text(colour = "#0c4846", family = "DM Serif Text", size = 14),
legend.title = element_text(colour = "#0c4846", family = "Poppins", size = 13),
legend.text = element_text(colour = "#0c4846", family = "Poppins", size = 12),
plot.title = element_text(colour = "#0c4846", family = "Poppins", size = 13, face = "bold"),
plot.subtitle = element_text(colour = "#0c4846", family = "Poppins", size = 13, face = "italic"),
strip.text = element_text(colour = "#0c4846", family = "Poppins", size = 13)) +
::theme(panel.background = element_rect(fill = "#fffbef", color = "#0e0d0d"),
ggplot2plot.background = element_rect(fill = "#fffbef"))
}
<- function(fun, geom="crossbar", ...) {
stat_sum_df stat_summary(fun.data=fun, colour="black", geom=geom, width=.5, ...)
}
Data
<- read.csv("clean_workplace_data_20240910.csv") data
Relationships
summary(lm(relationships ~ Condition + wave, data))
Call:
lm(formula = relationships ~ Condition + wave, data = data)
Residuals:
Min 1Q Median 3Q Max
-4.2672 -1.1105 0.3787 1.3787 2.3787
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.1843 0.4671 8.958 4.87e-15 ***
ConditionTreatment 0.6459 0.3064 2.108 0.0371 *
wave 0.4370 0.3120 1.401 0.1639
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.688 on 121 degrees of freedom
(91 observations deleted due to missingness)
Multiple R-squared: 0.05737, Adjusted R-squared: 0.04179
F-statistic: 3.682 on 2 and 121 DF, p-value: 0.02804
<- data %>%
relation_plot filter(!is.na(Condition)) %>%
ggplot(aes(Condition, relationships, fill=Condition)) +
geom_bar(stat="summary", fun.y="mean", position="dodge") +
geom_jitter(color = "#301934", alpha = 0.5) +
stat_summary(fun.data = mean_se, geom = "errorbar", position= position_dodge(.9), conf.int = .68, width = 0.5, color = "#0c4846") +
expand_limits(y = c(1,7)) +
scale_y_continuous(breaks = c(1:7)) +
labs(x = "Intervention Condition",
y = "Value of Relationships") +
scale_fill_manual(values = c("#d3c3fd", "#b390f7")) +
theme_ssk() +
theme(legend.position = "none")
relation_plot
Complexity
summary(lm(complexity ~ Condition + wave, data))
Call:
lm(formula = complexity ~ Condition + wave, data = data)
Residuals:
Min 1Q Median 3Q Max
-1.5192 -0.5192 0.2041 0.4808 0.5149
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.55342 0.15982 28.491 < 2e-16 ***
ConditionTreatment 0.27662 0.10485 2.638 0.00943 **
wave -0.03416 0.10674 -0.320 0.74950
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5775 on 121 degrees of freedom
(91 observations deleted due to missingness)
Multiple R-squared: 0.05441, Adjusted R-squared: 0.03878
F-statistic: 3.481 on 2 and 121 DF, p-value: 0.03388
<- data %>%
complex_plot filter(!is.na(Condition)) %>%
ggplot(aes(Condition, complexity, fill=Condition)) +
geom_bar(stat="summary", fun.y="mean", position="dodge") +
geom_jitter(color = "#004080", alpha = 0.5) +
stat_summary(fun.data = mean_se, geom = "errorbar", position= position_dodge(.9), conf.int = .68, width = 0.5, color = "#0c4846") +
expand_limits(y = c(1,5)) +
scale_y_continuous(breaks = c(1:5)) +
labs(x = "Intervention Condition",
y = "Complexity of Coworkers") +
scale_fill_manual(values = c("#c7e6f8", "#67b5ff")) +
theme_ssk() +
theme(legend.position = "none")
complex_plot
Perspective-Taking
summary(lm(pt_s1 ~ Condition + wave, data))
Call:
lm(formula = pt_s1 ~ Condition + wave, data = data)
Residuals:
Min 1Q Median 3Q Max
-2.3983 -0.3983 -0.1082 0.6017 0.8918
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.01887 0.22230 18.079 <2e-16 ***
ConditionTreatment 0.29005 0.14584 1.989 0.049 *
wave 0.08935 0.14847 0.602 0.548
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8032 on 121 degrees of freedom
(91 observations deleted due to missingness)
Multiple R-squared: 0.0377, Adjusted R-squared: 0.0218
F-statistic: 2.37 on 2 and 121 DF, p-value: 0.09778
<- data %>%
pt_s1_plot filter(!is.na(Condition)) %>%
ggplot(aes(Condition, pt_s1, fill=Condition)) +
geom_bar(stat="summary", fun.y="mean", position="dodge") +
geom_jitter(color = "#BA8E23", alpha = 0.5) +
stat_summary(fun.data = mean_se, geom = "errorbar", position= position_dodge(.9), conf.int = .68, width = 0.5, color = "#0c4846") +
expand_limits(y = c(1,5)) +
scale_y_continuous(breaks = c(1:5)) +
labs(x = "Intervention Condition",
y = "Perspective-Taking",
title = "Session 1") +
scale_fill_manual(values = c("#ffeec1", "#FFC931")) +
theme_ssk() +
theme(legend.position = "none")
pt_s1_plot
summary(lm(pt_s2 ~ Condition + wave, data))
Call:
lm(formula = pt_s2 ~ Condition + wave, data = data)
Residuals:
Min 1Q Median 3Q Max
-1.5846 -0.3948 -0.1454 0.4154 0.8546
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.2648 0.2316 18.412 < 2e-16 ***
ConditionTreatment 0.4392 0.1529 2.873 0.00561 **
wave -0.0597 0.1518 -0.393 0.69544
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5856 on 60 degrees of freedom
(152 observations deleted due to missingness)
Multiple R-squared: 0.1217, Adjusted R-squared: 0.09246
F-statistic: 4.158 on 2 and 60 DF, p-value: 0.02036
<- data %>%
pt_s2_plot filter(!is.na(Condition)) %>%
ggplot(aes(Condition, pt_s2, fill=Condition)) +
geom_bar(stat="summary", fun.y="mean", position="dodge") +
geom_jitter(color = "#cb416b", alpha = 0.5) +
stat_summary(fun.data = mean_se, geom = "errorbar", position= position_dodge(.9), conf.int = .68, width = 0.5, color = "#0c4846") +
expand_limits(y = c(1,5)) +
scale_y_continuous(breaks = c(1:5)) +
labs(x = "Intervention Condition",
y = "Perspective-Taking",
title = "Session 2") +
scale_fill_manual(values = c("#facdcd", "#f48382")) +
theme_ssk() +
theme(legend.position = "none")
pt_s2_plot