Description Usage Arguments Details Value Note Author(s) See Also Examples

Classification as a function of a CCM correlation matrix that contains the correlations between test and training samples

1 2 |

`object` |
a CCM correlation matrix object obtained from |

`y` |
classes corresponding to the training samples (columns) of ‘object’ |

`func` |
the function that determines how a test sample is classified, defaulting to |

`ret.scores` |
If set to TRUE then a matrix of results by class are returned (see details); otherwise a vector of classifications/predictions is returned (the default) |

`...` |
Additional arguments to |

The function `func`

can be any R function whose first argument is a vector of correlations (x). The CCM assigns each test sample the class that maximizes func(x). If `func`

is `mean` (the default), the classification is the class with the highest mean correlation. Other useful values for `func`

include `median` and `max`.

If `ret.scores`

is TRUE, then a matrix of results by class is returned, where the i(th) column corresponds to the i(th) test sample and each row corresponds to a possible class. Entry (i,j) contains func(x), where `x`

is a vector of correlations between the i(th) test sample and all training samples with the class in row j.

The test sample classifications as a vector or a matrix of results by class.

If the `max` function is used for `func`

, then the CCM is identical to a 1-nearest neighbor classifier with distance = 1 - r, where 'r' is the correlation (pearson or spearman) specified in the call to `create.CCM`

Garrett M. Dancik and Yuanbin Ru

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
data(data.expr)
data(data.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
## CCM using pearson correlation ##
K = create.CCM(test.expr, train.expr, method = "pearson")
## predict based on the class with the maximum correlation
p = predict(K, train.gender, func = max)
table(pred = p, true = test.gender) # check accuracy
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.