This function performs both parametric (t-test) and non-parametric (Wilcoxon test) comparisons between two groups. For paired data, it calculates the difference and performs Shapiro-Wilk normality test on the difference. Based on this, it recommends either a paired t-test or a Wilcoxon signed-rank test. Optionally, it calculates the effect size (Cohen's d) and returns assumption diagnostics.
run_paired_tests(
df,
value_col = ".value",
group_col = "jahr",
alpha = 0.05,
effect_size = TRUE,
report_assumptions = TRUE,
paired = TRUE
)A list containing:
Test type performed ("Paired Test" or "Unpaired Test")
Number of observations per group
Names of the two groups
Result of the t-test (paired or unpaired)
Result of the Wilcoxon test
Cohen's d (if enabled)
Shapiro-Wilk normality test result(s)
Recommended test based on normality
A data frame with exactly two groups. / Ein Data Frame mit genau zwei 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 Cohen's d. / Logisch, ob Cohen's d berechnet werden soll
Logical. Whether to include normality test results. / Logisch, ob Shapiro-Test zurueckgegeben wird
Logical. Whether the data are paired. / Logisch: gepaarte Daten?
Diese Funktion fuehrt sowohl parametrische (t-Test) als auch nicht-parametrische (Wilcoxon-Test) Vergleiche zwischen zwei Gruppen durch. Bei gepaarten Daten wird die Differenz gebildet und auf Normalverteilung geprueft(Shapiro-Test). Je nach Ergebnis wird ein gepaarter t-Test oder ein Wilcoxon-Vorzeichen-Rang-Test empfohlen. Optional wird die Effektgroesse (Cohens d) berechnet und die Vorannahmen zurueckgegeben.
[run_group_tests()], [run_multi_group_tests()], [prepare_group_data()]
df <- data.frame(
jahr = rep(c("2020", "2021"), each = 10),
.value = c(rnorm(10, 30), rnorm(10, 32))
)
run_paired_tests(df, paired = TRUE)
Run the code above in your browser using DataLab