cor.by.class {CCM} | R Documentation |
Finds within class correlations
Description
Finds within class correlations between samples of each class type, which is useful for identifying extreme observations and assessing whether CCM is appropriate for classification.
Usage
cor.by.class(x, y, method = "pearson", use = "complete")
Arguments
x |
data matrix with variables in rows and samples in columns |
y |
classes corresponding to the columns of |
method |
the type of correlation to use, either 'pearson' (the default) or 'spearman' |
use |
instructions for handling missing values. See details and |
Details
Calculates correlations between each pair of observations within each class. The correlation between an observation and itself is ignored.
The default correlation is the Pearson product moment correlation. If method
is 'spearman', then the Spearman's rank correlation is used, which is the Pearson correlation calculated using the ranks of the data.
Correlations are calculated class-wise on the matrix of observations of each class separately. Therefore, missing values may be handled differently for different classes.
Value
A list with each element a vector of correlations between samples of a different class.
Author(s)
Garrett M. Dancik and Yuanbin Ru
Examples
data(data.expr)
data(data.gender)
K = cor.by.class(data.expr, data.gender)
## visualize the results ##
boxplot(K, xlab = "gender")