Anova test to compare cell population frequencies of independent samples
Source:R/differential_testing.R
frequency_anova_test.Rd
frequency_anova_test()
performs an independent measures Anova to compare cell population frequencies of three of more groups. Optionally, post-hoc testing is performed using Emmeans test.
Usage
frequency_anova_test(
fcd,
cluster_slot,
cluster_var,
sample_var,
group_var,
anova_p.adjust.method = "bonferroni",
numeric = F,
color_palette = NULL,
post_hoc_test = T,
post_hoc_p.adjust.method = "bonferroni",
anova_sig_threshold = 0.05
)
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.
- anova_p.adjust.method
p-value adjustment method to use for multiple test correction of Anova tests, e.g "bonferroni"(default) or "BH" (Benjamini-Hochberg). All available options can be checked in the documentation of the
adjust_pvalue
function from the packagerstatix
.- 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.
- color_palette
Color Palette (Charlotte check)
- 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 packagerstatix
.- anova_sig_threshold
significance threshold of the Anova test. For all Anova tests with an adjusted p-value equal or smaller than the threshold, post-hoc tests are performed (default 0.05)
Value
frequency_anova_test()
returns a list of two data frames, "anova_test" and "emmeans_test". "anova_test" comprises results produced by anova_test
and "emmeans_test" contains results obtained by emmeans_test
. Both data frames have one additional columns, "cluster", containing the information, which cell population was tested.
Details
frequency_anova_test
frequency_anova_test()
is a wrapper function around anova_test
and emmeans_test
implemented in the package rstatix
.
The function first calculates cell population frequencies for each sample in sample_var. Then a independent measures, one-way Anova test is performed for each cell population followed by p-value adjustment. If post_hoc = T
, post-hoc testing with pairwise emmeans tests and p-value correction is performed for each significant Anova test.