bartlettSelection {ClassifyR} | R Documentation |
Ranks features by largest Bartlett statistic and chooses the features which have best resubstitution performance.
## S4 method for signature 'matrix' bartlettSelection(measurements, classes, ...) ## S4 method for signature 'DataFrame' bartlettSelection(measurements, classes, datasetName, trainParams, predictParams, resubstituteParams, selectionName = "Bartlett Test", verbose = 3) ## S4 method for signature 'MultiAssayExperiment' bartlettSelection(measurements, targets, ...)
measurements |
Either a |
classes |
Either a vector of class labels of class |
targets |
If |
... |
Variables not used by the |
datasetName |
A name for the data set used. Stored in the result. |
trainParams |
A container of class |
predictParams |
A container of class |
resubstituteParams |
An object of class |
selectionName |
A name to identify this selection method by. Stored in the result. |
verbose |
Default: 3. A number between 0 and 3 for the amount of progress messages to give. This function only prints progress messages if the value is 3. |
The calculation of the test statistic is performed by the bartlett.test
function from the stats
package.
Data tables which consist entirely of non-numeric data cannot be analysed. If measurements
is an object of class MultiAssayExperiment
, the factor of sample classes must be stored
in the DataFrame accessible by the colData
function with column name "class"
.
An object of class SelectResult
or a list of such objects, if the classifier which was
used for determining the specified performance metric made a number of prediction varieties.
Dario Strbenac
# Samples in one class with differential variability to other class. # First 20 genes are DV. genesRNAmatrix <- sapply(1:25, function(sample) c(rnorm(100, 9, 1))) moreVariable <- sapply(1:25, function(sample) rnorm(20, 9, 5)) genesRNAmatrix <- cbind(genesRNAmatrix, rbind(moreVariable, sapply(1:25, function(sample) rnorm(80, 9, 1)))) colnames(genesRNAmatrix) <- paste("Sample", 1:50) rownames(genesRNAmatrix) <- paste("Gene", 1:100) genesSNPmatrix <- matrix(sample(c("None", "Missense"), 250, replace = TRUE), ncol = 50) colnames(genesSNPmatrix) <- paste("Sample", 1:50) rownames(genesSNPmatrix) <- paste("Gene", 1:5) classes <- factor(rep(c("Poor", "Good"), each = 25)) names(classes) <- paste("Sample", 1:50) genesDataset <- MultiAssayExperiment(list(RNA = genesRNAmatrix, SNP = genesSNPmatrix), colData = DataFrame(class = classes)) # Wait for update to MultiAssayExperiment wideFormat function. trainIDs <- paste("Sample", c(1:20, 26:45)) genesDataset <- subtractFromLocation(genesDataset, training = trainIDs, targets = "RNA") # Exclude SNP data. resubstituteParams <- ResubstituteParams(nFeatures = seq(10, 100, 10), performanceType = "balanced error", better = "lower") bartlettSelection(genesDataset, datasetName = "Example", targets = "RNA", trainParams = TrainParams(fisherDiscriminant), predictParams = PredictParams(NULL), resubstituteParams = resubstituteParams)