Compute pairwise linear associations between columns of X and Y
Source:R/helpers-associations.R
dot-lin_associations.RdAdapted from lin_associations in the
cdsrmodels package
(MIT License; authors William Colgan and Andrew Boghossian) to remove
a GitHub-only package dependency. The license text and copyright notice are
in inst/licenses/cdsrmodels-MIT.txt
(system.file("licenses", "cdsrmodels-MIT.txt", package = "gDRplots")).
Uses WGCNA::cor for fast pairwise correlation on large
matrices and ashr::ash for empirical-Bayes
shrinkage of effect sizes.
Arguments
- X
matrixof independent variables (rows = samples, cols = features).- Y
matrixorvectorof response variables (rows = samples).- n.min
integer; minimum number of degrees of freedom (finite paired observations minus 2) required to compute a p-value (default 4, i.e. at least 6 paired observations).
- shrinkage
logical; apply
ashrshrinkage (defaultTRUE).- alpha
numeric;
ashralpha parameter (default 0).- MHC_direction
character;
"x"or"y"— direction of multiple-hypothesis correction (Benjamini-Hochberg). With"y", p-values are adjusted across the features ofXseparately for each column ofY; with"x", across the columns ofYseparately for each feature ofX. Defaults to"x"whenlength(Y) >= length(X), otherwise"y"(same default ascdsrmodels::lin_associations).