Data
pilot <- read.csv("~/Downloads/Stress and Personality_March 7, 2024_12.08.csv") %>%
slice(-c(1:2)) %>%
rename(Condition = FL_7_DO) %>%
mutate(Condition = ifelse(Condition == "FL_11", "stress", "nonstress"))
table(pilot$Condition)
##
## nonstress stress
## 55 47
# Manipulation check
pilot %>%
lm(momentary_stress ~ Condition, .)%>%
summary()
##
## Call:
## lm(formula = momentary_stress ~ Condition, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.97872 -0.63636 0.02128 0.36364 2.36364
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.6364 0.1346 12.153 < 2e-16 ***
## Conditionstress 1.3424 0.1983 6.768 9.02e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9985 on 100 degrees of freedom
## Multiple R-squared: 0.3141, Adjusted R-squared: 0.3073
## F-statistic: 45.8 on 1 and 100 DF, p-value: 9.024e-10
library(see)
library(ggpubr)
my_comparisons <- list( c("stress", "nonstress"))
ggplot(data = pilot,
mapping = aes(x = Condition,
y = as.numeric(momentary_stress),
color = Condition)) +
# means with confidence intervals
geom_violinhalf(position = position_nudge(0.1),
#fill = "gray23",
alpha = 0.4) +
geom_point(alpha = 0.3,
size = 2,
position = position_jitter(0.1)) +
stat_summary(fun.data = "mean_cl_boot",
size = 1,
geom = "linerange",
color = "grey50",
position = position_nudge(x = 0.2)) +
stat_summary(fun = "mean",
size = 0.3,
position = position_nudge(x = 0.2))+
# individual data points (jittered horizontally)
theme_bw()+
theme(legend.position="none")+
stat_compare_means(comparisons = my_comparisons, label = "p.signif", method = "t.test")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Removed 2 rows containing missing values (`geom_segment()`).

# Create means for perosnality states
pilot <- pilot %>%
mutate(across(starts_with("extra"), as.numeric)) %>%
mutate(extra_avg = rowMeans(select(., starts_with("extra")), na.rm = T))%>%
mutate(across(starts_with("neuro"), as.numeric)) %>%
mutate(neuro_avg = rowMeans(select(., starts_with("neuro")), na.rm = T))%>%
mutate(across(starts_with("con_"), as.numeric)) %>%
mutate(con_avg = rowMeans(select(., starts_with("con_")), na.rm = T)) %>%
mutate(across(starts_with("agree"), as.numeric)) %>%
mutate(agree_avg = rowMeans(select(., starts_with("agree")), na.rm = T))%>%
mutate(across(starts_with("open"), as.numeric)) %>%
mutate(open_avg = rowMeans(select(., starts_with("open")), na.rm = T))
Analyses
pilot %>%
lm(extra_avg ~ Condition, .)%>%
summary()
##
## Call:
## lm(formula = extra_avg ~ Condition, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.56818 -0.35638 -0.06818 0.43182 1.68182
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.31818 0.08702 49.622 <2e-16 ***
## Conditionstress 0.03820 0.12820 0.298 0.766
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6454 on 100 degrees of freedom
## Multiple R-squared: 0.0008872, Adjusted R-squared: -0.009104
## F-statistic: 0.0888 on 1 and 100 DF, p-value: 0.7663
ggplot(data = pilot,
mapping = aes(x = Condition,
y = extra_avg,
color = Condition)) +
# means with confidence intervals
geom_violinhalf(position = position_nudge(0.1),
#fill = "gray23",
alpha = 0.4) +
geom_point(alpha = 0.3,
size = 2,
position = position_jitter(0.1)) +
stat_summary(fun.data = "mean_cl_boot",
size = 1,
geom = "linerange",
color = "grey50",
position = position_nudge(x = 0.2)) +
stat_summary(fun = "mean",
size = 0.3,
position = position_nudge(x = 0.2))+
# individual data points (jittered horizontally)
theme_bw()+
theme(legend.position="none")+
stat_compare_means(comparisons = my_comparisons, label = "p.signif", method = "t.test")
## Warning: Removed 2 rows containing missing values (`geom_segment()`).

pilot %>%
lm(neuro_avg ~ Condition, .)%>%
summary()
##
## Call:
## lm(formula = neuro_avg ~ Condition, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.62273 -0.51605 -0.06383 0.62727 1.68617
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.12273 0.09669 42.639 <2e-16 ***
## Conditionstress -0.05890 0.14244 -0.413 0.68
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7171 on 100 degrees of freedom
## Multiple R-squared: 0.001707, Adjusted R-squared: -0.008276
## F-statistic: 0.171 on 1 and 100 DF, p-value: 0.6801
ggplot(data = pilot,
mapping = aes(x = Condition,
y = neuro_avg,
color = Condition)) +
# means with confidence intervals
geom_violinhalf(position = position_nudge(0.1),
#fill = "gray23",
alpha = 0.4) +
geom_point(alpha = 0.3,
size = 2,
position = position_jitter(0.1)) +
stat_summary(fun.data = "mean_cl_boot",
size = 1,
geom = "linerange",
color = "grey50",
position = position_nudge(x = 0.2)) +
stat_summary(fun = "mean",
size = 0.3,
position = position_nudge(x = 0.2))+
# individual data points (jittered horizontally)
theme_bw()+
theme(legend.position="none")+
stat_compare_means(comparisons = my_comparisons, label = "p.signif", method = "t.test")
## Warning: Removed 2 rows containing missing values (`geom_segment()`).

pilot %>%
lm(con_avg ~ Condition, .)%>%
summary()
##
## Call:
## lm(formula = con_avg ~ Condition, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.93636 -0.43617 0.06364 0.31383 1.56383
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.18636 0.08708 48.07 <2e-16 ***
## Conditionstress -0.25019 0.12829 -1.95 0.054 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6458 on 100 degrees of freedom
## Multiple R-squared: 0.03664, Adjusted R-squared: 0.02701
## F-statistic: 3.803 on 1 and 100 DF, p-value: 0.05395
ggplot(data = pilot,
mapping = aes(x = Condition,
y = con_avg,
color = Condition)) +
# means with confidence intervals
geom_violinhalf(position = position_nudge(0.1),
#fill = "gray23",
alpha = 0.4) +
geom_point(alpha = 0.3,
size = 2,
position = position_jitter(0.1)) +
stat_summary(fun.data = "mean_cl_boot",
size = 1,
geom = "linerange",
color = "grey50",
position = position_nudge(x = 0.2)) +
stat_summary(fun = "mean",
size = 0.3,
position = position_nudge(x = 0.2))+
# individual data points (jittered horizontally)
theme_bw()+
theme(legend.position="none")+
stat_compare_means(comparisons = my_comparisons, label = "p.signif", method = "t.test")
## Warning: Removed 2 rows containing missing values (`geom_segment()`).

pilot %>%
lm(agree_avg ~ Condition, .)%>%
summary()
##
## Call:
## lm(formula = agree_avg ~ Condition, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.66489 -0.41489 0.01364 0.51364 1.76364
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.48636 0.09104 49.278 <2e-16 ***
## Conditionstress -0.07147 0.13412 -0.533 0.595
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6752 on 100 degrees of freedom
## Multiple R-squared: 0.002832, Adjusted R-squared: -0.00714
## F-statistic: 0.284 on 1 and 100 DF, p-value: 0.5953
ggplot(data = pilot,
mapping = aes(x = Condition,
y = agree_avg,
color = Condition)) +
# means with confidence intervals
geom_violinhalf(position = position_nudge(0.1),
#fill = "gray23",
alpha = 0.4) +
geom_point(alpha = 0.3,
size = 2,
position = position_jitter(0.1)) +
stat_summary(fun.data = "mean_cl_boot",
size = 1,
geom = "linerange",
color = "grey50",
position = position_nudge(x = 0.2)) +
stat_summary(fun = "mean",
size = 0.3,
position = position_nudge(x = 0.2))+
# individual data points (jittered horizontally)
theme_bw()+
theme(legend.position="none")+
stat_compare_means(comparisons = my_comparisons, label = "p.signif", method = "t.test")
## Warning: Removed 2 rows containing missing values (`geom_segment()`).

pilot %>%
lm(open_avg ~ Condition, .)%>%
summary()
##
## Call:
## lm(formula = open_avg ~ Condition, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.01596 -0.71818 -0.01596 0.76987 2.23404
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.2182 0.1511 34.537 <2e-16 ***
## Conditionstress -0.4522 0.2226 -2.032 0.0448 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.121 on 100 degrees of freedom
## Multiple R-squared: 0.03964, Adjusted R-squared: 0.03004
## F-statistic: 4.128 on 1 and 100 DF, p-value: 0.04483
ggplot(data = pilot,
mapping = aes(x = Condition,
y = open_avg,
color = Condition)) +
# means with confidence intervals
geom_violinhalf(position = position_nudge(0.1),
#fill = "gray23",
alpha = 0.4) +
geom_point(alpha = 0.3,
size = 2,
position = position_jitter(0.1)) +
stat_summary(fun.data = "mean_cl_boot",
size = 1,
geom = "linerange",
color = "grey50",
position = position_nudge(x = 0.2)) +
stat_summary(fun = "mean",
size = 0.3,
position = position_nudge(x = 0.2))+
# individual data points (jittered horizontally)
theme_bw()+
theme(legend.position="none")+
stat_compare_means(comparisons = my_comparisons, label = "p.signif", method = "t.test")
## Warning: Removed 2 rows containing missing values (`geom_segment()`).
