This function performs multi-group statistical comparisons depending on distribution and variance assumptions. If all groups pass the Shapiro-Wilk test for normality and Levene's test for homogeneity of variances, an ANOVA is performed with post-hoc Tukey test. Otherwise, the Kruskal-Wallis test is used, followed by Dunn's test (Bonferroni-adjusted). Effect size (eta2 or approximate) and assumption diagnostics are returned.
run_multi_group_tests(
df,
value_col = ".value",
group_col = "jahr",
alpha = 0.05,
effect_size = TRUE,
report_assumptions = TRUE
)A list containing:
Type of test performed ("ANOVA" or "Kruskal-Wallis")
Sample size per group
List of assumption test results: Shapiro-Wilk, Levene, Bartlett
Test result object
Effect size
Interpretation of eta2 magnitude
Post-hoc test result (Tukey or Dunn)
Recommended method based on assumption checks
A data frame with three or more groups. / Ein Data Frame mit drei oder mehr Gruppen
Name of the column containing values to compare. Default is ".value". / Name der Werte-Spalte, Standard: ".value"
Name of the grouping variable. Default is "jahr". / Spaltenname der Gruppierungsvariable, Standard: "jahr"
Significance level for hypothesis testing. Default is 0.05. / Signifikanzniveau fuer Testentscheidungen, Standard: 0.05
Logical. Whether to calculate eta2 or its approximation. / Logisch, ob eta2 berechnet werden soll
Logical. Whether to include assumption checks. / Logisch, ob Vorannahmen ausgegeben werden sollen
Diese Funktion fuehrt Mehr-Gruppen-Vergleiche durch, abhaengig von Verteilungs- und Varianzannahmen. Wenn alle Gruppen normalverteilt sind (Shapiro-Wilk) und die Varianz homogen ist (Levene-Test), wird eine ANOVA mit Tukey-Post-Hoc-Test durchgefuehrt. Andernfalls wird ein Kruskal-Wallis-Test mit anschliessender Dunn-Analyse (Bonferroni-korrigiert) verwendet. Effektgroessen (eta2 oder Annaeherung) und Annahmepruefungen werden zurueckgegeben.
[run_group_tests()], [run_paired_tests()]
df <- data.frame(
jahr = rep(c("2020", "2021", "2022"), each = 10),
.value = c(rnorm(10, 20), rnorm(10, 23), rnorm(10, 22))
)
run_multi_group_tests(df)
Run the code above in your browser using DataLab