Skip to contents

frequency_kruskal_test() performs a Kruskal-Wallis Rank Sum test to compare cell population frequencies of three of more groups. Optionally, post-hoc testing is performed using Dunne's test.

Usage

frequency_kruskal_test(
  fcd,
  cluster_slot,
  cluster_var,
  sample_var,
  group_var,
  kruskal_p.adjust.method = "bonferroni",
  post_hoc_test = T,
  post_hoc_p.adjust.method = "bonferroni",
  kruskal_sig_threshold = 0.05,
  numeric = F
)

Arguments

fcd

flow cytometry data set, that has been subjected to clustering or cell type label prediction with cyCONDOR

cluster_slot

string specifying which clustering slot to use to find variable specified in cluster_var

cluster_var

string specifying variable in cluster_slot that identifies cell population labels to be used (e.g. clusters, metaclusters or predicted labels).

sample_var

string indicating variable in cell_anno that defines sample IDs to be used.

group_var

string indicating variable in cell_anno that should be used to group samples in sample_var. group_var must have three or more levels.

kruskal_p.adjust.method

p-value adjustment method to use for multiple comparisons of Kruskal-Wallis test, e.g "bonferroni" (default) or "BH" (Benjamini-Hochberg). All available options can be checked in the documentation of the adjust_pvalue function from the package rstatix.

post_hoc_test

logical, whether to perform post-hoc testing (TRUE, default) or not (FALSE).

post_hoc_p.adjust.method

p-value adjustment method to use for post-hoc testing, e.g "bonferroni" (default). All available options can be checked in the documentation of the adjust_pvalue function from the package rstatix.

kruskal_sig_threshold

significance threshold for Kruskal-Wallis test. For all Kruskal-Wallis comparisons with an adjusted p-value equal or smaller than the threshold, post-hoc tests are performed (default 0.05)

numeric

logical, if TRUE numeric levels in cluster_var are ordered in ascending order and "Cluster_" is pasted before number, if FALSE alphabetical ordering is applied.

Value

frequency_kruskal_test() returns a list of two data frames, "kruskal_test" and "dunn_test". "kruskal_test" comprises results produced by kruskal_test and kruskal_effsize and "dunn_test" contains results obtained by dunn_test. Both data frames have one additional columns, "cluster", containing the information, which cell population was tested.

Details

frequency_kruskal_test

frequency_kruskal_test() is a wrapper function around kruskal_test, kruskal_effsize and dunn_test implemented in the package *rstatix*. The function first calculates cell population frequencies for each sample in sample_var. Then a Kruskal-Wallis rank sum test is performed for each cell population followed by p-value adjustment. If post_hoc = T, post-hoc testing with Dunne's Test and p-value correction is performed for each significant Kruskal-Wallis comparison.