clanc.predict: Prediction with Classification to Nearest Centroids...

clanc.predictR Documentation

Prediction with Classification to Nearest Centroids classifier

Description

Predict from a Classification to Nearest Centroids classifier fit.

Usage

clanc.predict(clanc.intcv.model, pred.obj, pred.obj.group.id)

Arguments

clanc.intcv.model

a Classification to Nearest Centroids classifier built with clanc.intcv.

pred.obj

dataset to have its sample group predicted. The dataset must have rows as probes and columns as samples. It must have an equal number of probes as the dataset being trained.

pred.obj.group.id

a vector of sample-group labels for each sample of the dataset to be predicted. It must have an equal length to the number of samples as pred.obj.

Value

a list of 3 elements:

pred

predicted sample group for each sample

mc

a predicted misclassification error rate (external validation)

prob

predicted probability for each sample

References

Alan R. Dabney, Author Notes.(2005) ClaNC: point-and-click software for classifying microarrays to nearest centroids, https://academic.oup.com/bioinformatics/article/22/1/122/219377

Examples

set.seed(101)
biological.effect <- estimate.biological.effect(uhdata = uhdata.pl)
ctrl.genes <- unique(rownames(uhdata.pl))[grep("NC", unique(rownames(uhdata.pl)))]
biological.effect.nc <- biological.effect[!rownames(biological.effect) %in% ctrl.genes, ]
group.id <- substr(colnames(biological.effect.nc), 7, 7)

biological.effect.train.ind <- colnames(biological.effect.nc)[c(sample(which(group.id == "E"), size = 64),
                                          sample(which(group.id == "V"), size = 64))]
biological.effect.test.ind <- colnames(biological.effect.nc)[!colnames(biological.effect.nc) %in% biological.effect.train.ind]

biological.effect.nc.tr <- biological.effect.nc[, biological.effect.train.ind]
biological.effect.nc.te <- biological.effect.nc[, biological.effect.test.ind]

clanc.int <- clanc.intcv(X = biological.effect.nc.tr,
                         y = substr(colnames(biological.effect.nc.tr), 7, 7),
                        kfold = 5, seed = 1)

clanc.pred <- clanc.predict(clanc.intcv.model = clanc.int,
                           pred.obj = biological.effect.nc.te,
                           pred.obj.group.id = substr(colnames(biological.effect.nc.te), 7, 7))
clanc.int$mc
clanc.pred$mc



yilinwu123/precision1 documentation built on June 28, 2022, 2:53 a.m.