Learn R Programming

ClassifyR (version 1.2.4)

mixmodels: Selection of Differential Distributions with Mixtures of Normals

Description

Fits mixtures of normals for every gene, separately for each class.

Usage

"mixModelsTrain"(expression, classes, ...) "mixModelsTrain"(expression, ..., verbose = 3) "mixModelsTest"(models, test, ...) "mixModelsTest"(models, test, weighted = c("both", "unweighted", "weighted"), minDifference = 0, returnType = c("label", "score", "both"), verbose = 3)

Arguments

expression
Either a matrix or ExpressionSet containing the training data. For a matrix, the rows are features, and the columns are samples.
test
Either a matrix or ExpressionSet containing the test data. For a matrix, the rows are features, and the columns are samples.
classes
A vector of class labels.
weighted
In weighted mode, the difference in densities is summed over all features. If unweighted mode, each features's vote is worth the same. To save computational time, both can be calculated simultaneously.
minDifference
The minimum difference in densities for a feature to be allowed to vote. Can be a vector of cutoffs.
...
For the training or testing function with matrix dispatch, arguments passed to the function with ExpressionSet dispatch. For the training function with ExpressionSet dispatch, extra arguments passed to mixmodCluster. The argument nbCluster is mandatory.
models
A list of length 2 of models generated by the training function. The first element has mixture models the same length as the number of features in the expression data for one class. The second element has the same information for the other class.
returnType
Either "label", "score", or "both". Sets the return value from the prediction to either a vector of class labels, score for a sample belonging to the second class, as determined by the factor levels, or both labels and scores in a data.frame.
verbose
A number between 0 and 3 for the amount of progress messages to give. A higher number will produce more messages.

Value

For mixModelsTrain, a list of trained models of class MixmodCluster. A vector or list of class prediction information, as long as the number of samples in the test data, or lists of such information, if both weighted and unweighted voting or a range of minDifference values was provided.

Details

For weighted voting, the difference between probability density, scaled for the number of samples of each class used in training, is summed for all features. For unweighted voting, each feature votes based on the scaled density difference with the same strength. For unweighted classification, the score is the number of features which voted for the second class, divided by the features which voted. For weighted classification, the score is the sum of scaled differences in densities.

Examples

Run this code
  # First 25 samples are mixtures of two normals. Last 25 samples are one normal.
  genesMatrix <- sapply(1:25, function(geneColumn) c(rnorm(50, 5, 1), rnorm(50, 15, 1)))
  genesMatrix <- cbind(genesMatrix, sapply(1:25, function(geneColumn) rnorm(100, 9, 3)))
  classes <- factor(rep(c("Poor", "Good"), each = 25))
  trained <- mixModelsTrain(genesMatrix, classes, nbCluster = 1:3)
  mixModelsTest(trained, genesMatrix, minDifference = 1:3)

Run the code above in your browser using DataLab