
Kruskal-Wallis or Friedman Test for Differential Expression Analysis
gly_kruskal.RdPerform Kruskal-Wallis or Friedman tests for glycomics or glycoproteomics
data.
For significant results, Dunn's post-hoc test is automatically performed.
P-values are adjusted for multiple testing using the method specified by p_adj_method.
Usage
gly_kruskal(
exp,
group_col = "group",
p_adj_method = "BH",
add_info = TRUE,
...,
subject_col = NULL,
log_transform = TRUE
)Arguments
- exp
A
glyexp::GlycomicSE()orglyexp::GlycoproteomicSE()object, or anotherSummarizedExperimentcontaining an expression matrix and sample information.- group_col
A character string specifying the column name of the grouping variable in the sample information. Default is
"group".- p_adj_method
A character string specifying the method to adjust p-values. See
p.adjust.methodsfor available methods. Default is "BH". If NULL, no adjustment is performed.- add_info
A logical value. If TRUE (default), variable information from the experiment will be added to the result tibble. If FALSE, only the statistical results are returned.
- ...
Additional arguments passed to
stats::kruskal.test()or, for paired analyses,stats::friedman.test().- subject_col
An optional character string naming the subject identifier column in sample information. When supplied, a Friedman test is performed.
- log_transform
A single non-missing logical value. If
TRUE(default), transform expression values usinglog2(x + 1e-6)before analysis. IfFALSE, use the supplied values unchanged, for example for already log-transformed data.
Value
A list containing three elements:
tidy_result: A list containing:main_test: A tibble with Kruskal-Wallis or Friedman test results containing the following columns:variable: Variable namestatistic: Kruskal-Wallis test statisticp_val: Raw p-value from Kruskal-Wallis testparameter: Degrees of freedommethod: Statistical method usedeffect_size: Epsilon-squared, or Kendall's W for paired analysesp_adj: Adjusted p-value (if p_adj_method is not NULL)post_hoc: Significant group pairs from post-hoc test, in the format of "ref_vs_test".
post_hoc_test: A tibble with pairwise comparison results containing the following columns:variable: Variable nameref_group: Reference grouptest_group: Test/treatment/case groupp_val: Raw post-hoc p-valuep_adj: Holm-adjusted post-hoc p-value
raw_result: A list containing:main_test: A list of rawkruskal.testorfriedman.testobjects.post_hoc_test: A list of raw Dunn or paired Wilcoxon summaries.
meta_data: A list containing metadata from the input experiment.
Details
Tests and effect sizes use the selected analysis scale. Reported fold changes continue to use ratios of group means from the original supplied values.
By default, expression data are transformed using log2(x + 1e-6) before
statistical testing. Set log_transform = FALSE to skip this transformation.
At least 2 groups are required in the grouping variable.
In paired analyses, only subjects observed in every group are used, with at
most one sample per subject and group. The reported effect size is Kendall's
\(W\).
For any variable failed to fit a stats::kruskal.test() or
stats::friedman.test() model,
NAs will be assigned to the results in both main test and post-hoc test.
Post-hoc Test:
Dunn's test with Holm correction for multiple comparisons (FSA::dunnTest()) is performed
for variables with significant main effects (p_adj < 0.05). Paired analyses
instead use paired Wilcoxon signed-rank tests with Holm correction.