compare_cor_ci: compare_cor_ci

View source: R/compare_cor_ci.R

compare_cor_ciR Documentation

compare_cor_ci

Description

Performs pairwise correlations of features with adjusted p-values. Correlations and confidence intervals calculated for each sample group.

Usage

compare_cor_ci(
  mat,
  group,
  method = "pearson",
  adjust = "BH",
  alternative = "two.sided",
  conf_level = 0.95
)

Arguments

mat

matrix with features in columns. correlations calculated between feature pairs for each group

group

group assignment of samples corresponding to rows in mat.

method

correlation method pearson, spearman, kendall

adjust

multiple testing correction method. BH, BY, fdr, hom, hochberg, hommel, bonferroni, none

alternative

two.sided, greater, less

conf_level

confidence level for the returned confidence interval.

Value

Returns a dataframe. x = x variable y = y variable group = sample group n = number of samples in group r = correlation coefficient p = p-value p.adj = adjusted p-value lower_ci = lower confidence interval upper_ci = upper confidence interval

Examples

# load example data
data(dss_example)

# subset features, features in columns
feat_mat <- dss_example$merged_abundance_id[1:6,2:26]
rownames(feat_mat) <- dss_example$merged_abundance_id[1:6,1]
feat_mat <- t(feat_mat)

# metadata in same order
met_df <- dss_example$metadata
met_df <- met_df[match(rownames(feat_mat), met_df$sampleID),]

compare_cor_ci(feat_mat, met_df$Phenotype)

OxfordCMS/OCMSutility documentation built on Feb. 27, 2025, 8:19 p.m.