R/pc_meta_correlations.R
pc_meta_correlations.Rdpc_meta_correlations() computes associations between PCA axes and metadata
columns. Numeric metadata are tested by correlation, while categorical
metadata are tested by ANOVA and reported with eta-squared effect sizes.
A Seurat object, a numeric PCA matrix, or a data frame containing principal component embeddings.
A data frame of metadata variables. If object is a Seurat
object, this defaults to the object's metadata. Otherwise this argument is
required.
Name of the PCA reduction to use when object is a Seurat
object. Default: "pca".
Character or integer vector of metadata columns to analyse. Default: all columns.
Correlation method for numeric metadata or ranking method for
linear-model mode: "pearson" or "spearman".
Analysis mode: "lm" for linear regression or "correlation"
for simple correlation/ANOVA.
p-value adjustment method passed to p.adjust().
Default: "BH".
Minimum non-missing values required for a metadata column.
Default: 10.
If TRUE, print progress messages.
A data frame with one row per metadata variable and PC axis pair.
Columns include metadata, pc, type, statistic, p.value,
adj.p.value, effect_size, and direction.