#anova v1
# ============================================================
# GWS — Two 2×2 ANOVAs (Complete Script)
# ANOVA 1: Mentor_avg × DASS_stress → SBQR_total
# ANOVA 2: psychosocial_overall × DASS_stress → SBQR_total
# ============================================================
# ── 0. Packages ───────────────────────────────────────────────────────────────
packages <- c("haven", "dplyr", "ggplot2", "emmeans",
"car", "effectsize", "patchwork")
install_if_missing <- function(pkg) {
if (!requireNamespace(pkg, quietly = TRUE)) install.packages(pkg)
}
invisible(lapply(packages, install_if_missing))
library(haven)
library(dplyr)
library(ggplot2)
library(emmeans)
library(car)
library(effectsize)
library(patchwork)
# ── 2. Median Splits ──────────────────────────────────────────────────────────
gws <- gws %>%
mutate(
mentor_group = factor(
ifelse(Mentor_avg > median(Mentor_avg, na.rm = TRUE), "High", "Low"),
levels = c("Low", "High")
),
stress_group = factor(
ifelse(DASS_stress > median(DASS_stress, na.rm = TRUE),
"High Stress", "Low Stress"),
levels = c("Low Stress", "High Stress")
),
psycsoc_group = factor(
ifelse(psychosocial_overall > median(psychosocial_overall, na.rm = TRUE),
"High", "Low"),
levels = c("Low", "High")
)
)
cat("\n=== Group sizes ===\n")
=== Group sizes ===
cat("Mentor group:\n"); print(table(gws$mentor_group, useNA = "ifany"))
Mentor group:
Low High <NA>
110 95 2
cat("Stress group:\n"); print(table(gws$stress_group, useNA = "ifany"))
Stress group:
Low Stress High Stress
118 89
cat("Psycsoc group:\n"); print(table(gws$psycsoc_group, useNA = "ifany"))
Psycsoc group:
Low High <NA>
106 92 9
# ── Shared theme & palette ────────────────────────────────────────────────────
theme_gws <- theme_minimal(base_size = 13) +
theme(
plot.title = element_text(face = "bold", size = 14),
plot.subtitle = element_text(size = 10, colour = "grey40"),
panel.grid.minor = element_blank(),
legend.position = "top"
)
palette2 <- c("Low Stress" = "#4E79A7",
"High Stress" = "#E15759")
# ════════════════════════════════════════════════════════════
# ANOVA 1: Mentor_avg × DASS_stress → SBQR_total
# ════════════════════════════════════════════════════════════
cat("\n\n========================================\n")
========================================
cat(" ANOVA 1: Mentor Support × DASS Stress\n")
ANOVA 1: Mentor Support × DASS Stress
cat(" DV: SBQR_total\n")
DV: SBQR_total
cat("========================================\n")
========================================
df1 <- gws %>%
filter(!is.na(mentor_group), !is.na(stress_group), !is.na(SBQR_total))
cat(sprintf("N (complete cases): %d\n", nrow(df1)))
N (complete cases): 201
# -- Descriptives --------------------------------------------------------------
desc1 <- df1 %>%
group_by(mentor_group, stress_group) %>%
summarise(n = n(),
M = round(mean(SBQR_total), 2),
SD = round(sd(SBQR_total), 2),
SE = round(sd(SBQR_total) / sqrt(n()), 2),
.groups = "drop")
cat("\nCell Descriptives:\n")
Cell Descriptives:
print(desc1)
# A tibble: 4 × 6
mentor_group stress_group n M SD SE
<fct> <fct> <int> <dbl> <dbl> <dbl>
1 Low Low Stress 53 2.08 2.23 0.31
2 Low High Stress 53 3.19 2.86 0.39
3 High Low Stress 63 1.95 2.99 0.38
4 High High Stress 32 3.16 3.97 0.7
# -- Assumption checks ---------------------------------------------------------
cat("\nLevene's Test:\n")
Levene's Test:
print(car::leveneTest(SBQR_total ~ mentor_group * stress_group, data = df1))
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 3 1.929 0.1262
197
# -- ANOVA ---------------------------------------------------------------------
options(contrasts = c("contr.sum", "contr.poly"))
model1 <- aov(SBQR_total ~ mentor_group * stress_group, data = df1)
cat("\nType III ANOVA Table:\n")
Type III ANOVA Table:
anova1_table <- car::Anova(model1, type = "III")
print(anova1_table)
Anova Table (Type III tests)
Response: SBQR_total
Sum Sq Df F value Pr(>F)
(Intercept) 1267.92 1 144.8101 < 2.2e-16 ***
mentor_group 0.29 1 0.0326 0.857006
stress_group 63.27 1 7.2259 0.007801 **
mentor_group:stress_group 0.10 1 0.0111 0.916341
Residuals 1724.89 197
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# -- Effect sizes (partial η²) -------------------------------------------------
cat("\nEffect Sizes (partial η²) — ANOVA 1:\n")
Effect Sizes (partial η²) — ANOVA 1:
print(effectsize::eta_squared(model1, partial = TRUE))
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
---------------------------------------------------------
mentor_group | 2.18e-03 | [0.00, 1.00]
stress_group | 0.04 | [0.01, 1.00]
mentor_group:stress_group | 5.62e-05 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00].
# -- Post-hoc ------------------------------------------------------------------
emm1 <- emmeans(model1, ~ mentor_group * stress_group)
cat("\nEstimated Marginal Means:\n")
Estimated Marginal Means:
print(emm1)
mentor_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 2.08 0.406 197 1.27 2.88
High Low Stress 1.95 0.373 197 1.22 2.69
Low High Stress 3.19 0.406 197 2.39 3.99
High High Stress 3.16 0.523 197 2.12 4.19
Confidence level used: 0.95
cat("\nPairwise Comparisons (Tukey):\n")
Pairwise Comparisons (Tukey):
print(pairs(emm1, adjust = "tukey"))
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 0.1231 0.552 197 0.223 0.9961
Low Low Stress - Low High Stress -1.1132 0.575 197 -1.937 0.2162
Low Low Stress - High High Stress -1.0808 0.662 197 -1.632 0.3633
High Low Stress - Low High Stress -1.2363 0.552 197 -2.242 0.1158
High Low Stress - High High Stress -1.2039 0.642 197 -1.874 0.2425
Low High Stress - High High Stress 0.0324 0.662 197 0.049 1.0000
P value adjustment: tukey method for comparing a family of 4 estimates
cat("\nSimple Effects — stress within each mentor group:\n")
Simple Effects — stress within each mentor group:
print(emmeans(model1, pairwise ~ stress_group | mentor_group,
adjust = "bonferroni")$contrasts)
mentor_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -1.11 0.575 197 -1.937 0.0542
mentor_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -1.20 0.642 197 -1.874 0.0624
# -- Plots for ANOVA 1 ---------------------------------------------------------
p1_interaction <- desc1 %>%
ggplot(aes(x = mentor_group, y = M,
colour = stress_group, group = stress_group)) +
geom_line(linewidth = 1.2) +
geom_point(size = 4) +
geom_errorbar(aes(ymin = M - SE, ymax = M + SE),
width = 0.08, linewidth = 0.8) +
scale_colour_manual(values = palette2, name = "DASS Stress") +
labs(title = "ANOVA 1: Mentor Support × DASS Stress",
subtitle = "DV = SBQR Total | Error bars = ±1 SE",
x = "Mentor Support Group", y = "Mean SBQR Total") +
theme_gws
p1_box <- ggplot(df1, aes(x = mentor_group, y = SBQR_total,
fill = stress_group)) +
geom_boxplot(alpha = 0.75, outlier.size = 1.2,
position = position_dodge(0.75)) +
scale_fill_manual(values = palette2, name = "DASS Stress") +
labs(title = "ANOVA 1: Box Plots",
x = "Mentor Support Group", y = "SBQR Total") +
theme_gws
emm1_df <- as.data.frame(emm1)
p1_emm <- ggplot(emm1_df,
aes(x = mentor_group, y = emmean, fill = stress_group)) +
geom_col(position = position_dodge(0.7), width = 0.6, alpha = 0.85) +
geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL),
position = position_dodge(0.7),
width = 0.15, linewidth = 0.7) +
scale_fill_manual(values = palette2, name = "DASS Stress") +
labs(title = "ANOVA 1: Estimated Marginal Means (95% CI)",
x = "Mentor Support Group", y = "Estimated Mean SBQR Total") +
theme_gws
# ════════════════════════════════════════════════════════════
# ANOVA 2: psychosocial_overall × DASS_stress → SBQR_total
# ════════════════════════════════════════════════════════════
cat("\n\n========================================\n")
========================================
cat(" ANOVA 2: Psychosocial Support × DASS Stress\n")
ANOVA 2: Psychosocial Support × DASS Stress
cat(" DV: SBQR_total\n")
DV: SBQR_total
cat("========================================\n")
========================================
df2 <- gws %>%
filter(!is.na(psycsoc_group), !is.na(stress_group), !is.na(SBQR_total))
cat(sprintf("N (complete cases): %d\n", nrow(df2)))
N (complete cases): 197
# -- Descriptives --------------------------------------------------------------
desc2 <- df2 %>%
group_by(psycsoc_group, stress_group) %>%
summarise(n = n(),
M = round(mean(SBQR_total), 2),
SD = round(sd(SBQR_total), 2),
SE = round(sd(SBQR_total) / sqrt(n()), 2),
.groups = "drop")
cat("\nCell Descriptives:\n")
Cell Descriptives:
print(desc2)
# A tibble: 4 × 6
psycsoc_group stress_group n M SD SE
<fct> <fct> <int> <dbl> <dbl> <dbl>
1 Low Low Stress 56 2.46 2.8 0.37
2 Low High Stress 49 3.31 3.36 0.48
3 High Low Stress 57 1.67 2.5 0.33
4 High High Stress 35 3.11 3.22 0.55
# -- Assumption checks ---------------------------------------------------------
cat("\nLevene's Test:\n")
Levene's Test:
print(car::leveneTest(SBQR_total ~ psycsoc_group * stress_group, data = df2))
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 3 1.7021 0.168
193
# -- ANOVA ---------------------------------------------------------------------
model2 <- aov(SBQR_total ~ psycsoc_group * stress_group, data = df2)
cat("\nType III ANOVA Table:\n")
Type III ANOVA Table:
anova2_table <- car::Anova(model2, type = "III")
print(anova2_table)
Anova Table (Type III tests)
Response: SBQR_total
Sum Sq Df F value Pr(>F)
(Intercept) 1319.39 1 151.7045 < 2.2e-16 ***
psycsoc_group 11.60 1 1.3341 0.249513
stress_group 62.12 1 7.1424 0.008172 **
psycsoc_group:stress_group 4.35 1 0.5001 0.480331
Residuals 1678.55 193
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# -- Effect sizes (partial η²) -------------------------------------------------
cat("\nEffect Sizes (partial η²) — ANOVA 2:\n")
Effect Sizes (partial η²) — ANOVA 2:
print(effectsize::eta_squared(model2, partial = TRUE))
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
----------------------------------------------------------
psycsoc_group | 0.01 | [0.00, 1.00]
stress_group | 0.03 | [0.00, 1.00]
psycsoc_group:stress_group | 2.58e-03 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00].
# -- Post-hoc ------------------------------------------------------------------
emm2 <- emmeans(model2, ~ psycsoc_group * stress_group)
cat("\nEstimated Marginal Means:\n")
Estimated Marginal Means:
print(emm2)
psycsoc_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 2.46 0.394 193 1.687 3.24
High Low Stress 1.67 0.391 193 0.896 2.44
Low High Stress 3.31 0.421 193 2.475 4.14
High High Stress 3.11 0.498 193 2.131 4.10
Confidence level used: 0.95
cat("\nPairwise Comparisons (Tukey):\n")
Pairwise Comparisons (Tukey):
print(pairs(emm2, adjust = "tukey"))
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 0.798 0.555 193 1.437 0.4776
Low Low Stress - Low High Stress -0.842 0.577 193 -1.459 0.4642
Low Low Stress - High High Stress -0.650 0.635 193 -1.023 0.7362
High Low Stress - Low High Stress -1.639 0.575 193 -2.854 0.0246
High Low Stress - High High Stress -1.448 0.633 193 -2.286 0.1049
Low High Stress - High High Stress 0.192 0.653 193 0.294 0.9911
P value adjustment: tukey method for comparing a family of 4 estimates
cat("\nSimple Effects — stress within each psychosocial group:\n")
Simple Effects — stress within each psychosocial group:
print(emmeans(model2, pairwise ~ stress_group | psycsoc_group,
adjust = "bonferroni")$contrasts)
psycsoc_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -0.842 0.577 193 -1.459 0.1461
psycsoc_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -1.448 0.633 193 -2.286 0.0234
# -- Plots for ANOVA 2 ---------------------------------------------------------
p2_interaction <- desc2 %>%
ggplot(aes(x = psycsoc_group, y = M,
colour = stress_group, group = stress_group)) +
geom_line(linewidth = 1.2) +
geom_point(size = 4) +
geom_errorbar(aes(ymin = M - SE, ymax = M + SE),
width = 0.08, linewidth = 0.8) +
scale_colour_manual(values = palette2, name = "DASS Stress") +
labs(title = "ANOVA 2: Psychosocial Support × DASS Stress",
subtitle = "DV = SBQR Total | Error bars = ±1 SE",
x = "Psychosocial Support Group", y = "Mean SBQR Total") +
theme_gws
p2_box <- ggplot(df2, aes(x = psycsoc_group, y = SBQR_total,
fill = stress_group)) +
geom_boxplot(alpha = 0.75, outlier.size = 1.2,
position = position_dodge(0.75)) +
scale_fill_manual(values = palette2, name = "DASS Stress") +
labs(title = "ANOVA 2: Box Plots",
x = "Psychosocial Support Group", y = "SBQR Total") +
theme_gws
emm2_df <- as.data.frame(emm2)
p2_emm <- ggplot(emm2_df,
aes(x = psycsoc_group, y = emmean, fill = stress_group)) +
geom_col(position = position_dodge(0.7), width = 0.6, alpha = 0.85) +
geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL),
position = position_dodge(0.7),
width = 0.15, linewidth = 0.7) +
scale_fill_manual(values = palette2, name = "DASS Stress") +
labs(title = "ANOVA 2: Estimated Marginal Means (95% CI)",
x = "Psychosocial Support Group", y = "Estimated Mean SBQR Total") +
theme_gws
p1_box
p1_interaction
p2_interaction
p2_box
# ── Save All Plots ────────────────────────────────────────────────────────────
ggsave("GWS_ANOVA1_interaction.png", p1_interaction, width = 7, height = 5, dpi = 150)
ggsave("GWS_ANOVA1_boxplot.png", p1_box, width = 7, height = 5, dpi = 150)
ggsave("GWS_ANOVA1_emm.png", p1_emm, width = 7, height = 5, dpi = 150)
ggsave("GWS_ANOVA2_interaction.png", p2_interaction, width = 7, height = 5, dpi = 150)
ggsave("GWS_ANOVA2_boxplot.png", p2_box, width = 7, height = 5, dpi = 150)
ggsave("GWS_ANOVA2_emm.png", p2_emm, width = 7, height = 5, dpi = 150)
# Combined dashboard
dashboard <- (p1_interaction | p2_interaction) /
(p1_box | p2_box ) /
(p1_emm | p2_emm )
ggsave("GWS_ANOVA_dashboard.png", dashboard, width = 14, height = 15, dpi = 150)
cat("\n✓ All plots saved.\n")
✓ All plots saved.
cat("✓ Analysis complete.\n")
✓ Analysis complete.
#anova v2
# ============================================================
# GWS — Reusable 2×2 ANOVA Function
# Predictors:
# Mentor_avg
# psychosocial_overall
# DASS_stress (median split)
# ============================================================
library(dplyr)
library(ggplot2)
library(emmeans)
library(car)
library(effectsize)
library(patchwork)
run_gws_anova <- function(data, dv){
# ==========================================================
# ANOVA 1 — Mentor × Stress
# ==========================================================
cat("\n--- ANOVA 1: Mentor × Stress ---\n")
df1 <- gws %>%
filter(!is.na(.data[[dv]]),
!is.na(mentor_group),
!is.na(stress_group))
model1 <- aov(
as.formula(paste(dv,"~ mentor_group * stress_group")),
data=df1
)
print(car::Anova(model1,type="III"))
cat("\nEffect sizes\n")
print(effectsize::eta_squared(model1,partial=TRUE))
emm1 <- emmeans(model1, ~ mentor_group * stress_group)
print(emm1)
print(pairs(emm1,adjust="tukey"))
print(
emmeans(model1,pairwise~stress_group|mentor_group,
adjust="bonferroni")$contrasts
)
# Plot interaction
desc1 <- df1 %>%
group_by(mentor_group,stress_group) %>%
summarise(
M=mean(.data[[dv]],na.rm=TRUE),
SE=sd(.data[[dv]],na.rm=TRUE)/sqrt(n()),
.groups="drop"
)
p1_interaction <- ggplot(desc1,
aes(x=mentor_group,y=M,
colour=stress_group,
group=stress_group))+
geom_line(linewidth=1.2)+
geom_point(size=4)+
geom_errorbar(aes(ymin=M-SE,ymax=M+SE),
width=.08)+
labs(
title=paste("Mentor × Stress:",dv),
x="Mentor Support",
y=paste("Mean",dv)
)+
theme_minimal()
# ==========================================================
# ANOVA 2 — Psychosocial × Stress
# ==========================================================
cat("\n--- ANOVA 2: Psychosocial × Stress ---\n")
df2 <- gws %>%
filter(!is.na(.data[[dv]]),
!is.na(psycsoc_group),
!is.na(stress_group))
model2 <- aov(
as.formula(paste(dv,"~ psycsoc_group * stress_group")),
data=df2
)
print(car::Anova(model2,type="III"))
cat("\nEffect sizes\n")
print(effectsize::eta_squared(model2,partial=TRUE))
emm2 <- emmeans(model2, ~ psycsoc_group * stress_group)
print(emm2)
print(pairs(emm2,adjust="tukey"))
print(
emmeans(model2,pairwise~stress_group|psycsoc_group,
adjust="bonferroni")$contrasts
)
desc2 <- df2 %>%
group_by(psycsoc_group,stress_group) %>%
summarise(
M=mean(.data[[dv]],na.rm=TRUE),
SE=sd(.data[[dv]],na.rm=TRUE)/sqrt(n()),
.groups="drop"
)
p2_interaction <- ggplot(desc2,
aes(x=psycsoc_group,y=M,
colour=stress_group,
group=stress_group))+
geom_line(linewidth=1.2)+
geom_point(size=4)+
geom_errorbar(aes(ymin=M-SE,ymax=M+SE),
width=.08)+
labs(
title=paste("Psychosocial × Stress:",dv),
x="Psychosocial Support",
y=paste("Mean",dv)
)+
theme_minimal()
dashboard <- p1_interaction | p2_interaction
print(dashboard)
}
run_gws_anova(GWS_2_20_23_analyses_set, "DASS_depression")
--- ANOVA 1: Mentor × Stress ---
Anova Table (Type III tests)
Response: DASS_depression
Sum Sq Df F value Pr(>F)
(Intercept) 4989.1 1 142.9905 < 2.2e-16 ***
mentor_group 38.5 1 1.1039 0.2947
stress_group 2091.4 1 59.9396 4.691e-13 ***
mentor_group:stress_group 30.0 1 0.8587 0.3552
Residuals 7013.1 201
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Effect sizes
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
---------------------------------------------------------
mentor_group | 0.03 | [0.00, 1.00]
stress_group | 0.24 | [0.16, 1.00]
mentor_group:stress_group | 4.25e-03 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00]. mentor_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 1.85 0.804 201 0.267 3.44
High Low Stress 1.75 0.744 201 0.279 3.21
Low High Stress 9.25 0.789 201 7.694 10.81
High High Stress 7.56 1.040 201 5.504 9.62
Confidence level used: 0.95
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 0.106 1.10 201 0.097 0.9997
Low Low Stress - Low High Stress -7.398 1.13 201 -6.567 <.0001
Low Low Stress - High High Stress -5.711 1.32 201 -4.334 0.0001
High Low Stress - Low High Stress -7.504 1.08 201 -6.917 <.0001
High Low Stress - High High Stress -5.816 1.28 201 -4.536 0.0001
Low High Stress - High High Stress 1.688 1.31 201 1.289 0.5709
P value adjustment: tukey method for comparing a family of 4 estimates
mentor_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -7.40 1.13 201 -6.567 <.0001
mentor_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -5.82 1.28 201 -4.536 <.0001
--- ANOVA 2: Psychosocial × Stress ---
Anova Table (Type III tests)
Response: DASS_depression
Sum Sq Df F value Pr(>F)
(Intercept) 5163.7 1 159.0145 < 2.2e-16 ***
psycsoc_group 434.8 1 13.3891 0.0003261 ***
stress_group 2129.1 1 65.5633 6.097e-14 ***
psycsoc_group:stress_group 183.3 1 5.6448 0.0184815 *
Residuals 6299.8 194
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Effect sizes
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
----------------------------------------------------------
psycsoc_group | 0.08 | [0.03, 1.00]
stress_group | 0.27 | [0.18, 1.00]
psycsoc_group:stress_group | 0.03 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00]. psycsoc_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 2.39 0.761 194 0.891 3.89
High Low Stress 1.33 0.755 194 -0.155 2.82
Low High Stress 11.04 0.806 194 9.451 12.63
High High Stress 6.06 0.963 194 4.157 7.96
Confidence level used: 0.95
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 1.06 1.07 194 0.988 0.7563
Low Low Stress - Low High Stress -8.65 1.11 194 -7.799 <.0001
Low Low Stress - High High Stress -3.66 1.23 194 -2.984 0.0168
High Low Stress - Low High Stress -9.71 1.10 194 -8.791 <.0001
High Low Stress - High High Stress -4.72 1.22 194 -3.860 0.0009
Low High Stress - High High Stress 4.98 1.26 194 3.968 0.0006
P value adjustment: tukey method for comparing a family of 4 estimates
psycsoc_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -8.65 1.11 194 -7.799 <.0001
psycsoc_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -4.72 1.22 194 -3.860 0.0002
run_gws_anova(GWS_2_20_23_analyses_set, "DASS_anxiety")
--- ANOVA 1: Mentor × Stress ---
Anova Table (Type III tests)
Response: DASS_anxiety
Sum Sq Df F value Pr(>F)
(Intercept) 1945.37 1 160.8378 < 2.2e-16 ***
mentor_group 8.50 1 0.7024 0.4030
stress_group 869.93 1 71.9237 4.816e-15 ***
mentor_group:stress_group 0.37 1 0.0305 0.8615
Residuals 2431.14 201
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Effect sizes
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
---------------------------------------------------------
mentor_group | 0.03 | [0.00, 1.00]
stress_group | 0.27 | [0.19, 1.00]
mentor_group:stress_group | 1.52e-04 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00]. mentor_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 1.222 0.473 201 0.2890 2.16
High Low Stress 0.889 0.438 201 0.0249 1.75
Low High Stress 5.571 0.465 201 4.6550 6.49
High High Stress 5.062 0.615 201 3.8502 6.27
Confidence level used: 0.95
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 0.333 0.645 201 0.517 0.9550
Low Low Stress - Low High Stress -4.349 0.663 201 -6.557 <.0001
Low Low Stress - High High Stress -3.840 0.776 201 -4.950 <.0001
High Low Stress - Low High Stress -4.683 0.639 201 -7.331 <.0001
High Low Stress - High High Stress -4.174 0.755 201 -5.528 <.0001
Low High Stress - High High Stress 0.509 0.771 201 0.660 0.9118
P value adjustment: tukey method for comparing a family of 4 estimates
mentor_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -4.35 0.663 201 -6.557 <.0001
mentor_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -4.17 0.755 201 -5.528 <.0001
--- ANOVA 2: Psychosocial × Stress ---
Anova Table (Type III tests)
Response: DASS_anxiety
Sum Sq Df F value Pr(>F)
(Intercept) 2004.82 1 163.4535 < 2.2e-16 ***
psycsoc_group 21.64 1 1.7640 0.1857
stress_group 890.60 1 72.6111 4.373e-15 ***
psycsoc_group:stress_group 1.80 1 0.1471 0.7017
Residuals 2379.48 194
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Effect sizes
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
----------------------------------------------------------
psycsoc_group | 0.02 | [0.00, 1.00]
stress_group | 0.28 | [0.19, 1.00]
psycsoc_group:stress_group | 7.58e-04 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00]. psycsoc_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 1.321 0.468 194 0.3984 2.24
High Low Stress 0.842 0.464 194 -0.0728 1.76
Low High Stress 5.840 0.495 194 4.8632 6.82
High High Stress 4.971 0.592 194 3.8039 6.14
Confidence level used: 0.95
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 0.479 0.659 194 0.727 0.8860
Low Low Stress - Low High Stress -4.519 0.681 194 -6.631 <.0001
Low Low Stress - High High Stress -3.650 0.755 194 -4.837 <.0001
High Low Stress - Low High Stress -4.998 0.679 194 -7.365 <.0001
High Low Stress - High High Stress -4.129 0.752 194 -5.491 <.0001
Low High Stress - High High Stress 0.869 0.772 194 1.125 0.6744
P value adjustment: tukey method for comparing a family of 4 estimates
psycsoc_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -4.52 0.681 194 -6.631 <.0001
psycsoc_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -4.13 0.752 194 -5.491 <.0001
run_gws_anova(gws,"SBQR_total")
--- ANOVA 1: Mentor × Stress ---
Anova Table (Type III tests)
Response: SBQR_total
Sum Sq Df F value Pr(>F)
(Intercept) 1267.92 1 144.8101 < 2.2e-16 ***
mentor_group 0.29 1 0.0326 0.857006
stress_group 63.27 1 7.2259 0.007801 **
mentor_group:stress_group 0.10 1 0.0111 0.916341
Residuals 1724.89 197
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Effect sizes
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
---------------------------------------------------------
mentor_group | 2.18e-03 | [0.00, 1.00]
stress_group | 0.04 | [0.01, 1.00]
mentor_group:stress_group | 5.62e-05 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00]. mentor_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 2.08 0.406 197 1.27 2.88
High Low Stress 1.95 0.373 197 1.22 2.69
Low High Stress 3.19 0.406 197 2.39 3.99
High High Stress 3.16 0.523 197 2.12 4.19
Confidence level used: 0.95
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 0.1231 0.552 197 0.223 0.9961
Low Low Stress - Low High Stress -1.1132 0.575 197 -1.937 0.2162
Low Low Stress - High High Stress -1.0808 0.662 197 -1.632 0.3633
High Low Stress - Low High Stress -1.2363 0.552 197 -2.242 0.1158
High Low Stress - High High Stress -1.2039 0.642 197 -1.874 0.2425
Low High Stress - High High Stress 0.0324 0.662 197 0.049 1.0000
P value adjustment: tukey method for comparing a family of 4 estimates
mentor_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -1.11 0.575 197 -1.937 0.0542
mentor_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -1.20 0.642 197 -1.874 0.0624
--- ANOVA 2: Psychosocial × Stress ---
Anova Table (Type III tests)
Response: SBQR_total
Sum Sq Df F value Pr(>F)
(Intercept) 1319.39 1 151.7045 < 2.2e-16 ***
psycsoc_group 11.60 1 1.3341 0.249513
stress_group 62.12 1 7.1424 0.008172 **
psycsoc_group:stress_group 4.35 1 0.5001 0.480331
Residuals 1678.55 193
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Effect sizes
# Effect Size for ANOVA (Type I)
Parameter | Eta2 (partial) | 95% CI
----------------------------------------------------------
psycsoc_group | 0.01 | [0.00, 1.00]
stress_group | 0.03 | [0.00, 1.00]
psycsoc_group:stress_group | 2.58e-03 | [0.00, 1.00]
- One-sided CIs: upper bound fixed at [1.00]. psycsoc_group stress_group emmean SE df lower.CL upper.CL
Low Low Stress 2.46 0.394 193 1.687 3.24
High Low Stress 1.67 0.391 193 0.896 2.44
Low High Stress 3.31 0.421 193 2.475 4.14
High High Stress 3.11 0.498 193 2.131 4.10
Confidence level used: 0.95
contrast estimate SE df t.ratio p.value
Low Low Stress - High Low Stress 0.798 0.555 193 1.437 0.4776
Low Low Stress - Low High Stress -0.842 0.577 193 -1.459 0.4642
Low Low Stress - High High Stress -0.650 0.635 193 -1.023 0.7362
High Low Stress - Low High Stress -1.639 0.575 193 -2.854 0.0246
High Low Stress - High High Stress -1.448 0.633 193 -2.286 0.1049
Low High Stress - High High Stress 0.192 0.653 193 0.294 0.9911
P value adjustment: tukey method for comparing a family of 4 estimates
psycsoc_group = Low:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -0.842 0.577 193 -1.459 0.1461
psycsoc_group = High:
contrast estimate SE df t.ratio p.value
Low Stress - High Stress -1.448 0.633 193 -2.286 0.0234