cor.by.class: Finds within class correlations

Description Usage Arguments Details Value Author(s) Examples

View source: R/cor.by.class.R

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

1
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 x

method

the type of correlation to use, either 'pearson' (the default) or 'spearman'

use

instructions for handling missing values. See details and cor. All values are used by default.

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

1
2
3
4
5
data(data.expr)
data(data.gender)
K = cor.by.class(data.expr, data.gender)
## visualize the results ##
boxplot(K, xlab = "gender")

Example output

calculating cor for:  F 
calculating cor for:  M 

CCM documentation built on May 1, 2019, 10:19 p.m.