Description Details Author(s) See Also Examples
Classification method that classifies an observation based on its correlation with observations having known class labels. There are two main functions. The function create.CCM
creates a correlation matrix of correlations between training and test samples. Both Pearson's and Spearman's rank-based correlations are supported. The function predict.CCM
assigns class labels to test observations according to the class that has the highest mean correlation by default. However, any (user-defined) function in addition to the mean (e.g., median, max) can be specified.
For a complete list of functions, use 'library(help="CCM")'
Package: | CCM |
Type: | Package |
Version: | 1.2 |
Date: | 2018-04-05 |
License: | GPL(>=2) |
LazyLoad: | yes |
Garrett M. Dancik and Yuanbin Ru
Maintainer: Garrett M. Dancik <dancikg@easternct.edu>
create.CCM
;
predict.CCM
;
plot.CCM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## load data ##
data(data.expr)
data(data.gender)
## check within class correlations ##
## outliers may be caused by poor quality ##
## observations or may indicate CCM is not appropriate ##
K = cor.by.class(data.expr, data.gender)
## visualize the results ##
boxplot(K, xlab = "gender")
## split dataset into training / testing ##
train.expr = data.expr[,1:20]
test.expr = data.expr[,21:40]
train.gender = data.gender[1:20]
test.gender = data.gender[21:40]
## CCM using spearman correlation ##
K = create.CCM(test.expr, train.expr, method = "spearman")
## predict based on the class with the highest mean correlation (the default) ##
p = predict(K, train.gender)
table(pred = p, true = test.gender) # check accuracy
## plot correlations for the 3rd observation ##
plot(K, train.gender, index = 3, main = "correlations for obs #3",
xlab = "gender", ylab = "correlation")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.